• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*--------------------------------------------------------------------*/
3 /*--- 64-bit AIX5-specific kernel interface.      vki-ppc64-aix5.h ---*/
4 /*--------------------------------------------------------------------*/
5 
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9 
10    Copyright (C) 2006-2010 OpenWorks LLP
11       info@open-works.co.uk
12 
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.
17 
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.
22 
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
26    02111-1307, USA.
27 
28    The GNU General Public License is contained in the file COPYING.
29 */
30 
31 /* This file defines types and constants for the kernel interface, and to
32    make that clear everything is prefixed VKI_/vki_.
33 */
34 
35 /* This file was generated by running auxprogs/aix5_VKI_info.c. */
36 
37 #ifndef __VKI_PPC64_AIX5_H
38 #define __VKI_PPC64_AIX5_H
39 
40 #if !defined(VGP_ppc64_aix5)
41 #  error This file should be included in 64-bit AIX5 builds only.
42 #endif
43 
44 //--------------------------------------------------------------
45 // VERIFIED
46 //--------------------------------------------------------------
47 
48 /* ---------------- Errors ---------------- */
49 
50 #define VKI_EINVAL 22
51 #define VKI_EINTR  4
52 #define VKI_ENOSYS 109
53 #define VKI_EAGAIN 11
54 #define VKI_ENOMEM 12
55 #define VKI_EACCES 13
56 #define VKI_EEXIST 17
57 #define VKI_EPERM  1
58 #define VKI_ENOENT 2
59 #define VKI_ESRCH  3
60 #define VKI_EBADF  9
61 #define VKI_EFAULT 14
62 #define VKI_EMFILE 24
63 #define VKI_ECHILD 10
64 #define VKI_EOVERFLOW 127
65 #define VKI_ERESTARTSYS 0 /* AIX doesn't have this */
66 
67 /* ---------------- File I/O ---------------- */
68 
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
76 
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
89 
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)
94 
95 #define VKI_F_DUPFD  0x00000000
96 #define VKI_F_SETFD  0x00000002
97 #define VKI_FD_CLOEXEC  0x00000001
98 
99 #define VKI_R_OK 0x00000004
100 #define VKI_W_OK 0x00000002
101 #define VKI_X_OK 0x00000001
102 
103 /* Known:
104    sizeof(struct stat) = 176
105       st_dev:  off   0 sz 8
106       st_ino:  off   8 sz 8
107       st_mode: off  16 sz 4
108       st_uid:  off  24 sz 4
109       st_gid:  off  28 sz 4
110       st_size: off 168 sz 8
111 */
112 struct vki_stat {
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;
121 };
122 
123 #define VKI_STX_NORMAL  0
124 
125 typedef ULong vki_size_t;
126 
127 #define VKI_SEEK_SET 0
128 #define VKI_PATH_MAX 1023
129 
130 /* Known:
131    sizeof(struct iovec) = 16
132       iov_base: off  0 sz 8
133       iov_len:  off  8 sz 8
134 
135 */
136 struct vki_iovec {
137    /* 0 */ Addr  iov_base;
138    /* 8 */ ULong iov_len;
139 };
140 
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)
146 
147 /* ---------------- MMappery ---------------- */
148 
149 /* This assumes the page size is 4096.  That assumption is checked
150    by the launcher. */
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
155 
156 #define VKI_PROT_NONE  0x00000000
157 #define VKI_PROT_READ  0x00000001
158 #define VKI_PROT_WRITE 0x00000002
159 #define VKI_PROT_EXEC  0x00000004
160 
161 #define VKI_MAP_FIXED     0x00000100
162 #define VKI_MAP_PRIVATE   0x00000002
163 #define VKI_MAP_ANONYMOUS 0x00000010
164 
165 /* ---------------- RLimitery ---------------- */
166 
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
172 
173 /* Known:
174    sizeof(struct rlimit) = 16
175       rlim_cur: off  0 sz 8
176       rlim_max: off  8 sz 8
177 */
178 struct vki_rlimit {
179    /* 0 */ ULong rlim_cur;
180    /* 8 */ ULong rlim_max;
181 };
182 
183 /* ---------------- Time ---------------- */
184 
185 /* Known:
186    sizeof(struct timeval) = 16
187       tv_sec: off  0 sz 8
188      tv_usec: off  8 sz 4
189 */
190 struct vki_timeval {
191    /*  0 */ ULong tv_sec;         /* seconds */
192    /*  8 */ UInt  tv_usec;        /* microseconds */
193    /* 12 */ UInt  __off12;
194 };
195 
196 /* Known:
197    sizeof(struct timespec) = 16
198       tv_sec: off  0 sz 8
199      tv_nsec: off  8 sz 8
200 */
201 struct vki_timespec {
202    /* 0 */ ULong tv_sec;         /* seconds */
203    /* 8 */ ULong tv_nsec;        /* nanoseconds */
204 };
205 
206 /* ---------------- Signals ---------------- */
207 
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)
212 
213 typedef struct {
214    ULong sig[_VKI_NSIG_WORDS];
215 } vki_sigset_t;
216 
217 #define VKI_SIGSEGV   11
218 #define VKI_SIGBUS    10
219 #define VKI_SIGFPE     8
220 #define VKI_SIGHUP     1
221 #define VKI_SIGINT     2
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
236 #define VKI_SIGIO     23
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
246 #define VKI_SIGILL     4
247 #define VKI_SIGSTOP   17
248 #define VKI_SIGKILL    9
249 #define VKI_SIGTSTP   18
250 #define VKI_SIGSYS    12
251 
252 /* Known:
253    sizeof(struct sigaction) = 48
254    sa_sigaction: off  0 sz 8
255      sa_handler: off  0 sz 8
256         sa_mask: off  8 sz 32
257        sa_flags: off 40 sz 4
258 */
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;
264 };
265 
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
273 
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 */
277 
278 #define VKI_SS_ONSTACK 1
279 #define VKI_SS_DISABLE 2
280 
281 #define VKI_MINSIGSTKSZ 1200
282 
283 #define VKI_SI_USER  0
284 
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
290 
291 #define VKI_SEGV_ACCERR 51
292 #define VKI_SEGV_MAPERR 50
293 
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
307 
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
316 
317 /* Known:
318    sizeof(siginfo_t) = 64
319       si_signo: off  0 sz 4
320        si_code: off  8 sz 4
321         si_pid: off 12 sz 4
322        si_addr: off 24 sz 8
323 */
324 typedef struct {
325    /*  0 */ UInt  si_signo;
326    /*  4 */ UInt  __off4;
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;
340 } vki_siginfo_t;
341 
342 /* Known:
343    sizeof(stack_t) = 40
344        ss_sp: off  0 sz 8
345      ss_size: off  8 sz 8
346     ss_flags: off 16 sz 4
347 */
348 typedef struct vki_sigaltstack {
349    /*  0 */ void* ss_sp;
350    /*  8 */ ULong ss_size;
351    /* 16 */ UInt  ss_flags;
352    /* 20 */ UInt  __off20;
353    /* 24 */ ULong __off24;
354    /* 32 */ ULong __off32;
355 } vki_stack_t;
356 
357 /* ---------------- Misc ---------------- */
358 
359 #define VKI_PTRACE_TRACEME 0  /* nb: is really PT_TRACE_ME */
360 #define VKI_PTRACE_DETACH 31  /* nb: is really PT_DETACH */
361 
362 
363 //--------------------------------------------------------------
364 // BOGUS
365 //--------------------------------------------------------------
366 
367 struct vki_dirent {
368   int bogus;
369 };
370 
371 struct vki_sockaddr {
372   int bogus;
373 };
374 
375 struct vki_pollfd {
376   int bogus;
377 };
378 
379 /* Structure describing an Internet (IP) socket address. */
380 //struct vki_sockaddr_in {
381 //  int bogus;
382 //};
383 
384 struct vki_ucontext {
385   int bogus;
386 };
387 
388 
389 //--------------------------------------------------------------
390 // FROM glibc-ports-2.4/sysdeps/unix/sysv/aix/dlldr.h
391 //--------------------------------------------------------------
392 
393 /* Copyright (C) 2001 Free Software Foundation, Inc.
394    This file is part of the GNU C Library.
395 
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.
400 
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.
405 
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
409    02111-1307 USA.  */
410 
411 
412 /*
413 
414  int __loadx(flag, module, arg1, arg2, arg3)
415 
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.
419 
420  void *ld_loadutil() call is a utility function used for loader extensions
421  supporting run-time linking and dl*() functions.
422 
423  void *   - will return the modules entry point if it succeds of NULL
424                 on failure.
425 
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
429             reserved.
430 
431 */
432 
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) */
447 
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
458 
459 
460 #endif // __VKI_PPC64_AIX5_H
461 
462 /*--------------------------------------------------------------------*/
463 /*--- end                                                          ---*/
464 /*--------------------------------------------------------------------*/
465