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