Fix "make post-regtest-checks" after 441bfc5f51c7f5f80cc6491d23cbe2dc711d191f (dhat...
[valgrind.git] / include / vki / vki-ppc32-linux.h
blob0582e43d41a3a09b21792117ac73ea325459539f
2 /*--------------------------------------------------------------------*/
3 /*--- PPC32/Linux-specific kernel interface. vki-ppc32-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, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26 02111-1307, USA.
28 The GNU General Public License is contained in the file COPYING.
31 #ifndef __VKI_PPC32_LINUX_H
32 #define __VKI_PPC32_LINUX_H
34 // ppc32 is big-endian.
35 #define VKI_BIG_ENDIAN 1
37 //----------------------------------------------------------------------
38 // From linux-2.6.9/include/asm-ppc/types.h
39 //----------------------------------------------------------------------
41 typedef unsigned char __vki_u8;
43 typedef __signed__ short __vki_s16;
44 typedef unsigned short __vki_u16;
46 typedef __signed__ int __vki_s32;
47 typedef unsigned int __vki_u32;
49 typedef __signed__ long long __vki_s64;
50 typedef unsigned long long __vki_u64;
52 typedef unsigned short vki_u16;
54 typedef unsigned int vki_u32;
56 typedef struct {
57 __vki_u32 u[4];
58 } __vki_vector128;
60 //----------------------------------------------------------------------
61 // From linux-2.6.9/include/asm-ppc/page.h
62 //----------------------------------------------------------------------
64 /* PAGE_SHIFT determines the page size, unfortunately
65 page size might vary between 32-bit and 64-bit ppc kernels */
66 extern UWord VKI_PAGE_SHIFT;
67 extern UWord VKI_PAGE_SIZE;
68 #define VKI_MAX_PAGE_SHIFT 16
69 #define VKI_MAX_PAGE_SIZE (1UL << VKI_MAX_PAGE_SHIFT)
71 //----------------------------------------------------------------------
72 // From linux-2.6.35.4/arch/powerpc/include/asm/shmparam.h
73 //----------------------------------------------------------------------
75 #define VKI_SHMLBA VKI_PAGE_SIZE
77 //----------------------------------------------------------------------
78 // From linux-2.6.9/include/asm-ppc/signal.h
79 //----------------------------------------------------------------------
81 #define VKI_MINSIGSTKSZ 2048
83 #define VKI_SIG_BLOCK 0 /* for blocking signals */
84 #define VKI_SIG_UNBLOCK 1 /* for unblocking signals */
85 #define VKI_SIG_SETMASK 2 /* for setting the signal mask */
87 /* Type of a signal handler. */
88 typedef void __vki_signalfn_t(int);
89 typedef __vki_signalfn_t __user *__vki_sighandler_t;
91 typedef void __vki_restorefn_t(void);
92 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
94 #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */
95 #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */
97 #define _VKI_NSIG 64
98 #define _VKI_NSIG_BPW 32
99 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
101 typedef unsigned long vki_old_sigset_t; /* at least 32 bits */
103 typedef struct {
104 unsigned long sig[_VKI_NSIG_WORDS];
105 } vki_sigset_t;
107 #define VKI_SIGHUP 1
108 #define VKI_SIGINT 2
109 #define VKI_SIGQUIT 3
110 #define VKI_SIGILL 4
111 #define VKI_SIGTRAP 5
112 #define VKI_SIGABRT 6
113 //#define VKI_SIGIOT 6
114 #define VKI_SIGBUS 7
115 #define VKI_SIGFPE 8
116 #define VKI_SIGKILL 9
117 #define VKI_SIGUSR1 10
118 #define VKI_SIGSEGV 11
119 #define VKI_SIGUSR2 12
120 #define VKI_SIGPIPE 13
121 #define VKI_SIGALRM 14
122 #define VKI_SIGTERM 15
123 #define VKI_SIGSTKFLT 16
124 #define VKI_SIGCHLD 17
125 #define VKI_SIGCONT 18
126 #define VKI_SIGSTOP 19
127 #define VKI_SIGTSTP 20
128 #define VKI_SIGTTIN 21
129 #define VKI_SIGTTOU 22
130 #define VKI_SIGURG 23
131 #define VKI_SIGXCPU 24
132 #define VKI_SIGXFSZ 25
133 #define VKI_SIGVTALRM 26
134 #define VKI_SIGPROF 27
135 #define VKI_SIGWINCH 28
136 #define VKI_SIGIO 29
137 #define VKI_SIGPWR 30
138 #define VKI_SIGSYS 31
139 #define VKI_SIGUNUSED 31
141 /* These should not be considered constants from userland. */
142 #define VKI_SIGRTMIN 32
143 // [[This was (_NSIG-1) in 2.4.X... not sure if it matters.]]
144 #define VKI_SIGRTMAX _VKI_NSIG
146 #define VKI_SA_NOCLDSTOP 0x00000001
147 #define VKI_SA_NOCLDWAIT 0x00000002
148 #define VKI_SA_SIGINFO 0x00000004
149 #define VKI_SA_ONSTACK 0x08000000
150 #define VKI_SA_RESTART 0x10000000
151 #define VKI_SA_NODEFER 0x40000000
152 #define VKI_SA_RESETHAND 0x80000000
154 #define VKI_SA_NOMASK VKI_SA_NODEFER
155 #define VKI_SA_ONESHOT VKI_SA_RESETHAND
156 //#define VKI_SA_INTERRUPT 0x20000000 /* dummy -- ignored */
158 #define VKI_SA_RESTORER 0x04000000
160 #define VKI_SS_ONSTACK 1
161 #define VKI_SS_DISABLE 2
163 /* These are 'legacy' sigactions in which the size of sa_mask is fixed
164 (cannot be expanded at any future point) because it is sandwiched
165 between two other fields.
166 (there is identical kludgery in vki-x86-linux.h) */
167 struct vki_old_sigaction {
168 // [[Nb: a 'k' prefix is added to "sa_handler" because
169 // bits/sigaction.h (which gets dragged in somehow via signal.h)
170 // #defines it as something else. Since that is done for glibc's
171 // purposes, which we don't care about here, we use our own name.]]
172 __vki_sighandler_t ksa_handler;
173 vki_old_sigset_t sa_mask;
174 unsigned long sa_flags;
175 __vki_sigrestore_t sa_restorer;
178 struct vki_sigaction_base {
179 // [[See comment about extra 'k' above]]
180 __vki_sighandler_t ksa_handler;
181 unsigned long sa_flags;
182 __vki_sigrestore_t sa_restorer;
183 vki_sigset_t sa_mask; /* mask last for extensibility */
186 /* On Linux we use the same type for passing sigactions to
187 and from the kernel. Hence: */
188 typedef struct vki_sigaction_base vki_sigaction_toK_t;
189 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
192 typedef struct vki_sigaltstack {
193 void __user *ss_sp;
194 int ss_flags;
195 vki_size_t ss_size;
196 } vki_stack_t;
199 //----------------------------------------------------------------------
200 // From linux-2.6.9/include/asm-ppc/ptrace.h
201 //----------------------------------------------------------------------
203 struct vki_pt_regs {
204 unsigned long gpr[32];
205 unsigned long nip;
206 unsigned long msr;
207 unsigned long orig_gpr3; /* Used for restarting system calls */
208 unsigned long ctr;
209 unsigned long link;
210 unsigned long xer;
211 unsigned long ccr;
212 unsigned long mq; /* 601 only (not used at present) */
213 /* Used on APUS to hold IPL value. */
214 unsigned long trap; /* Reason for being here */
215 /* N.B. for critical exceptions on 4xx, the dar and dsisr
216 fields are overloaded to hold srr0 and srr1. */
217 unsigned long dar; /* Fault registers */
218 unsigned long dsisr; /* on 4xx/Book-E used for ESR */
219 unsigned long result; /* Result of a system call */
221 /* Not in kernel's definition, but apparently needed to stop
222 assertion at coredump-elf.c:267 firing. These padding
223 words make the struct have the same size as a
224 'vki_elf_greg_t'. See message from Ghassan Hammouri on
225 valgrind-developers on 6 April 06. */
226 unsigned long pad[4];
229 #define vki_user_regs_struct vki_pt_regs
231 #define VKI_PT_R0 0
232 #define VKI_PT_R1 1
233 #define VKI_PT_R2 2
234 #define VKI_PT_R3 3
235 #define VKI_PT_R4 4
236 #define VKI_PT_R5 5
237 #define VKI_PT_R6 6
238 #define VKI_PT_R7 7
239 #define VKI_PT_R8 8
240 #define VKI_PT_R9 9
241 #define VKI_PT_R10 10
242 #define VKI_PT_R11 11
243 #define VKI_PT_R12 12
244 #define VKI_PT_R13 13
245 #define VKI_PT_R14 14
246 #define VKI_PT_R15 15
247 #define VKI_PT_R16 16
248 #define VKI_PT_R17 17
249 #define VKI_PT_R18 18
250 #define VKI_PT_R19 19
251 #define VKI_PT_R20 20
252 #define VKI_PT_R21 21
253 #define VKI_PT_R22 22
254 #define VKI_PT_R23 23
255 #define VKI_PT_R24 24
256 #define VKI_PT_R25 25
257 #define VKI_PT_R26 26
258 #define VKI_PT_R27 27
259 #define VKI_PT_R28 28
260 #define VKI_PT_R29 29
261 #define VKI_PT_R30 30
262 #define VKI_PT_R31 31
263 #define VKI_PT_NIP 32
264 #define VKI_PT_MSR 33
265 #define VKI_PT_ORIG_R3 34
266 #define VKI_PT_CTR 35
267 #define VKI_PT_LNK 36
268 #define VKI_PT_XER 37
269 #define VKI_PT_CCR 38
270 #define VKI_PT_MQ 39
271 #define VKI_PT_TRAP 40
272 #define VKI_PT_DAR 41
273 #define VKI_PT_DSISR 42
274 #define VKI_PT_RESULT 43
276 //----------------------------------------------------------------------
277 // From linux-2.6.9/include/asm-ppc/sigcontext.h
278 //----------------------------------------------------------------------
280 struct vki_sigcontext {
281 unsigned long _unused[4];
282 int signal;
283 unsigned long handler;
284 unsigned long oldmask;
285 struct vki_pt_regs *regs;
288 //----------------------------------------------------------------------
289 // From linux-2.6.9/include/asm-ppc/mman.h
290 //----------------------------------------------------------------------
292 #define VKI_PROT_NONE 0x0 /* No page permissions */
293 #define VKI_PROT_READ 0x1 /* page can be read */
294 #define VKI_PROT_WRITE 0x2 /* page can be written */
295 #define VKI_PROT_EXEC 0x4 /* page can be executed */
296 #define VKI_PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
297 #define VKI_PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
299 #define VKI_MAP_SHARED 0x01 /* Share changes */
300 #define VKI_MAP_PRIVATE 0x02 /* Changes are private */
301 //#define VKI_MAP_TYPE 0x0f /* Mask for type of mapping */
302 #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */
303 #define VKI_MAP_ANONYMOUS 0x20 /* don't use a file */
304 #define VKI_MAP_NORESERVE 0x40 /* don't reserve swap pages */
306 //----------------------------------------------------------------------
307 // From linux-2.6.9/include/asm-ppc/fcntl.h
308 //----------------------------------------------------------------------
310 #define VKI_O_ACCMODE 03
311 #define VKI_O_RDONLY 00
312 #define VKI_O_WRONLY 01
313 #define VKI_O_RDWR 02
314 #define VKI_O_CREAT 0100 /* not fcntl */
315 #define VKI_O_EXCL 0200 /* not fcntl */
316 #define VKI_O_TRUNC 01000 /* not fcntl */
317 #define VKI_O_APPEND 02000
318 #define VKI_O_NONBLOCK 04000
319 #define VKI_O_LARGEFILE 0200000
321 #define VKI_AT_FDCWD -100
323 #define VKI_F_DUPFD 0 /* dup */
324 #define VKI_F_GETFD 1 /* get close_on_exec */
325 #define VKI_F_SETFD 2 /* set/clear close_on_exec */
326 #define VKI_F_GETFL 3 /* get file->f_flags */
327 #define VKI_F_SETFL 4 /* set file->f_flags */
328 #define VKI_F_GETLK 5
329 #define VKI_F_SETLK 6
330 #define VKI_F_SETLKW 7
332 #define VKI_F_SETOWN 8 /* for sockets. */
333 #define VKI_F_GETOWN 9 /* for sockets. */
334 #define VKI_F_SETSIG 10 /* for sockets. */
335 #define VKI_F_GETSIG 11 /* for sockets. */
337 #define VKI_F_GETLK64 12 /* using 'struct flock64' */
338 #define VKI_F_SETLK64 13
339 #define VKI_F_SETLKW64 14
341 #define VKI_F_SETOWN_EX 15
342 #define VKI_F_GETOWN_EX 16
344 #define VKI_F_OFD_GETLK 36
345 #define VKI_F_OFD_SETLK 37
346 #define VKI_F_OFD_SETLKW 38
348 #define VKI_F_OWNER_TID 0
349 #define VKI_F_OWNER_PID 1
350 #define VKI_F_OWNER_PGRP 2
352 struct vki_f_owner_ex {
353 int type;
354 __vki_kernel_pid_t pid;
357 /* for F_[GET|SET]FL */
358 #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */
360 #define VKI_F_LINUX_SPECIFIC_BASE 1024
362 //----------------------------------------------------------------------
363 // From linux-2.6.9/include/asm-ppc/resource.h
364 //----------------------------------------------------------------------
366 #define VKI_RLIMIT_DATA 2 /* max data size */
367 #define VKI_RLIMIT_STACK 3 /* max stack size */
368 #define VKI_RLIMIT_CORE 4 /* max core file size */
369 #define VKI_RLIMIT_NOFILE 7 /* max number of open files */
371 //----------------------------------------------------------------------
372 // From linux-2.6.9/include/asm-ppc/socket.h
373 //----------------------------------------------------------------------
375 #define VKI_SOL_SOCKET 1
377 #define VKI_SO_TYPE 3
379 #define VKI_SO_ATTACH_FILTER 26
381 //----------------------------------------------------------------------
382 // From linux-2.6.8.1/include/asm-ppc/sockios.h
383 //----------------------------------------------------------------------
385 #define VKI_SIOCSPGRP 0x8902
386 #define VKI_SIOCGPGRP 0x8904
387 #define VKI_SIOCATMARK 0x8905
388 #define VKI_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
389 #define VKI_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
391 //----------------------------------------------------------------------
392 // From linux-2.6.10/include/asm-ppc/stat.h
393 //----------------------------------------------------------------------
395 //.. #define VKI_S_IFMT 00170000
396 //.. #define VKI_S_IFSOCK 0140000
397 //.. #define VKI_S_IFLNK 0120000
398 //.. #define VKI_S_IFREG 0100000
399 //.. #define VKI_S_IFBLK 0060000
400 //.. #define VKI_S_IFDIR 0040000
401 //.. #define VKI_S_IFCHR 0020000
402 //.. #define VKI_S_IFIFO 0010000
403 //.. #define VKI_S_ISUID 0004000
404 //.. #define VKI_S_ISGID 0002000
405 //.. #define VKI_S_ISVTX 0001000
406 //..
407 //.. #define VKI_S_ISLNK(m) (((m) & VKI_S_IFMT) == VKI_S_IFLNK)
408 //.. #define VKI_S_ISREG(m) (((m) & VKI_S_IFMT) == VKI_S_IFREG)
409 //.. #define VKI_S_ISDIR(m) (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
410 //.. #define VKI_S_ISCHR(m) (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
411 //.. #define VKI_S_ISBLK(m) (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
412 //.. #define VKI_S_ISFIFO(m) (((m) & VKI_S_IFMT) == VKI_S_IFIFO)
413 //.. #define VKI_S_ISSOCK(m) (((m) & VKI_S_IFMT) == VKI_S_IFSOCK)
415 struct vki_stat {
416 unsigned st_dev;
417 unsigned long st_ino;
418 unsigned int st_mode;
419 unsigned short st_nlink;
420 unsigned int st_uid;
421 unsigned int st_gid;
422 unsigned st_rdev;
423 long st_size;
424 unsigned long st_blksize;
425 unsigned long st_blocks;
426 unsigned long st_atime;
427 unsigned long st_atime_nsec;
428 unsigned long st_mtime;
429 unsigned long st_mtime_nsec;
430 unsigned long st_ctime;
431 unsigned long st_ctime_nsec;
432 unsigned long __unused4;
433 unsigned long __unused5;
436 struct vki_stat64 {
437 unsigned long long st_dev;
438 unsigned long long st_ino;
439 unsigned int st_mode;
440 unsigned int st_nlink;
441 unsigned int st_uid;
442 unsigned int st_gid;
443 unsigned long long st_rdev;
444 unsigned short int __pad2;
445 long long st_size;
446 long st_blksize;
448 long long st_blocks;
449 long st_atime;
450 unsigned long st_atime_nsec;
451 long st_mtime;
452 unsigned long int st_mtime_nsec;
453 long st_ctime;
454 unsigned long int st_ctime_nsec;
455 unsigned long int __unused4;
456 unsigned long int __unused5;
460 //----------------------------------------------------------------------
461 // From linux-2.6.9/include/asm-ppc/statfs.h
462 //----------------------------------------------------------------------
464 // [[Nb: asm-ppc/statfs.h just #include asm-generic/statfs.h directly]]
465 struct vki_statfs {
466 __vki_u32 f_type;
467 __vki_u32 f_bsize;
468 __vki_u32 f_blocks;
469 __vki_u32 f_bfree;
470 __vki_u32 f_bavail;
471 __vki_u32 f_files;
472 __vki_u32 f_ffree;
473 __vki_kernel_fsid_t f_fsid;
474 __vki_u32 f_namelen;
475 __vki_u32 f_frsize;
476 __vki_u32 f_spare[5];
479 //----------------------------------------------------------------------
480 // From linux-2.6.9/include/asm-ppc/termios.h
481 //----------------------------------------------------------------------
483 struct vki_winsize {
484 unsigned short ws_row;
485 unsigned short ws_col;
486 unsigned short ws_xpixel;
487 unsigned short ws_ypixel;
490 #define NCC 10
491 struct vki_termio {
492 unsigned short c_iflag; /* input mode flags */
493 unsigned short c_oflag; /* output mode flags */
494 unsigned short c_cflag; /* control mode flags */
495 unsigned short c_lflag; /* local mode flags */
496 unsigned char c_line; /* line discipline */
497 unsigned char c_cc[NCC]; /* control characters */
500 //----------------------------------------------------------------------
501 // From linux-2.6.9/include/asm-ppc/termbits.h
502 //----------------------------------------------------------------------
504 typedef unsigned char vki_cc_t;
505 typedef unsigned int vki_speed_t;
506 typedef unsigned int vki_tcflag_t;
508 #define NCCS 19
509 struct vki_termios {
510 vki_tcflag_t c_iflag; /* input mode flags */
511 vki_tcflag_t c_oflag; /* output mode flags */
512 vki_tcflag_t c_cflag; /* control mode flags */
513 vki_tcflag_t c_lflag; /* local mode flags */
514 vki_cc_t c_cc[NCCS]; /* control characters */
515 vki_cc_t c_line; /* line discipline (== c_cc[19]) */
516 vki_speed_t c_ispeed; /* input speed */
517 vki_speed_t c_ospeed; /* output speed */
520 //----------------------------------------------------------------------
521 // From linux-2.6.9/include/asm-ppc/ioctl.h
522 //----------------------------------------------------------------------
524 #define _VKI_IOC_NRBITS 8
525 #define _VKI_IOC_TYPEBITS 8
526 #define _VKI_IOC_SIZEBITS 13
527 #define _VKI_IOC_DIRBITS 3
529 #define _VKI_IOC_NRMASK ((1 << _VKI_IOC_NRBITS)-1)
530 #define _VKI_IOC_TYPEMASK ((1 << _VKI_IOC_TYPEBITS)-1)
531 #define _VKI_IOC_SIZEMASK ((1 << _VKI_IOC_SIZEBITS)-1)
532 #define _VKI_IOC_DIRMASK ((1 << _VKI_IOC_DIRBITS)-1)
534 #define _VKI_IOC_NRSHIFT 0
535 #define _VKI_IOC_TYPESHIFT (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
536 #define _VKI_IOC_SIZESHIFT (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
537 #define _VKI_IOC_DIRSHIFT (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
539 #define _VKI_IOC_NONE 1U
540 #define _VKI_IOC_READ 2U
541 #define _VKI_IOC_WRITE 4U
543 #define _VKI_IOC(dir,type,nr,size) \
544 (((dir) << _VKI_IOC_DIRSHIFT) | \
545 ((type) << _VKI_IOC_TYPESHIFT) | \
546 ((nr) << _VKI_IOC_NRSHIFT) | \
547 ((size) << _VKI_IOC_SIZESHIFT))
549 /* used to create numbers */
550 #define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
551 #define _VKI_IOR(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
552 #define _VKI_IOW(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
553 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
555 /* used to decode them.. */
556 #define _VKI_IOC_DIR(nr) (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
557 //.. #define _VKI_IOC_TYPE(nr) (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
558 //.. #define _VKI_IOC_NR(nr) (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
559 #define _VKI_IOC_SIZE(nr) (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
561 //----------------------------------------------------------------------
562 // From linux-2.6.9/include/asm-ppc/ioctls.h
563 //----------------------------------------------------------------------
565 #define VKI_FIOCLEX _VKI_IO('f', 1)
566 #define VKI_FIONCLEX _VKI_IO('f', 2)
567 #define VKI_FIOASYNC _VKI_IOW('f', 125, int)
568 #define VKI_FIONBIO _VKI_IOW('f', 126, int)
569 #define VKI_FIONREAD _VKI_IOR('f', 127, int)
570 //#define VKI_TIOCINQ VKI_FIONREAD
571 #define VKI_FIOQSIZE _VKI_IOR('f', 128, vki_loff_t)
573 //#define VKI_TIOCGETP _VKI_IOR('t', 8, struct vki_sgttyb)
574 //#define VKI_TIOCSETP _VKI_IOW('t', 9, struct vki_sgttyb)
575 //#define VKI_TIOCSETN _VKI_IOW('t', 10, struct vki_sgttyb) /* TIOCSETP wo flush */
577 //#define VKI_TIOCSETC _VKI_IOW('t', 17, struct vki_tchars)
578 //#define VKI_TIOCGETC _VKI_IOR('t', 18, struct vki_tchars)
579 #define VKI_TCGETS _VKI_IOR('t', 19, struct vki_termios)
580 #define VKI_TCSETS _VKI_IOW('t', 20, struct vki_termios)
581 #define VKI_TCSETSW _VKI_IOW('t', 21, struct vki_termios)
582 #define VKI_TCSETSF _VKI_IOW('t', 22, struct vki_termios)
584 #define VKI_TCGETA _VKI_IOR('t', 23, struct vki_termio)
585 #define VKI_TCSETA _VKI_IOW('t', 24, struct vki_termio)
586 #define VKI_TCSETAW _VKI_IOW('t', 25, struct vki_termio)
587 #define VKI_TCSETAF _VKI_IOW('t', 28, struct vki_termio)
589 #define VKI_TCSBRK _VKI_IO('t', 29)
590 #define VKI_TCXONC _VKI_IO('t', 30)
591 #define VKI_TCFLSH _VKI_IO('t', 31)
593 #define VKI_TIOCSWINSZ _VKI_IOW('t', 103, struct vki_winsize)
594 #define VKI_TIOCGWINSZ _VKI_IOR('t', 104, struct vki_winsize)
595 //#define VKI_TIOCSTART _VKI_IO('t', 110) /* start output, like ^Q */
596 //#define VKI_TIOCSTOP _VKI_IO('t', 111) /* stop output, like ^S */
597 #define VKI_TIOCOUTQ _VKI_IOR('t', 115, int) /* output queue size */
599 //#define VKI_TIOCGLTC _VKI_IOR('t', 116, struct vki_ltchars)
600 //#define VKI_TIOCSLTC _VKI_IOW('t', 117, struct vki_ltchars)
601 #define VKI_TIOCSPGRP _VKI_IOW('t', 118, int)
602 #define VKI_TIOCGPGRP _VKI_IOR('t', 119, int)
604 //#define VKI_TIOCEXCL 0x540C
605 //#define VKI_TIOCNXCL 0x540D
606 #define VKI_TIOCSCTTY 0x540E
608 //#define VKI_TIOCSTI 0x5412
609 #define VKI_TIOCMGET 0x5415
610 #define VKI_TIOCMBIS 0x5416
611 #define VKI_TIOCMBIC 0x5417
612 #define VKI_TIOCMSET 0x5418
613 //# define VKI_TIOCM_LE 0x001
614 //# define VKI_TIOCM_DTR 0x002
615 //# define VKI_TIOCM_RTS 0x004
616 //# define VKI_TIOCM_ST 0x008
617 //# define VKI_TIOCM_SR 0x010
618 //# define VKI_TIOCM_CTS 0x020
619 //# define VKI_TIOCM_CAR 0x040
620 //# define VKI_TIOCM_RNG 0x080
621 //# define VKI_TIOCM_DSR 0x100
622 //# define VKI_TIOCM_CD VKI_TIOCM_CAR
623 //# define VKI_TIOCM_RI VKI_TIOCM_RNG
625 //#define VKI_TIOCGSOFTCAR 0x5419
626 //#define VKI_TIOCSSOFTCAR 0x541A
627 #define VKI_TIOCLINUX 0x541C
628 //#define VKI_TIOCCONS 0x541D
629 #define VKI_TIOCGSERIAL 0x541E
630 #define VKI_TIOCSSERIAL 0x541F
631 //#define VKI_TIOCPKT 0x5420
632 //# define VKI_TIOCPKT_DATA 0
633 //# define VKI_TIOCPKT_FLUSHREAD 1
634 //# define VKI_TIOCPKT_FLUSHWRITE 2
635 //# define VKI_TIOCPKT_STOP 4
636 //# define VKI_TIOCPKT_START 8
637 //# define VKI_TIOCPKT_NOSTOP 16
638 //# define VKI_TIOCPKT_DOSTOP 32
640 #define VKI_TIOCNOTTY 0x5422
641 //#define VKI_TIOCSETD 0x5423
642 //#define VKI_TIOCGETD 0x5424
643 #define VKI_TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
644 //#define VKI_TIOCSBRK 0x5427 /* BSD compatibility */
645 //#define VKI_TIOCCBRK 0x5428 /* BSD compatibility */
646 //#define VKI_TIOCGSID 0x5429 /* Return the session ID of FD */
647 #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
648 #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int) /* Lock/unlock Pty */
650 //#define VKI_TIOCSERCONFIG 0x5453
651 //#define VKI_TIOCSERGWILD 0x5454
652 //#define VKI_TIOCSERSWILD 0x5455
653 //#define VKI_TIOCGLCKTRMIOS 0x5456
654 //#define VKI_TIOCSLCKTRMIOS 0x5457
655 //#define VKI_TIOCSERGSTRUCT 0x5458 /* For debugging only */
656 #define VKI_TIOCSERGETLSR 0x5459 /* Get line status register */
657 /* ioctl (fd, VKI_TIOCSERGETLSR, &result) where result may be as below */
658 //# define VKI_TIOCSER_TEMT 0x01 /* Transmitter physically empty */
659 //#define VKI_TIOCSERGETMULTI 0x545A /* Get multiport config */
660 //#define VKI_TIOCSERSETMULTI 0x545B /* Set multiport config */
662 //#define VKI_TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
663 #define VKI_TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
665 //----------------------------------------------------------------------
666 // From linux-2.6.9/include/asm-ppc/poll.h
667 //----------------------------------------------------------------------
669 //.. /* These are specified by iBCS2 */
670 //.. #define VKI_POLLIN 0x0001
672 struct vki_pollfd {
673 int fd;
674 short events;
675 short revents;
678 //.. //----------------------------------------------------------------------
679 //.. // From linux-2.6.8.1/include/asm-i386/user.h
680 //.. //----------------------------------------------------------------------
681 //..
682 //.. struct vki_user_i387_struct {
683 //.. long cwd;
684 //.. long swd;
685 //.. long twd;
686 //.. long fip;
687 //.. long fcs;
688 //.. long foo;
689 //.. long fos;
690 //.. long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */
691 //.. };
692 //..
693 //.. struct vki_user_fxsr_struct {
694 //.. unsigned short cwd;
695 //.. unsigned short swd;
696 //.. unsigned short twd;
697 //.. unsigned short fop;
698 //.. long fip;
699 //.. long fcs;
700 //.. long foo;
701 //.. long fos;
702 //.. long mxcsr;
703 //.. long reserved;
704 //.. long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
705 //.. long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
706 //.. long padding[56];
707 //.. };
708 //..
709 //.. /*
710 //.. * This is the old layout of "struct pt_regs", and
711 //.. * is still the layout used by user mode (the new
712 //.. * pt_regs doesn't have all registers as the kernel
713 //.. * doesn't use the extra segment registers)
714 //.. */
715 //.. struct vki_user_regs_struct {
716 //.. long ebx, ecx, edx, esi, edi, ebp, eax;
717 //.. unsigned short ds, __ds, es, __es;
718 //.. unsigned short fs, __fs, gs, __gs;
719 //.. long orig_eax, eip;
720 //.. unsigned short cs, __cs;
721 //.. long eflags, esp;
722 //.. unsigned short ss, __ss;
723 //.. };
725 //----------------------------------------------------------------------
726 // From linux-2.6.9/include/asm-ppc/elf.h
727 //----------------------------------------------------------------------
729 #define VKI_ELF_NGREG 48 /* includes nip, msr, lr, etc. */
730 #define VKI_ELF_NFPREG 33 /* includes fpscr */
731 #define VKI_ELF_NVRREG 33 /* includes vscr */
733 /* General registers */
734 typedef unsigned long vki_elf_greg_t;
735 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
737 /* Floating point registers */
738 typedef double vki_elf_fpreg_t;
739 typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
741 /* Altivec registers */
742 typedef __vki_vector128 vki_elf_vrreg_t;
743 typedef vki_elf_vrreg_t vki_elf_vrregset_t[VKI_ELF_NVRREG];
745 #define VKI_AT_DCACHEBSIZE 19
746 #define VKI_AT_ICACHEBSIZE 20
747 #define VKI_AT_UCACHEBSIZE 21
748 /* A special ignored type value for PPC, for glibc compatibility. */
749 #define VKI_AT_IGNOREPPC 22
751 /* CAB: Do we want these? */
752 //#define VKI_AT_SYSINFO 32
753 //#define VKI_AT_SYSINFO_EHDR 33
755 //----------------------------------------------------------------------
756 // From linux-2.6.9/include/asm-ppc/ucontext.h
757 //----------------------------------------------------------------------
759 struct vki_mcontext {
760 vki_elf_gregset_t mc_gregs;
761 vki_elf_fpregset_t mc_fregs;
762 unsigned long mc_pad[2];
763 vki_elf_vrregset_t mc_vregs __attribute__((__aligned__(16)));
766 struct vki_ucontext {
767 unsigned long uc_flags;
768 struct vki_ucontext __user *uc_link;
769 vki_stack_t uc_stack;
770 int uc_pad[7];
771 struct vki_mcontext __user *uc_regs; /* points to uc_mcontext field */
772 vki_sigset_t uc_sigmask;
773 /* glibc has 1024-bit signal masks, ours are 64-bit */
774 int uc_maskext[30];
775 int uc_pad2[3];
776 struct vki_mcontext uc_mcontext;
779 //.. //----------------------------------------------------------------------
780 //.. // From linux-2.6.8.1/include/asm-i386/segment.h
781 //.. //----------------------------------------------------------------------
782 //..
783 //.. #define VKI_GDT_ENTRY_TLS_ENTRIES 3
784 //.. #define VKI_GDT_ENTRY_TLS_MIN 6
785 //.. #define VKI_GDT_ENTRY_TLS_MAX (VKI_GDT_ENTRY_TLS_MIN + VKI_GDT_ENTRY_TLS_ENTRIES - 1)
787 //----------------------------------------------------------------------
788 // From linux-2.6.9/include/asm-ppc/ldt.h
789 //----------------------------------------------------------------------
791 //.. /* [[Nb: This is the structure passed to the modify_ldt syscall. Just so as
792 //.. to confuse and annoy everyone, this is _not_ the same as an
793 //.. VgLdtEntry and has to be translated into such. The logic for doing
794 //.. so, in vg_ldt.c, is copied from the kernel sources.]] */
795 //.. struct vki_user_desc {
796 //.. unsigned int entry_number;
797 //.. unsigned long base_addr;
798 //.. unsigned int limit;
799 //.. unsigned int seg_32bit:1;
800 //.. unsigned int contents:2;
801 //.. unsigned int read_exec_only:1;
802 //.. unsigned int limit_in_pages:1;
803 //.. unsigned int seg_not_present:1;
804 //.. unsigned int useable:1;
805 //.. // [[Nb: this field is not in the kernel sources, but it has always
806 //.. // been in the Valgrind sources so I will keep it there in case it's
807 //.. // important... this is an x86-defined data structure so who
808 //.. // knows; maybe it's important to set this field to zero at some
809 //.. // point. --njn]]
810 //.. unsigned int reserved:25;
811 //.. };
812 //..
813 //.. // [[Nb: for our convenience within Valgrind, use a more specific name]]
815 // CAB: TODO
816 typedef char vki_modify_ldt_t;
819 //----------------------------------------------------------------------
820 // From linux-2.6.9/include/asm-ppc/ipcbuf.h
821 //----------------------------------------------------------------------
823 struct vki_ipc64_perm
825 __vki_kernel_key_t key;
826 __vki_kernel_uid_t uid;
827 __vki_kernel_gid_t gid;
828 __vki_kernel_uid_t cuid;
829 __vki_kernel_gid_t cgid;
830 __vki_kernel_mode_t mode;
831 unsigned long seq;
832 unsigned int __pad2;
833 unsigned long long __unused1;
834 unsigned long long __unused2;
837 //----------------------------------------------------------------------
838 // From linux-2.6.9/include/asm-ppc/sembuf.h
839 //----------------------------------------------------------------------
841 struct vki_semid64_ds {
842 struct vki_ipc64_perm sem_perm; /* permissions .. see ipc.h */
843 unsigned int __unused1;
844 __vki_kernel_time_t sem_otime; /* last semop time */
845 unsigned int __unused2;
846 __vki_kernel_time_t sem_ctime; /* last change time */
847 unsigned long sem_nsems; /* no. of semaphores in array */
848 unsigned long __unused3;
849 unsigned long __unused4;
852 //----------------------------------------------------------------------
853 // From linux-2.6.9/include/asm-ppc/msgbuf.h
854 //----------------------------------------------------------------------
856 struct vki_msqid64_ds {
857 struct vki_ipc64_perm msg_perm;
858 unsigned int __unused1;
859 __vki_kernel_time_t msg_stime; /* last msgsnd time */
860 unsigned int __unused2;
861 __vki_kernel_time_t msg_rtime; /* last msgrcv time */
862 unsigned int __unused3;
863 __vki_kernel_time_t msg_ctime; /* last change time */
864 unsigned long msg_cbytes; /* current number of bytes on queue */
865 unsigned long msg_qnum; /* number of messages in queue */
866 unsigned long msg_qbytes; /* max number of bytes on queue */
867 __vki_kernel_pid_t msg_lspid; /* pid of last msgsnd */
868 __vki_kernel_pid_t msg_lrpid; /* last receive pid */
869 unsigned long __unused4;
870 unsigned long __unused5;
873 //----------------------------------------------------------------------
874 // From linux-2.6.8.1/include/asm-ppc/ipc.h
875 //----------------------------------------------------------------------
877 struct vki_ipc_kludge {
878 struct vki_msgbuf __user *msgp;
879 long msgtyp;
882 #define VKI_SEMOP 1
883 #define VKI_SEMGET 2
884 #define VKI_SEMCTL 3
885 #define VKI_SEMTIMEDOP 4
886 #define VKI_MSGSND 11
887 #define VKI_MSGRCV 12
888 #define VKI_MSGGET 13
889 #define VKI_MSGCTL 14
890 #define VKI_SHMAT 21
891 #define VKI_SHMDT 22
892 #define VKI_SHMGET 23
893 #define VKI_SHMCTL 24
895 //----------------------------------------------------------------------
896 // From linux-2.6.9/include/asm-ppc/shmbuf.h
897 //----------------------------------------------------------------------
899 struct vki_shmid64_ds {
900 struct vki_ipc64_perm shm_perm; /* operation perms */
901 unsigned int __unused1;
902 __vki_kernel_time_t shm_atime; /* last attach time */
903 unsigned int __unused2;
904 __vki_kernel_time_t shm_dtime; /* last detach time */
905 unsigned int __unused3;
906 __vki_kernel_time_t shm_ctime; /* last change time */
907 unsigned int __unused4;
908 vki_size_t shm_segsz; /* size of segment (bytes) */
909 __vki_kernel_pid_t shm_cpid; /* pid of creator */
910 __vki_kernel_pid_t shm_lpid; /* pid of last operator */
911 unsigned long shm_nattch; /* no. of current attaches */
912 unsigned long __unused5;
913 unsigned long __unused6;
916 struct vki_shminfo64 {
917 unsigned long shmmax;
918 unsigned long shmmin;
919 unsigned long shmmni;
920 unsigned long shmseg;
921 unsigned long shmall;
922 unsigned long __unused1;
923 unsigned long __unused2;
924 unsigned long __unused3;
925 unsigned long __unused4;
928 //----------------------------------------------------------------------
929 // From linux-2.6.8.1/include/asm-generic/errno.h
930 //----------------------------------------------------------------------
932 #define VKI_ENOSYS 38 /* Function not implemented */
933 #define VKI_EOVERFLOW 75 /* Value too large for defined data type */
935 //.. //----------------------------------------------------------------------
936 //.. // DRM ioctls
937 //.. //----------------------------------------------------------------------
938 //..
939 //.. // jrs 20050207: where did all this stuff come from? Is it really
940 //.. // i386 specific, or should it go into the linux-generic category?
941 //.. //struct vki_drm_buf_pub {
942 //.. // Int idx; /**< Index into the master buffer list */
943 //.. // Int total; /**< Buffer size */
944 //.. // Int used; /**< Amount of buffer in use (for DMA) */
945 //.. // void __user *address; /**< Address of buffer */
946 //.. //};
947 //.. //
948 //.. //struct vki_drm_buf_map {
949 //.. // Int count; /**< Length of the buffer list */
950 //.. // void __user *virtual; /**< Mmap'd area in user-virtual */
951 //.. // struct vki_drm_buf_pub __user *list; /**< Buffer information */
952 //.. //};
953 //.. //
954 //.. ///* We need to pay attention to this, because it mmaps memory */
955 //.. //#define VKI_DRM_IOCTL_MAP_BUFS _VKI_IOWR('d', 0x19, struct vki_drm_buf_map)
957 //----------------------------------------------------------------------
958 // And that's it!
959 //----------------------------------------------------------------------
961 #endif // __VKI_PPC32_LINUX_H
963 /*--------------------------------------------------------------------*/
964 /*--- end ---*/
965 /*--------------------------------------------------------------------*/