valgrind-monitor.py regular expressions should use raw strings
[valgrind.git] / include / vki / vki-ppc64-linux.h
blob04f72048aa489d39fd245b3248beaaa33b050d30
2 /*--------------------------------------------------------------------*/
3 /*--- PPC64/Linux-specific kernel interface. vki-ppc64-linux.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2005-2017 Julian Seward
11 jseward@acm.org
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, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __VKI_PPC64_LINUX_H
30 #define __VKI_PPC64_LINUX_H
32 #if defined(VGP_ppc32_linux) || defined(VGP_ppc64be_linux)
33 #define VKI_BIG_ENDIAN 1
34 #elif defined(VGP_ppc64le_linux)
35 #define VKI_LITTLE_ENDIAN 1
36 #endif
37 //----------------------------------------------------------------------
38 // From linux-2.6.13/include/asm-ppc64/types.h
39 //----------------------------------------------------------------------
41 typedef __signed__ char __vki_s8;
42 typedef unsigned char __vki_u8;
44 typedef __signed__ short __vki_s16;
45 typedef unsigned short __vki_u16;
47 typedef __signed__ int __vki_s32;
48 typedef unsigned int __vki_u32;
50 typedef __signed__ long __vki_s64;
51 typedef unsigned long __vki_u64;
53 typedef struct {
54 __vki_u32 u[4];
55 } __attribute((aligned(16))) __vki_vector128;
57 typedef unsigned short vki_u16;
59 typedef unsigned int vki_u32;
61 //----------------------------------------------------------------------
62 // From linux-2.6.13/include/asm-ppc64/page.h
63 //----------------------------------------------------------------------
65 /* PAGE_SHIFT determines the page size, unfortunately
66 page size might vary between 32-bit and 64-bit ppc kernels */
67 extern UWord VKI_PAGE_SHIFT;
68 extern UWord VKI_PAGE_SIZE;
69 #define VKI_MAX_PAGE_SHIFT 16
70 #define VKI_MAX_PAGE_SIZE (1UL << VKI_MAX_PAGE_SHIFT)
72 //----------------------------------------------------------------------
73 // From linux-2.6.35.4/arch/powerpc/include/asm/shmparam.h
74 //----------------------------------------------------------------------
76 #define VKI_SHMLBA VKI_PAGE_SIZE
78 //----------------------------------------------------------------------
79 // From linux-2.6.13/include/asm-ppc64/signal.h
80 //----------------------------------------------------------------------
82 #define VKI_MINSIGSTKSZ 2048
84 /* Next 9 non-blank lines asm-generic/signal.h */
85 #define VKI_SIG_BLOCK 0 /* for blocking signals */
86 #define VKI_SIG_UNBLOCK 1 /* for unblocking signals */
87 #define VKI_SIG_SETMASK 2 /* for setting the signal mask */
89 typedef void __vki_signalfn_t(int);
90 typedef __vki_signalfn_t __user *__vki_sighandler_t;
92 typedef void __vki_restorefn_t(void);
93 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
95 #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */
96 #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */
98 /* Back in asm-ppc64/signal.h */
99 #define _VKI_NSIG 64
100 #define _VKI_NSIG_BPW 64
101 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
103 typedef unsigned long vki_old_sigset_t; /* at least 32 bits */
105 typedef struct {
106 unsigned long sig[_VKI_NSIG_WORDS];
107 } vki_sigset_t;
109 #define VKI_SIGHUP 1
110 #define VKI_SIGINT 2
111 #define VKI_SIGQUIT 3
112 #define VKI_SIGILL 4
113 #define VKI_SIGTRAP 5
114 #define VKI_SIGABRT 6
115 #define VKI_SIGIOT 6
116 #define VKI_SIGBUS 7
117 #define VKI_SIGFPE 8
118 #define VKI_SIGKILL 9
119 #define VKI_SIGUSR1 10
120 #define VKI_SIGSEGV 11
121 #define VKI_SIGUSR2 12
122 #define VKI_SIGPIPE 13
123 #define VKI_SIGALRM 14
124 #define VKI_SIGTERM 15
125 #define VKI_SIGSTKFLT 16
126 #define VKI_SIGCHLD 17
127 #define VKI_SIGCONT 18
128 #define VKI_SIGSTOP 19
129 #define VKI_SIGTSTP 20
130 #define VKI_SIGTTIN 21
131 #define VKI_SIGTTOU 22
132 #define VKI_SIGURG 23
133 #define VKI_SIGXCPU 24
134 #define VKI_SIGXFSZ 25
135 #define VKI_SIGVTALRM 26
136 #define VKI_SIGPROF 27
137 #define VKI_SIGWINCH 28
138 #define VKI_SIGIO 29
139 #define VKI_SIGPOLL VKI_SIGIO
140 #define VKI_SIGPWR 30
141 #define VKI_SIGSYS 31
142 #define VKI_SIGUNUSED 31
144 /* These should not be considered constants from userland. */
145 #define VKI_SIGRTMIN 32
146 #define VKI_SIGRTMAX _VKI_NSIG
148 #define VKI_SA_NOCLDSTOP 0x00000001u
149 #define VKI_SA_NOCLDWAIT 0x00000002u
150 #define VKI_SA_SIGINFO 0x00000004u
151 #define VKI_SA_ONSTACK 0x08000000u
152 #define VKI_SA_RESTART 0x10000000u
153 #define VKI_SA_NODEFER 0x40000000u
154 #define VKI_SA_RESETHAND 0x80000000u
156 #define VKI_SA_NOMASK VKI_SA_NODEFER
157 #define VKI_SA_ONESHOT VKI_SA_RESETHAND
158 //#define VKI_SA_INTERRUPT 0x20000000u /* dummy -- ignored */
160 #define VKI_SA_RESTORER 0x04000000u
162 #define VKI_SS_ONSTACK 1
163 #define VKI_SS_DISABLE 2
165 // See comments on corresponding decls in vki-x86-linux.h re ksa_handler
166 struct vki_old_sigaction {
167 __vki_sighandler_t ksa_handler;
168 vki_old_sigset_t sa_mask;
169 unsigned long sa_flags;
170 __vki_sigrestore_t sa_restorer;
173 struct vki_sigaction_base {
174 __vki_sighandler_t ksa_handler;
175 unsigned long sa_flags;
176 __vki_sigrestore_t sa_restorer;
177 vki_sigset_t sa_mask; /* mask last for extensibility */
180 /* On Linux we use the same type for passing sigactions to
181 and from the kernel. Hence: */
182 typedef struct vki_sigaction_base vki_sigaction_toK_t;
183 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
186 typedef struct vki_sigaltstack {
187 void __user *ss_sp;
188 int ss_flags;
189 vki_size_t ss_size;
190 } vki_stack_t;
192 //----------------------------------------------------------------------
193 // From linux-2.6.13/include/asm-ppc64/ptrace.h
194 //----------------------------------------------------------------------
196 #define VKI_PPC_REG unsigned long
197 struct vki_pt_regs {
198 VKI_PPC_REG gpr[32];
199 VKI_PPC_REG nip;
200 VKI_PPC_REG msr;
201 VKI_PPC_REG orig_gpr3; /* Used for restarting system calls */
202 VKI_PPC_REG ctr;
203 VKI_PPC_REG link;
204 VKI_PPC_REG xer;
205 VKI_PPC_REG ccr;
206 VKI_PPC_REG softe; /* Soft enabled/disabled */
207 VKI_PPC_REG trap; /* Reason for being here */
208 VKI_PPC_REG dar; /* Fault registers */
209 VKI_PPC_REG dsisr;
210 VKI_PPC_REG result; /* Result of a system call */
212 /* Not in kernel's definition, but apparently needed to stop
213 assertion at coredump-elf.c:267 firing. These padding words make
214 the struct have the same size as a 'vki_elf_greg_t'. See message
215 from Ghassan Hammouri on valgrind-developers on 6 April 06, and
216 also the analogous kludge for ppc32-linux (svn r5852 and bug
217 #121617). */
218 unsigned long pad[4];
221 /* Kludge? I don't know where this came from or if it is right. */
222 #define vki_user_regs_struct vki_pt_regs
224 #define VKI_PT_R0 0
225 #define VKI_PT_R1 1
226 #define VKI_PT_R2 2
227 #define VKI_PT_R3 3
228 #define VKI_PT_R4 4
229 #define VKI_PT_R5 5
230 #define VKI_PT_R6 6
231 #define VKI_PT_R7 7
232 #define VKI_PT_R8 8
233 #define VKI_PT_R9 9
234 #define VKI_PT_R10 10
235 #define VKI_PT_R11 11
236 #define VKI_PT_R12 12
237 #define VKI_PT_R13 13
238 #define VKI_PT_R14 14
239 #define VKI_PT_R15 15
240 #define VKI_PT_R16 16
241 #define VKI_PT_R17 17
242 #define VKI_PT_R18 18
243 #define VKI_PT_R19 19
244 #define VKI_PT_R20 20
245 #define VKI_PT_R21 21
246 #define VKI_PT_R22 22
247 #define VKI_PT_R23 23
248 #define VKI_PT_R24 24
249 #define VKI_PT_R25 25
250 #define VKI_PT_R26 26
251 #define VKI_PT_R27 27
252 #define VKI_PT_R28 28
253 #define VKI_PT_R29 29
254 #define VKI_PT_R30 30
255 #define VKI_PT_R31 31
256 #define VKI_PT_NIP 32
257 #define VKI_PT_MSR 33
258 #define VKI_PT_ORIG_R3 34
259 #define VKI_PT_CTR 35
260 #define VKI_PT_LNK 36
261 #define VKI_PT_XER 37
262 #define VKI_PT_CCR 38
263 #define VKI_PT_SOFTE 39
264 #define VKI_PT_RESULT 43
266 //----------------------------------------------------------------------
267 // From linux-2.6.13/include/asm-ppc64/elf.h
268 //----------------------------------------------------------------------
270 #define VKI_ELF_NGREG 48 /* includes nip, msr, lr, etc. */
271 #define VKI_ELF_NFPREG 33 /* includes fpscr */
272 #define VKI_ELF_NVRREG 34 /* includes vscr & vrsave in split vectors */
274 typedef unsigned long vki_elf_greg_t64;
275 typedef vki_elf_greg_t64 vki_elf_gregset_t64[VKI_ELF_NGREG];
277 typedef vki_elf_gregset_t64 vki_elf_gregset_t;
279 typedef double vki_elf_fpreg_t;
280 typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
282 /* Altivec registers */
284 * The entries with indexes 0-31 contain the corresponding vector registers.
285 * The entry with index 32 contains the vscr as the last word (offset 12)
286 * within the quadword. This allows the vscr to be stored as either a
287 * quadword (since it must be copied via a vector register to/from storage)
288 * or as a word. The entry with index 33 contains the vrsave as the first
289 * word (offset 0) within the quadword.
291 * This definition of the VMX state is compatible with the current PPC32
292 * ptrace interface. This allows signal handling and ptrace to use the same
293 * structures. This also simplifies the implementation of a bi-arch
294 * (combined (32- and 64-bit) gdb.
296 * Note that it's _not_ compatible with 32 bits ucontext which stuffs the
297 * vrsave along with vscr and so only uses 33 vectors for the register set
299 typedef __vki_vector128 vki_elf_vrreg_t;
300 typedef vki_elf_vrreg_t vki_elf_vrregset_t[VKI_ELF_NVRREG];
302 //----------------------------------------------------------------------
303 // From linux-2.6.13/include/asm-ppc64/sigcontext.h
304 //----------------------------------------------------------------------
306 struct vki_sigcontext {
307 unsigned long _unused[4];
308 int signal;
309 int _pad0;
310 unsigned long handler;
311 unsigned long oldmask;
312 struct vki_pt_regs __user *regs;
313 vki_elf_gregset_t gp_regs;
314 vki_elf_fpregset_t fp_regs;
316 * To maintain compatibility with current implementations the sigcontext is
317 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
318 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This
319 * allows the array of vector registers to be quadword aligned independent of
320 * the alignment of the containing sigcontext or ucontext. It is the
321 * responsibility of the code setting the sigcontext to set this pointer to
322 * either NULL (if this processor does not support the VMX feature) or the
323 * address of the first quadword within the allocated (vmx_reserve) area.
325 * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with
326 * an array of 34 quadword entries (elf_vrregset_t). The entries with
327 * indexes 0-31 contain the corresponding vector registers. The entry with
328 * index 32 contains the vscr as the last word (offset 12) within the
329 * quadword. This allows the vscr to be stored as either a quadword (since
330 * it must be copied via a vector register to/from storage) or as a word.
331 * The entry with index 33 contains the vrsave as the first word (offset 0)
332 * within the quadword.
334 vki_elf_vrreg_t __user *v_regs;
335 long vmx_reserve[VKI_ELF_NVRREG+VKI_ELF_NVRREG+1];
338 //----------------------------------------------------------------------
339 // From linux-5.0.0/arch/powerpc/include/uapi/asm/siginfo.h
340 //----------------------------------------------------------------------
342 #ifdef __powerpc64__
343 # define __VKI_ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
344 #endif
346 //----------------------------------------------------------------------
347 // From linux-2.6.13/include/asm-ppc64/mman.h
348 //----------------------------------------------------------------------
350 #define VKI_PROT_NONE 0x0 /* page can not be accessed */
351 #define VKI_PROT_READ 0x1 /* page can be read */
352 #define VKI_PROT_WRITE 0x2 /* page can be written */
353 #define VKI_PROT_EXEC 0x4 /* page can be executed */
354 #define VKI_PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend
355 change to start of
356 growsdown vma */
357 #define VKI_PROT_GROWSUP 0x02000000 /* mprotect flag: extend
358 change to end of
359 growsup vma */
361 #define VKI_MAP_SHARED 0x01 /* Share changes */
362 #define VKI_MAP_PRIVATE 0x02 /* Changes are private */
363 #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */
364 #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */
365 #define VKI_MAP_NORESERVE 0x40 /* don't reserve swap pages */
367 //----------------------------------------------------------------------
368 // From linux-2.6.13/include/asm-ppc64/fcntl.h
369 //----------------------------------------------------------------------
371 #define VKI_O_ACCMODE 03
372 #define VKI_O_RDONLY 00
373 #define VKI_O_WRONLY 01
374 #define VKI_O_RDWR 02
375 #define VKI_O_CREAT 0100 /* not fcntl */
376 #define VKI_O_EXCL 0200 /* not fcntl */
377 #define VKI_O_TRUNC 01000 /* not fcntl */
378 #define VKI_O_APPEND 02000
379 #define VKI_O_NONBLOCK 04000
380 #define VKI_O_LARGEFILE 0200000
382 #define VKI_AT_FDCWD -100
384 #define VKI_F_DUPFD 0 /* dup */
385 #define VKI_F_GETFD 1 /* get close_on_exec */
386 #define VKI_F_SETFD 2 /* set/clear close_on_exec */
387 #define VKI_F_GETFL 3 /* get file->f_flags */
388 #define VKI_F_SETFL 4 /* set file->f_flags */
389 #define VKI_F_GETLK 5
390 #define VKI_F_SETLK 6
391 #define VKI_F_SETLKW 7
393 #define VKI_F_SETOWN 8 /* for sockets. */
394 #define VKI_F_GETOWN 9 /* for sockets. */
395 #define VKI_F_SETSIG 10 /* for sockets. */
396 #define VKI_F_GETSIG 11 /* for sockets. */
398 #define VKI_F_SETOWN_EX 15
399 #define VKI_F_GETOWN_EX 16
401 #define VKI_F_OFD_GETLK 36
402 #define VKI_F_OFD_SETLK 37
403 #define VKI_F_OFD_SETLKW 38
405 #define VKI_F_OWNER_TID 0
406 #define VKI_F_OWNER_PID 1
407 #define VKI_F_OWNER_PGRP 2
409 struct vki_f_owner_ex {
410 int type;
411 __vki_kernel_pid_t pid;
414 /* for F_[GET|SET]FL */
415 #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */
417 #define VKI_F_LINUX_SPECIFIC_BASE 1024
419 //----------------------------------------------------------------------
420 // From linux-2.6.13/include/asm-ppc64/resource.h
421 //----------------------------------------------------------------------
423 // which just does #include <asm-generic/resource.h>
425 #define VKI_RLIMIT_DATA 2 /* max data size */
426 #define VKI_RLIMIT_STACK 3 /* max stack size */
427 #define VKI_RLIMIT_CORE 4 /* max core file size */
428 #define VKI_RLIMIT_NOFILE 7 /* max number of open files */
430 //----------------------------------------------------------------------
431 // From linux-2.6.13/include/asm-ppc64/socket.h
432 //----------------------------------------------------------------------
434 #define VKI_SOL_SOCKET 1
436 #define VKI_SO_TYPE 3
438 #define VKI_SO_ATTACH_FILTER 26
440 //----------------------------------------------------------------------
441 // From linux-2.6.13/include/asm-ppc64/sockios.h
442 //----------------------------------------------------------------------
444 #define VKI_SIOCSPGRP 0x8902
445 #define VKI_SIOCGPGRP 0x8904
446 #define VKI_SIOCATMARK 0x8905
447 #define VKI_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
448 #define VKI_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
450 //----------------------------------------------------------------------
451 // From linux-2.6.13/include/asm-ppc64/stat.h
452 //----------------------------------------------------------------------
454 struct vki_stat {
455 unsigned long st_dev;
456 unsigned long st_ino;
457 unsigned long st_nlink;
458 unsigned int st_mode;
459 unsigned int st_uid;
460 unsigned int st_gid;
461 unsigned long st_rdev;
462 long st_size;
463 unsigned long st_blksize;
464 unsigned long st_blocks;
465 unsigned long st_atime;
466 unsigned long st_atime_nsec;
467 unsigned long st_mtime;
468 unsigned long st_mtime_nsec;
469 unsigned long st_ctime;
470 unsigned long st_ctime_nsec;
471 unsigned long __unused4;
472 unsigned long __unused5;
473 unsigned long __unused6;
476 #define VKI_STAT_HAVE_NSEC 1
478 /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
479 struct vki_stat64 {
480 unsigned long st_dev; /* Device. */
481 unsigned long st_ino; /* File serial number. */
482 unsigned int st_mode; /* File mode. */
483 unsigned int st_nlink; /* Link count. */
484 unsigned int st_uid; /* User ID of the file's owner. */
485 unsigned int st_gid; /* Group ID of the file's group. */
486 unsigned long st_rdev; /* Device number, if device. */
487 unsigned short __pad2;
488 long st_size; /* Size of file, in bytes. */
489 int st_blksize; /* Optimal block size for I/O. */
491 long st_blocks; /* Number 512-byte blocks allocated. */
492 int st_atime; /* Time of last access. */
493 int st_atime_nsec;
494 int st_mtime; /* Time of last modification. */
495 int st_mtime_nsec;
496 int st_ctime; /* Time of last status change. */
497 int st_ctime_nsec;
498 unsigned int __unused4;
499 unsigned int __unused5;
502 //----------------------------------------------------------------------
503 // From linux-2.6.13/include/asm-ppc64/statfs.h
504 //----------------------------------------------------------------------
506 struct vki_statfs {
507 long f_type;
508 long f_bsize;
509 long f_blocks;
510 long f_bfree;
511 long f_bavail;
512 long f_files;
513 long f_ffree;
514 __vki_kernel_fsid_t f_fsid;
515 long f_namelen;
516 long f_frsize;
517 long f_spare[5];
520 //----------------------------------------------------------------------
521 // From linux-2.6.13/include/asm-ppc64/termios.h
522 //----------------------------------------------------------------------
524 struct vki_winsize {
525 unsigned short ws_row;
526 unsigned short ws_col;
527 unsigned short ws_xpixel;
528 unsigned short ws_ypixel;
531 #define VKI_NCC 10
532 struct vki_termio {
533 unsigned short c_iflag; /* input mode flags */
534 unsigned short c_oflag; /* output mode flags */
535 unsigned short c_cflag; /* control mode flags */
536 unsigned short c_lflag; /* local mode flags */
537 unsigned char c_line; /* line discipline */
538 unsigned char c_cc[VKI_NCC]; /* control characters */
541 //----------------------------------------------------------------------
542 // From linux-2.6.13/include/asm-ppc64/termbits.h
543 //----------------------------------------------------------------------
545 typedef unsigned char vki_cc_t;
546 typedef unsigned int vki_speed_t;
547 typedef unsigned int vki_tcflag_t;
549 #define VKI_NCCS 19
550 struct vki_termios {
551 vki_tcflag_t c_iflag; /* input mode flags */
552 vki_tcflag_t c_oflag; /* output mode flags */
553 vki_tcflag_t c_cflag; /* control mode flags */
554 vki_tcflag_t c_lflag; /* local mode flags */
555 vki_cc_t c_cc[VKI_NCCS]; /* control characters */
556 vki_cc_t c_line; /* line discipline (== c_cc[19]) */
557 vki_speed_t c_ispeed; /* input speed */
558 vki_speed_t c_ospeed; /* output speed */
561 //----------------------------------------------------------------------
562 // From linux-2.6.13/include/asm-ppc64/ioctl.h
563 //----------------------------------------------------------------------
565 #define _VKI_IOC_NRBITS 8
566 #define _VKI_IOC_TYPEBITS 8
567 #define _VKI_IOC_SIZEBITS 13
568 #define _VKI_IOC_DIRBITS 3
570 #define _VKI_IOC_NRMASK ((1 << _VKI_IOC_NRBITS)-1)
571 #define _VKI_IOC_TYPEMASK ((1 << _VKI_IOC_TYPEBITS)-1)
572 #define _VKI_IOC_SIZEMASK ((1 << _VKI_IOC_SIZEBITS)-1)
573 #define _VKI_IOC_DIRMASK ((1 << _VKI_IOC_DIRBITS)-1)
575 #define _VKI_IOC_NRSHIFT 0
576 #define _VKI_IOC_TYPESHIFT (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
577 #define _VKI_IOC_SIZESHIFT (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
578 #define _VKI_IOC_DIRSHIFT (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
581 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
582 * And this turns out useful to catch old ioctl numbers in header
583 * files for us.
585 #define _VKI_IOC_NONE 1U
586 #define _VKI_IOC_READ 2U
587 #define _VKI_IOC_WRITE 4U
589 #define _VKI_IOC(dir,type,nr,size) \
590 (((dir) << _VKI_IOC_DIRSHIFT) | \
591 ((type) << _VKI_IOC_TYPESHIFT) | \
592 ((nr) << _VKI_IOC_NRSHIFT) | \
593 ((size) << _VKI_IOC_SIZESHIFT))
595 /* used to create numbers */
596 #define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
597 #define _VKI_IOR(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr), \
598 (_VKI_IOC_TYPECHECK(size)))
599 #define _VKI_IOW(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr), \
600 (_VKI_IOC_TYPECHECK(size)))
601 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE, \
602 (type),(nr),(_VKI_IOC_TYPECHECK(size)))
603 #define _VKI_IOR_BAD(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr), \
604 sizeof(size))
605 #define _VKI_IOW_BAD(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr), \
606 sizeof(size))
607 #define _VKI_IOWR_BAD(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE, \
608 (type),(nr),sizeof(size))
610 /* used to decode them.. */
611 #define _VKI_IOC_DIR(nr) (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
612 #define _VKI_IOC_TYPE(nr) (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
613 #define _VKI_IOC_NR(nr) (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
614 #define _VKI_IOC_SIZE(nr) (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
616 //----------------------------------------------------------------------
617 // From linux-2.6.13/include/asm-ppc64/ioctls.h
618 //----------------------------------------------------------------------
620 #define VKI_FIOCLEX _VKI_IO('f', 1)
621 #define VKI_FIONCLEX _VKI_IO('f', 2)
623 #define VKI_TCGETS _VKI_IOR('t', 19, struct vki_termios)
624 #define VKI_TCSETS _VKI_IOW('t', 20, struct vki_termios)
625 #define VKI_TCSETSW _VKI_IOW('t', 21, struct vki_termios)
626 #define VKI_TCSETSF _VKI_IOW('t', 22, struct vki_termios)
627 #define VKI_TCGETA _VKI_IOR('t', 23, struct vki_termio)
628 #define VKI_TCSETA _VKI_IOW('t', 24, struct vki_termio)
629 #define VKI_TCSETAW _VKI_IOW('t', 25, struct vki_termio)
630 #define VKI_TCSETAF _VKI_IOW('t', 28, struct vki_termio)
631 #define VKI_TCSBRK _VKI_IO('t', 29)
632 #define VKI_TCXONC _VKI_IO('t', 30)
633 #define VKI_TCFLSH _VKI_IO('t', 31)
634 #define VKI_TIOCSCTTY 0x540E
635 #define VKI_TIOCGPGRP _VKI_IOR('t', 119, int)
636 #define VKI_TIOCSPGRP _VKI_IOW('t', 118, int)
637 #define VKI_TIOCOUTQ _VKI_IOR('t', 115, int) /* output queue size */
638 #define VKI_TIOCGWINSZ _VKI_IOR('t', 104, struct vki_winsize)
639 #define VKI_TIOCSWINSZ _VKI_IOW('t', 103, struct vki_winsize)
640 #define VKI_TIOCMGET 0x5415
641 #define VKI_TIOCMBIS 0x5416
642 #define VKI_TIOCMBIC 0x5417
643 #define VKI_TIOCMSET 0x5418
644 #define VKI_FIONREAD _VKI_IOR('f', 127, int)
645 #define VKI_TIOCLINUX 0x541C
646 #define VKI_FIONBIO _VKI_IOW('f', 126, int)
647 #define VKI_TIOCNOTTY 0x5422
648 #define VKI_TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
649 #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int)
650 /* Get Pty Number (of pty-mux device) */
651 #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int) /* Lock/unlock Pty */
652 #define VKI_FIOASYNC _VKI_IOW('f', 125, int)
653 #define VKI_TIOCSERGETLSR 0x5459 /* Get line status register */
654 #define VKI_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
655 #define VKI_FIOQSIZE _VKI_IOR('f', 128, vki_loff_t)
657 //----------------------------------------------------------------------
658 // From linux-2.6.13/include/asm-ppc64/poll.h
659 //----------------------------------------------------------------------
661 #define VKI_POLLIN 0x0001
663 struct vki_pollfd {
664 int fd;
665 short events;
666 short revents;
669 //----------------------------------------------------------------------
670 // From linux-2.6.13/include/asm-ppc64/user.h
671 //----------------------------------------------------------------------
673 // Not sure what's needed from here
675 //----------------------------------------------------------------------
676 // From linux-2.6.13/include/asm-ppc64/elf.h
677 //----------------------------------------------------------------------
679 // Not sure what's needed from here
681 //----------------------------------------------------------------------
682 // From linux-2.6.13/include/asm-ppc64/ucontext.h
683 //----------------------------------------------------------------------
685 struct vki_ucontext {
686 unsigned long uc_flags;
687 struct vki_ucontext *uc_link;
688 vki_stack_t uc_stack;
689 vki_sigset_t uc_sigmask;
690 vki_sigset_t __unused0[15]; /* Allow for uc_sigmask growth */
691 struct vki_sigcontext uc_mcontext; /* last for extensibility */
694 // CAB: TODO
695 typedef char vki_modify_ldt_t;
697 //----------------------------------------------------------------------
698 // From linux-2.6.13/include/asm-ppc64/ipcbuf.h
699 //----------------------------------------------------------------------
701 struct vki_ipc64_perm
703 __vki_kernel_key_t key;
704 __vki_kernel_uid_t uid;
705 __vki_kernel_gid_t gid;
706 __vki_kernel_uid_t cuid;
707 __vki_kernel_gid_t cgid;
708 __vki_kernel_mode_t mode;
709 unsigned int seq;
710 unsigned int __pad1;
711 unsigned long __unused1;
712 unsigned long __unused2;
715 //----------------------------------------------------------------------
716 // From linux-2.6.13/include/asm-ppc64/sembuf.h
717 //----------------------------------------------------------------------
719 struct vki_semid64_ds {
720 struct vki_ipc64_perm sem_perm; /* permissions .. see ipc.h */
721 __vki_kernel_time_t sem_otime; /* last semop time */
722 __vki_kernel_time_t sem_ctime; /* last change time */
723 unsigned long sem_nsems; /* no. of semaphores in array */
724 unsigned long __unused1;
725 unsigned long __unused2;
728 //----------------------------------------------------------------------
729 // From linux-2.6.13/include/asm-ppc64/msgbuf.h
730 //----------------------------------------------------------------------
732 struct vki_msqid64_ds {
733 struct vki_ipc64_perm msg_perm;
734 __vki_kernel_time_t msg_stime; /* last msgsnd time */
735 __vki_kernel_time_t msg_rtime; /* last msgrcv time */
736 __vki_kernel_time_t msg_ctime; /* last change time */
737 unsigned long msg_cbytes; /* current number of bytes on queue */
738 unsigned long msg_qnum; /* number of messages in queue */
739 unsigned long msg_qbytes; /* max number of bytes on queue */
740 __vki_kernel_pid_t msg_lspid; /* pid of last msgsnd */
741 __vki_kernel_pid_t msg_lrpid; /* last receive pid */
742 unsigned long __unused1;
743 unsigned long __unused2;
746 //----------------------------------------------------------------------
747 // From linux-2.6.13/include/asm-ppc64/ipc.h
748 //----------------------------------------------------------------------
750 // this just does #include <asm-generic/ipc.h>
752 struct vki_ipc_kludge {
753 struct vki_msgbuf __user *msgp;
754 long msgtyp;
757 #define VKI_SEMOP 1
758 #define VKI_SEMGET 2
759 #define VKI_SEMCTL 3
760 #define VKI_SEMTIMEDOP 4
761 #define VKI_MSGSND 11
762 #define VKI_MSGRCV 12
763 #define VKI_MSGGET 13
764 #define VKI_MSGCTL 14
765 #define VKI_SHMAT 21
766 #define VKI_SHMDT 22
767 #define VKI_SHMGET 23
768 #define VKI_SHMCTL 24
770 //----------------------------------------------------------------------
771 // From linux-2.6.13/include/asm-ppc64/shmbuf.h
772 //----------------------------------------------------------------------
774 struct vki_shmid64_ds {
775 struct vki_ipc64_perm shm_perm; /* operation perms */
776 __vki_kernel_time_t shm_atime; /* last attach time */
777 __vki_kernel_time_t shm_dtime; /* last detach time */
778 __vki_kernel_time_t shm_ctime; /* last change time */
779 vki_size_t shm_segsz; /* size of segment (bytes) */
780 __vki_kernel_pid_t shm_cpid; /* pid of creator */
781 __vki_kernel_pid_t shm_lpid; /* pid of last operator */
782 unsigned long shm_nattch; /* no. of current attaches */
783 unsigned long __unused1;
784 unsigned long __unused2;
787 struct vki_shminfo64 {
788 unsigned long shmmax;
789 unsigned long shmmin;
790 unsigned long shmmni;
791 unsigned long shmseg;
792 unsigned long shmall;
793 unsigned long __unused1;
794 unsigned long __unused2;
795 unsigned long __unused3;
796 unsigned long __unused4;
799 //----------------------------------------------------------------------
800 // From linux-2.6.8.1/include/asm-generic/errno.h
801 //----------------------------------------------------------------------
803 #define VKI_ENOSYS 38 /* Function not implemented */
804 #define VKI_EOVERFLOW 75 /* Value too large for defined data type */
806 //----------------------------------------------------------------------
807 // From linux-3.19.0/arch/powerpc/include/uapi/asm/ioctls.h
808 //----------------------------------------------------------------------
810 #define VKI_TIOCGSERIAL 0x541E
811 #define VKI_TIOCSSERIAL 0x541F
813 //----------------------------------------------------------------------
814 // end
815 //----------------------------------------------------------------------
817 #endif // __VKI_PPC64_LINUX_H
819 /*--------------------------------------------------------------------*/
820 /*--- end ---*/
821 /*--------------------------------------------------------------------*/