2 /*--------------------------------------------------------------------*/
3 /*--- 64-bit AIX5-specific kernel interface. vki-ppc64-aix5.h ---*/
4 /*--------------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2006-2010 OpenWorks LLP
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28 The GNU General Public License is contained in the file COPYING.
31 /* This file defines types and constants for the kernel interface, and to
32 make that clear everything is prefixed VKI_/vki_.
35 /* This file was generated by running auxprogs/aix5_VKI_info.c. */
37 #ifndef __VKI_PPC64_AIX5_H
38 #define __VKI_PPC64_AIX5_H
40 #if !defined(VGP_ppc64_aix5)
41 # error This file should be included in 64-bit AIX5 builds only.
44 //--------------------------------------------------------------
46 //--------------------------------------------------------------
48 /* ---------------- Errors ---------------- */
52 #define VKI_ENOSYS 109
64 #define VKI_EOVERFLOW 127
65 #define VKI_ERESTARTSYS 0 /* AIX doesn't have this */
67 /* ---------------- File I/O ---------------- */
69 #define VKI_O_WRONLY 0x00000001
70 #define VKI_O_RDONLY 0x00000000
71 #define VKI_O_APPEND 0x00000008
72 #define VKI_O_CREAT 0x00000100
73 #define VKI_O_RDWR 0x00000002
74 #define VKI_O_EXCL 0x00000400
75 #define VKI_O_TRUNC 0x00000200
77 #define VKI_S_IRUSR 0x00000100
78 #define VKI_S_IXUSR 0x00000040
79 #define VKI_S_IXGRP 0x00000008
80 #define VKI_S_IXOTH 0x00000001
81 #define VKI_S_IWUSR 0x00000080
82 #define VKI_S_IWOTH 0x00000002
83 #define VKI_S_ISUID 0x00000800
84 #define VKI_S_ISGID 0x00000400
85 #define VKI_S_IFMT 0x0000f000
86 #define VKI_S_IFDIR 0x00004000
87 #define VKI_S_IFCHR 0x00002000
88 #define VKI_S_IFBLK 0x00006000
90 /* Next 3 are from include/vki/vki-linux.h */
91 #define VKI_S_ISDIR(m) (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
92 #define VKI_S_ISCHR(m) (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
93 #define VKI_S_ISBLK(m) (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
95 #define VKI_F_DUPFD 0x00000000
96 #define VKI_F_SETFD 0x00000002
97 #define VKI_FD_CLOEXEC 0x00000001
99 #define VKI_R_OK 0x00000004
100 #define VKI_W_OK 0x00000002
101 #define VKI_X_OK 0x00000001
104 sizeof(struct stat) = 176
110 st_size: off 168 sz 8
113 /* 0 */ ULong st_dev;
114 /* 8 */ ULong st_ino;
115 /* 16 */ UInt st_mode;
116 /* 20 */ UInt __off20;
117 /* 24 */ UInt st_uid;
118 /* 28 */ UInt st_gid;
119 /* 32 */ UChar __off28[168-32];
120 /* 168 */ ULong st_size;
123 #define VKI_STX_NORMAL 0
125 typedef ULong vki_size_t;
127 #define VKI_SEEK_SET 0
128 #define VKI_PATH_MAX 1023
131 sizeof(struct iovec) = 16
137 /* 0 */ Addr iov_base;
138 /* 8 */ ULong iov_len;
141 #define _VKI_IOC_NONE 0
142 #define _VKI_IOC_READ 1 /* kernel reads, userspace writes */
143 #define _VKI_IOC_WRITE 2 /* kernel writes, userspace reads */
144 #define _VKI_IOC_DIR(_x) (((_x) >> 30) & 3)
145 #define _VKI_IOC_SIZE(_x) (((_x) >> 16) & 0x7F)
147 /* ---------------- MMappery ---------------- */
149 /* This assumes the page size is 4096. That assumption is checked
151 #define VKI_PAGE_SHIFT 12
152 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
153 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
154 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
156 #define VKI_PROT_NONE 0x00000000
157 #define VKI_PROT_READ 0x00000001
158 #define VKI_PROT_WRITE 0x00000002
159 #define VKI_PROT_EXEC 0x00000004
161 #define VKI_MAP_FIXED 0x00000100
162 #define VKI_MAP_PRIVATE 0x00000002
163 #define VKI_MAP_ANONYMOUS 0x00000010
165 /* ---------------- RLimitery ---------------- */
167 /* rlimit: these pertain to syscall "appgetrlimit" */
168 #define VKI_RLIMIT_DATA 0x00000002
169 #define VKI_RLIMIT_NOFILE 0x00000007
170 #define VKI_RLIMIT_STACK 0x00000003
171 #define VKI_RLIMIT_CORE 0x00000004
174 sizeof(struct rlimit) = 16
179 /* 0 */ ULong rlim_cur;
180 /* 8 */ ULong rlim_max;
183 /* ---------------- Time ---------------- */
186 sizeof(struct timeval) = 16
191 /* 0 */ ULong tv_sec; /* seconds */
192 /* 8 */ UInt tv_usec; /* microseconds */
193 /* 12 */ UInt __off12;
197 sizeof(struct timespec) = 16
201 struct vki_timespec {
202 /* 0 */ ULong tv_sec; /* seconds */
203 /* 8 */ ULong tv_nsec; /* nanoseconds */
206 /* ---------------- Signals ---------------- */
208 /* This layout verified 27 July 06. */
209 #define _VKI_NSIG_BPW 64
210 #define _VKI_NSIG 256
211 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
214 ULong sig[_VKI_NSIG_WORDS];
217 #define VKI_SIGSEGV 11
218 #define VKI_SIGBUS 10
222 #define VKI_SIGQUIT 3
223 #define VKI_SIGABRT 6
224 #define VKI_SIGUSR1 30
225 #define VKI_SIGUSR2 31
226 #define VKI_SIGPIPE 13
227 #define VKI_SIGALRM 14
228 #define VKI_SIGTERM 15
229 /* VKI_SIGSTKFLT does not exist on AIX 5.2 */
230 #define VKI_SIGTTIN 21
231 #define VKI_SIGTTOU 22
232 #define VKI_SIGXCPU 24
233 #define VKI_SIGXFSZ 25
234 #define VKI_SIGVTALRM 34
235 #define VKI_SIGPROF 32
237 #define VKI_SIGPWR 29
238 /* VKI_SIGUNUSED does not exist on AIX 5.2 */
239 #define VKI_SIGRTMIN 50
240 #define VKI_SIGRTMAX 57
241 #define VKI_SIGTRAP 5
242 #define VKI_SIGCONT 19
243 #define VKI_SIGCHLD 20
244 #define VKI_SIGWINCH 28
245 #define VKI_SIGURG 16
247 #define VKI_SIGSTOP 17
248 #define VKI_SIGKILL 9
249 #define VKI_SIGTSTP 18
250 #define VKI_SIGSYS 12
253 sizeof(struct sigaction) = 48
254 sa_sigaction: off 0 sz 8
255 sa_handler: off 0 sz 8
257 sa_flags: off 40 sz 4
259 struct vki_sigaction {
260 /* 0 */ void* ksa_handler;
261 /* 8 */ vki_sigset_t sa_mask;
262 /* 40 */ UInt sa_flags;
263 /* 44 */ UInt __off44;
266 #define VKI_SA_ONSTACK 1
267 #define VKI_SA_RESTART 8
268 #define VKI_SA_RESETHAND 2
269 #define VKI_SA_SIGINFO 256
270 #define VKI_SA_NODEFER 512
271 #define VKI_SA_NOCLDSTOP 4
272 #define VKI_SA_NOCLDWAIT 1024
274 #define VKI_SA_RESTORER 0 /* AIX doesn't have this */
275 #define VKI_SA_NOMASK 0 /* AIX doesn't have this */
276 #define VKI_SA_ONESHOT 0 /* AIX doesn't have this */
278 #define VKI_SS_ONSTACK 1
279 #define VKI_SS_DISABLE 2
281 #define VKI_MINSIGSTKSZ 1200
283 #define VKI_SI_USER 0
285 #define VKI_SIG_BLOCK 0
286 #define VKI_SIG_SETMASK 2
287 #define VKI_SIG_UNBLOCK 1
288 #define VKI_SIG_IGN (void*)1
289 #define VKI_SIG_DFL (void*)0
291 #define VKI_SEGV_ACCERR 51
292 #define VKI_SEGV_MAPERR 50
294 #define VKI_TRAP_TRACE 61
295 #define VKI_TRAP_BRKPT 60
296 #define VKI_BUS_OBJERR 3
297 #define VKI_BUS_ADRERR 2
298 #define VKI_BUS_ADRALN 1
299 #define VKI_FPE_FLTSUB 27
300 #define VKI_FPE_FLTINV 26
301 #define VKI_FPE_FLTRES 25
302 #define VKI_FPE_FLTUND 24
303 #define VKI_FPE_FLTOVF 23
304 #define VKI_FPE_FLTDIV 22
305 #define VKI_FPE_INTOVF 21
306 #define VKI_FPE_INTDIV 20
308 #define VKI_ILL_BADSTK 37
309 #define VKI_ILL_COPROC 36
310 #define VKI_ILL_PRVREG 35
311 #define VKI_ILL_PRVOPC 34
312 #define VKI_ILL_ILLTRP 33
313 #define VKI_ILL_ILLADR 32
314 #define VKI_ILL_ILLOPN 31
315 #define VKI_ILL_ILLOPC 30
318 sizeof(siginfo_t) = 64
325 /* 0 */ UInt si_signo;
327 /* 8 */ UInt si_code;
328 /* 12 */ UInt si_pid;
329 /* 16 */ UInt __off16;
330 /* 20 */ UInt __off20;
331 /* 24 */ void* si_addr;
332 /* 32 */ UInt __off32;
333 /* 36 */ UInt __off36;
334 /* 40 */ UInt __off40;
335 /* 44 */ UInt __off44;
336 /* 48 */ UInt __off48;
337 /* 52 */ UInt __off52;
338 /* 56 */ UInt __off56;
339 /* 60 */ UInt __off60;
346 ss_flags: off 16 sz 4
348 typedef struct vki_sigaltstack {
350 /* 8 */ ULong ss_size;
351 /* 16 */ UInt ss_flags;
352 /* 20 */ UInt __off20;
353 /* 24 */ ULong __off24;
354 /* 32 */ ULong __off32;
357 /* ---------------- Misc ---------------- */
359 #define VKI_PTRACE_TRACEME 0 /* nb: is really PT_TRACE_ME */
360 #define VKI_PTRACE_DETACH 31 /* nb: is really PT_DETACH */
363 //--------------------------------------------------------------
365 //--------------------------------------------------------------
371 struct vki_sockaddr {
379 /* Structure describing an Internet (IP) socket address. */
380 //struct vki_sockaddr_in {
384 struct vki_ucontext {
389 //--------------------------------------------------------------
390 // FROM glibc-ports-2.4/sysdeps/unix/sysv/aix/dlldr.h
391 //--------------------------------------------------------------
393 /* Copyright (C) 2001 Free Software Foundation, Inc.
394 This file is part of the GNU C Library.
396 The GNU C Library is free software; you can redistribute it and/or
397 modify it under the terms of the GNU Lesser General Public
398 License as published by the Free Software Foundation; either
399 version 2.1 of the License, or (at your option) any later version.
401 The GNU C Library is distributed in the hope that it will be useful,
402 but WITHOUT ANY WARRANTY; without even the implied warranty of
403 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
404 Lesser General Public License for more details.
406 You should have received a copy of the GNU Lesser General Public
407 License along with the GNU C Library; if not, write to the Free
408 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
414 int __loadx(flag, module, arg1, arg2, arg3)
416 The __loadx() is a call to ld_loadutil() kernel function, which
417 does the real work. Note ld_loadutil() is not exported an cannot be
418 called directly from user space.
420 void *ld_loadutil() call is a utility function used for loader extensions
421 supporting run-time linking and dl*() functions.
423 void * - will return the modules entry point if it succeds of NULL
426 int flag - the flag field performas a dual role: the top 8 bits specify
427 the work for __loadx() to perform, the bottom 8 bits are
428 used to pass flags to the work routines, all other bits are
433 #define VKI_DL_LOAD 0x1000000 /* __loadx(flag,buf, buf_len, filename, libr_path) */
434 #define VKI_DL_POSTLOADQ 0x2000000 /* __loadx(flag,buf, buf_len, module_handle) */
435 #define VKI_DL_EXECQ 0x3000000 /* __loadx(flag,buf, buf_len) */
436 #define VKI_DL_EXITQ 0x4000000 /* __loadx(flag,buf, buf_len) */
437 #define VKI_DL_PREUNLOADQ 0x5000000 /* __loadx(flag,buf, buf_len, module_handle) */
438 #define VKI_DL_INIT 0x6000000 /* __loadx(flag,NULL) */
439 #define VKI_DL_GETSYM 0x7000000 /* __loadx(flag,symbol, index, modules_data_origin) */
440 #define VKI_DL_SETDEPEND 0x8000000 /* __loadx(flag,import_data_org, import_index, */
441 /* export_data_org, export_index) */
442 #define VKI_DL_DELDEPEND 0x9000000 /* __loadx(flag,import_data_org, import_index, */
443 /* export_data_org, export_index) */
444 #define VKI_DL_GLOBALSYM 0xA000000 /* __loadx(flag,symbol_name, ptr_to_rec_index, */
445 /* ptr_to_rec_data_org) */
446 #define VKI_DL_UNIX_SYSCALL 0xB000000 /* __loadx(flag,syscall_symbol_name) */
448 #define VKI_DL_FUNCTION_MASK 0xFF000000
449 #define VKI_DL_SRCHDEPENDS 0x00100000
450 #define VKI_DL_SRCHMODULE 0x00080000
451 #define VKI_DL_SRCHLOADLIST 0x00040000
452 #define VKI_DL_LOAD_LDX1 0x00040000
453 #define VKI_DL_LOAD_RTL 0x00020000
454 #define VKI_DL_HASHSTRING 0x00020000
455 #define VKI_DL_INFO_OK 0x00010000
456 #define VKI_DL_LOAD_DLINFO 0x00010000
457 #define VKI_DL_UNLOADED 0x00020000
460 #endif // __VKI_PPC64_AIX5_H
462 /*--------------------------------------------------------------------*/
464 /*--------------------------------------------------------------------*/