]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/include/vki/vki-arm-linux.h
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / include / vki / vki-arm-linux.h
1
2 /*--------------------------------------------------------------------*/
3 /*--- arm/Linux-specific kernel interface.         vki-arm-linux.h ---*/
4 /*--------------------------------------------------------------------*/
5
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9
10    Copyright (C) 2000-2008 Julian Seward 
11       jseward@acm.org
12
13    This program is free software; you can redistribute it and/or
14    modify it under the terms of the GNU General Public License as
15    published by the Free Software Foundation; either version 2 of the
16    License, or (at your option) any later version.
17
18    This program is distributed in the hope that it will be useful, but
19    WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26    02111-1307, USA.
27
28    The GNU General Public License is contained in the file COPYING.
29 */
30
31 #ifndef __VKI_ARM_LINUX_H
32 #define __VKI_ARM_LINUX_H
33
34 // arm is little-endian.
35 #define VKI_LITTLE_ENDIAN  1
36
37 // The various comments below indicating i386-ness should be regarded
38 // with great skepticism -- they are quite possibly wrong.  But see
39 // also bug 269079 comment 0.
40
41 //----------------------------------------------------------------------
42 // From linux-2.6.8.1/include/asm-i386/types.h
43 //----------------------------------------------------------------------
44
45 typedef unsigned char __vki_u8;
46
47 typedef __signed__ short __vki_s16;
48 typedef unsigned short __vki_u16;
49
50 typedef __signed__ int __vki_s32;
51 typedef unsigned int __vki_u32;
52
53 typedef __signed__ long long __vki_s64;
54 typedef unsigned long long __vki_u64;
55
56 typedef unsigned short vki_u16;
57
58 typedef unsigned int vki_u32;
59
60 //----------------------------------------------------------------------
61 // From linux-2.6.8.1/include/asm-i386/page.h
62 //----------------------------------------------------------------------
63
64 /* PAGE_SHIFT determines the page size */
65 #define VKI_PAGE_SHIFT  12
66 #define VKI_PAGE_SIZE   (1UL << VKI_PAGE_SHIFT)
67 #define VKI_MAX_PAGE_SHIFT      VKI_PAGE_SHIFT
68 #define VKI_MAX_PAGE_SIZE       VKI_PAGE_SIZE
69
70 //----------------------------------------------------------------------
71 // From linux-2.6.35.4/arch/arm/include/asm/shmparam.h
72 //----------------------------------------------------------------------
73
74 #define VKI_SHMLBA  (4 * VKI_PAGE_SIZE)
75
76 //----------------------------------------------------------------------
77 // From linux-2.6.8.1/include/asm-i386/signal.h
78 //----------------------------------------------------------------------
79
80 #define VKI_MINSIGSTKSZ 2048
81
82 #define VKI_SIG_BLOCK          0        /* for blocking signals */
83 #define VKI_SIG_UNBLOCK        1        /* for unblocking signals */
84 #define VKI_SIG_SETMASK        2        /* for setting the signal mask */
85
86 /* Type of a signal handler.  */
87 typedef void __vki_signalfn_t(int);
88 typedef __vki_signalfn_t __user *__vki_sighandler_t;
89
90 typedef void __vki_restorefn_t(void);
91 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
92
93 #define VKI_SIG_DFL     ((__vki_sighandler_t)0) /* default signal handling */
94 #define VKI_SIG_IGN     ((__vki_sighandler_t)1) /* ignore signal */
95
96 #define _VKI_NSIG       64
97 #define _VKI_NSIG_BPW   32
98 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
99
100 typedef unsigned long vki_old_sigset_t;         /* at least 32 bits */
101
102 typedef struct {
103         unsigned long sig[_VKI_NSIG_WORDS];
104 } vki_sigset_t;
105
106 #define VKI_SIGHUP               1
107 #define VKI_SIGINT               2
108 #define VKI_SIGQUIT              3
109 #define VKI_SIGILL               4
110 #define VKI_SIGTRAP              5
111 #define VKI_SIGABRT              6
112 //#define VKI_SIGIOT             6
113 #define VKI_SIGBUS               7
114 #define VKI_SIGFPE               8
115 #define VKI_SIGKILL              9
116 #define VKI_SIGUSR1             10
117 #define VKI_SIGSEGV             11
118 #define VKI_SIGUSR2             12
119 #define VKI_SIGPIPE             13
120 #define VKI_SIGALRM             14
121 #define VKI_SIGTERM             15
122 #define VKI_SIGSTKFLT           16
123 #define VKI_SIGCHLD             17
124 #define VKI_SIGCONT             18
125 #define VKI_SIGSTOP             19
126 #define VKI_SIGTSTP             20
127 #define VKI_SIGTTIN             21
128 #define VKI_SIGTTOU             22
129 #define VKI_SIGURG              23
130 #define VKI_SIGXCPU             24
131 #define VKI_SIGXFSZ             25
132 #define VKI_SIGVTALRM           26
133 #define VKI_SIGPROF             27
134 #define VKI_SIGWINCH            28
135 #define VKI_SIGIO               29
136 #define VKI_SIGPWR              30
137 #define VKI_SIGSYS              31
138 #define VKI_SIGUNUSED           31
139
140 /* These should not be considered constants from userland.  */
141 #define VKI_SIGRTMIN    32
142 // [[This was (_NSIG-1) in 2.4.X... not sure if it matters.]]
143 #define VKI_SIGRTMAX    _VKI_NSIG
144
145 #define VKI_SA_NOCLDSTOP        0x00000001u
146 #define VKI_SA_NOCLDWAIT        0x00000002u
147 #define VKI_SA_SIGINFO          0x00000004u
148 #define VKI_SA_ONSTACK          0x08000000u
149 #define VKI_SA_RESTART          0x10000000u
150 #define VKI_SA_NODEFER          0x40000000u
151 #define VKI_SA_RESETHAND        0x80000000u
152
153 #define VKI_SA_NOMASK           VKI_SA_NODEFER
154 #define VKI_SA_ONESHOT          VKI_SA_RESETHAND
155 //#define VKI_SA_INTERRUPT      0x20000000 /* dummy -- ignored */
156
157 #define VKI_SA_RESTORER         0x04000000
158
159 #define VKI_SS_ONSTACK  1
160 #define VKI_SS_DISABLE  2
161
162 struct vki_old_sigaction {
163         // [[Nb: a 'k' prefix is added to "sa_handler" because
164         // bits/sigaction.h (which gets dragged in somehow via signal.h)
165         // #defines it as something else.  Since that is done for glibc's
166         // purposes, which we don't care about here, we use our own name.]]
167         __vki_sighandler_t ksa_handler;
168         vki_old_sigset_t sa_mask;
169         unsigned long sa_flags;
170         __vki_sigrestore_t sa_restorer;
171 };
172
173 struct vki_sigaction_base {
174         // [[See comment about extra 'k' above]]
175         __vki_sighandler_t ksa_handler;
176         unsigned long sa_flags;
177         __vki_sigrestore_t sa_restorer;
178         vki_sigset_t sa_mask;           /* mask last for extensibility */
179 };
180
181 /* On Linux we use the same type for passing sigactions to
182    and from the kernel.  Hence: */
183 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
184 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
185
186
187 typedef struct vki_sigaltstack {
188         void __user *ss_sp;
189         int ss_flags;
190         vki_size_t ss_size;
191 } vki_stack_t;
192
193 //----------------------------------------------------------------------
194 // From linux-2.6.8.1/include/asm-i386/sigcontext.h
195 //----------------------------------------------------------------------
196
197 struct vki_sigcontext {
198                 unsigned long trap_no;
199                 unsigned long error_code;
200                 unsigned long oldmask;
201                 unsigned long arm_r0;
202                 unsigned long arm_r1;
203                 unsigned long arm_r2;
204                 unsigned long arm_r3;
205                 unsigned long arm_r4;
206                 unsigned long arm_r5;
207                 unsigned long arm_r6;
208                 unsigned long arm_r7;
209                 unsigned long arm_r8;
210                 unsigned long arm_r9;
211                 unsigned long arm_r10;
212                 unsigned long arm_fp;
213                 unsigned long arm_ip;
214                 unsigned long arm_sp;
215                 unsigned long arm_lr;
216                 unsigned long arm_pc;
217                 unsigned long arm_cpsr;
218                 unsigned long fault_address;
219 };
220
221 //----------------------------------------------------------------------
222 // From linux-2.6.8.1/include/asm-i386/mman.h
223 //----------------------------------------------------------------------
224
225 #define VKI_PROT_NONE   0x0             /* No page permissions */
226 #define VKI_PROT_READ   0x1             /* page can be read */
227 #define VKI_PROT_WRITE  0x2             /* page can be written */
228 #define VKI_PROT_EXEC   0x4             /* page can be executed */
229 #define VKI_PROT_GROWSDOWN      0x01000000      /* mprotect flag: extend change to start of growsdown vma */
230 #define VKI_PROT_GROWSUP        0x02000000      /* mprotect flag: extend change to end of growsup vma */
231
232 #define VKI_MAP_SHARED  0x01            /* Share changes */
233 #define VKI_MAP_PRIVATE 0x02            /* Changes are private */
234 //#define VKI_MAP_TYPE  0x0f            /* Mask for type of mapping */
235 #define VKI_MAP_FIXED   0x10            /* Interpret addr exactly */
236 #define VKI_MAP_ANONYMOUS       0x20    /* don't use a file */
237 #define VKI_MAP_NORESERVE       0x4000          /* don't check for reservations */
238
239 //----------------------------------------------------------------------
240 // From linux-2.6.8.1/include/asm-i386/fcntl.h
241 //----------------------------------------------------------------------
242
243 #define VKI_O_RDONLY         00
244 #define VKI_O_WRONLY         01
245 #define VKI_O_RDWR           02
246 #define VKI_O_CREAT        0100 /* not fcntl */
247 #define VKI_O_EXCL         0200 /* not fcntl */
248 #define VKI_O_TRUNC       01000 /* not fcntl */
249 #define VKI_O_APPEND      02000
250 #define VKI_O_NONBLOCK    04000
251 #define VKI_O_LARGEFILE 0100000
252
253 #define VKI_AT_FDCWD            -100
254
255 #define VKI_F_DUPFD             0       /* dup */
256 #define VKI_F_GETFD             1       /* get close_on_exec */
257 #define VKI_F_SETFD             2       /* set/clear close_on_exec */
258 #define VKI_F_GETFL             3       /* get file->f_flags */
259 #define VKI_F_SETFL             4       /* set file->f_flags */
260 #define VKI_F_GETLK             5
261 #define VKI_F_SETLK             6
262 #define VKI_F_SETLKW            7
263
264 #define VKI_F_SETOWN            8       /*  for sockets. */
265 #define VKI_F_GETOWN            9       /*  for sockets. */
266 #define VKI_F_SETSIG            10      /*  for sockets. */
267 #define VKI_F_GETSIG            11      /*  for sockets. */
268
269 #define VKI_F_GETLK64           12      /*  using 'struct flock64' */
270 #define VKI_F_SETLK64           13
271 #define VKI_F_SETLKW64          14
272
273 /* for F_[GET|SET]FL */
274 #define VKI_FD_CLOEXEC  1       /* actually anything with low bit set goes */
275
276 #define VKI_F_LINUX_SPECIFIC_BASE       1024
277
278 //----------------------------------------------------------------------
279 // From linux-2.6.8.1/include/asm-i386/resource.h
280 //----------------------------------------------------------------------
281
282 #define VKI_RLIMIT_DATA         2       /* max data size */
283 #define VKI_RLIMIT_STACK        3       /* max stack size */
284 #define VKI_RLIMIT_CORE         4       /* max core file size */
285 #define VKI_RLIMIT_NOFILE       7       /* max number of open files */
286
287 //----------------------------------------------------------------------
288 // From linux-2.6.8.1/include/asm-i386/socket.h
289 //----------------------------------------------------------------------
290
291 #define VKI_SOL_SOCKET  1
292
293 #define VKI_SO_TYPE     3
294
295 //----------------------------------------------------------------------
296 // From linux-2.6.8.1/include/asm-i386/sockios.h
297 //----------------------------------------------------------------------
298
299 #define VKI_SIOCSPGRP           0x8902
300 #define VKI_SIOCGPGRP           0x8904
301 #define VKI_SIOCGSTAMP          0x8906      /* Get stamp (timeval) */
302 #define VKI_SIOCGSTAMPNS        0x8907      /* Get stamp (timespec) */
303
304 //----------------------------------------------------------------------
305 // From linux-2.6.8.1/include/asm-i386/stat.h
306 //----------------------------------------------------------------------
307
308 struct vki_stat {
309         unsigned long  st_dev;
310         unsigned long  st_ino;
311         unsigned short st_mode;
312         unsigned short st_nlink;
313         unsigned short st_uid;
314         unsigned short st_gid;
315         unsigned long  st_rdev;
316         unsigned long  st_size;
317         unsigned long  st_blksize;
318         unsigned long  st_blocks;
319         unsigned long  st_atime;
320         unsigned long  st_atime_nsec;
321         unsigned long  st_mtime;
322         unsigned long  st_mtime_nsec;
323         unsigned long  st_ctime;
324         unsigned long  st_ctime_nsec;
325         unsigned long  __unused4;
326         unsigned long  __unused5;
327 };
328
329 struct vki_stat64 {
330         unsigned long long      st_dev;
331         unsigned char   __pad0[4];
332
333 #define STAT64_HAS_BROKEN_ST_INO        1
334         unsigned long   __st_ino;
335
336         unsigned int    st_mode;
337         unsigned int    st_nlink;
338
339         unsigned long   st_uid;
340         unsigned long   st_gid;
341
342         unsigned long long      st_rdev;
343         unsigned char   __pad3[4];
344
345         long long       st_size;
346         unsigned long   st_blksize;
347
348         unsigned long   st_blocks;      /* Number 512-byte blocks allocated. */
349         unsigned long   __pad4;         /* future possible st_blocks high bits */
350
351         unsigned long   st_atime;
352         unsigned long   st_atime_nsec;
353
354         unsigned long   st_mtime;
355         unsigned int    st_mtime_nsec;
356
357         unsigned long   st_ctime;
358         unsigned long   st_ctime_nsec;
359
360         unsigned long long      st_ino;
361 };
362
363 //----------------------------------------------------------------------
364 // From linux-2.6.8.1/include/asm-i386/statfs.h
365 //----------------------------------------------------------------------
366
367 // [[Nb: asm-i386/statfs.h just #include asm-generic/statfs.h directly]]
368 struct vki_statfs {
369         __vki_u32 f_type;
370         __vki_u32 f_bsize;
371         __vki_u32 f_blocks;
372         __vki_u32 f_bfree;
373         __vki_u32 f_bavail;
374         __vki_u32 f_files;
375         __vki_u32 f_ffree;
376         __vki_kernel_fsid_t f_fsid;
377         __vki_u32 f_namelen;
378         __vki_u32 f_frsize;
379         __vki_u32 f_spare[5];
380 };
381
382 //----------------------------------------------------------------------
383 // From linux-2.6.8.1/include/asm-i386/termios.h
384 //----------------------------------------------------------------------
385
386 struct vki_winsize {
387         unsigned short ws_row;
388         unsigned short ws_col;
389         unsigned short ws_xpixel;
390         unsigned short ws_ypixel;
391 };
392
393 #define VKI_NCC 8
394 struct vki_termio {
395         unsigned short c_iflag;         /* input mode flags */
396         unsigned short c_oflag;         /* output mode flags */
397         unsigned short c_cflag;         /* control mode flags */
398         unsigned short c_lflag;         /* local mode flags */
399         unsigned char c_line;           /* line discipline */
400         unsigned char c_cc[VKI_NCC];    /* control characters */
401 };
402
403
404 //----------------------------------------------------------------------
405 // From linux-2.6.8.1/include/asm-i386/termbits.h
406 //----------------------------------------------------------------------
407
408 typedef unsigned char   vki_cc_t;
409 typedef unsigned int    vki_tcflag_t;
410
411 #define VKI_NCCS 19
412 struct vki_termios {
413         vki_tcflag_t c_iflag;           /* input mode flags */
414         vki_tcflag_t c_oflag;           /* output mode flags */
415         vki_tcflag_t c_cflag;           /* control mode flags */
416         vki_tcflag_t c_lflag;           /* local mode flags */
417         vki_cc_t c_line;                /* line discipline */
418         vki_cc_t c_cc[VKI_NCCS];        /* control characters */
419 };
420
421 //----------------------------------------------------------------------
422 // From linux-2.6.8.1/include/asm-i386/ioctl.h
423 //----------------------------------------------------------------------
424
425 #define _VKI_IOC_NRBITS         8
426 #define _VKI_IOC_TYPEBITS       8
427 #define _VKI_IOC_SIZEBITS       14
428 #define _VKI_IOC_DIRBITS        2
429
430 #define _VKI_IOC_NRMASK         ((1 << _VKI_IOC_NRBITS)-1)
431 #define _VKI_IOC_TYPEMASK       ((1 << _VKI_IOC_TYPEBITS)-1)
432 #define _VKI_IOC_SIZEMASK       ((1 << _VKI_IOC_SIZEBITS)-1)
433 #define _VKI_IOC_DIRMASK        ((1 << _VKI_IOC_DIRBITS)-1)
434
435 #define _VKI_IOC_NRSHIFT        0
436 #define _VKI_IOC_TYPESHIFT      (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
437 #define _VKI_IOC_SIZESHIFT      (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
438 #define _VKI_IOC_DIRSHIFT       (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
439
440 #define _VKI_IOC_NONE   0U
441 #define _VKI_IOC_WRITE  1U
442 #define _VKI_IOC_READ   2U
443
444 #define _VKI_IOC(dir,type,nr,size) \
445         (((dir)  << _VKI_IOC_DIRSHIFT) | \
446          ((type) << _VKI_IOC_TYPESHIFT) | \
447          ((nr)   << _VKI_IOC_NRSHIFT) | \
448          ((size) << _VKI_IOC_SIZESHIFT))
449
450 /* used to create numbers */
451 #define _VKI_IO(type,nr)        _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
452 #define _VKI_IOR(type,nr,size)  _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
453 #define _VKI_IOW(type,nr,size)  _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
454 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
455
456 /* used to decode ioctl numbers.. */
457 #define _VKI_IOC_DIR(nr)        (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
458 #define _VKI_IOC_TYPE(nr)       (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
459 #define _VKI_IOC_NR(nr)         (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
460 #define _VKI_IOC_SIZE(nr)       (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
461
462 //----------------------------------------------------------------------
463 // From linux-2.6.8.1/include/asm-i386/ioctls.h
464 //----------------------------------------------------------------------
465
466 #define VKI_TCGETS      0x5401
467 #define VKI_TCSETS      0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
468 #define VKI_TCSETSW     0x5403
469 #define VKI_TCSETSF     0x5404
470 #define VKI_TCGETA      0x5405
471 #define VKI_TCSETA      0x5406
472 #define VKI_TCSETAW     0x5407
473 #define VKI_TCSETAF     0x5408
474 #define VKI_TCSBRK      0x5409
475 #define VKI_TCXONC      0x540A
476 #define VKI_TCFLSH      0x540B
477 #define VKI_TIOCSCTTY   0x540E
478 #define VKI_TIOCGPGRP   0x540F
479 #define VKI_TIOCSPGRP   0x5410
480 #define VKI_TIOCOUTQ    0x5411
481 #define VKI_TIOCGWINSZ  0x5413
482 #define VKI_TIOCSWINSZ  0x5414
483 #define VKI_TIOCMGET    0x5415
484 #define VKI_TIOCMBIS    0x5416
485 #define VKI_TIOCMBIC    0x5417
486 #define VKI_TIOCMSET    0x5418
487 #define VKI_FIONREAD    0x541B
488 #define VKI_TIOCLINUX   0x541C
489 #define VKI_FIONBIO     0x5421
490 #define VKI_TCSBRKP     0x5425  /* Needed for POSIX tcsendbreak() */
491 #define VKI_TIOCGPTN    _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
492 #define VKI_TIOCSPTLCK  _VKI_IOW('T',0x31, int)  /* Lock/unlock Pty */
493
494 #define VKI_FIOASYNC    0x5452
495 #define VKI_TIOCSERGETLSR   0x5459 /* Get line status register */
496
497 #define VKI_TIOCGICOUNT 0x545D  /* read serial port inline interrupt counts */
498
499 //----------------------------------------------------------------------
500 // From asm-generic/poll.h
501 //----------------------------------------------------------------------
502
503 /* These are specified by iBCS2 */
504 #define VKI_POLLIN              0x0001
505
506 struct vki_pollfd {
507         int fd;
508         short events;
509         short revents;
510 };
511
512 //----------------------------------------------------------------------
513 // From linux-2.6.8.1/include/asm-i386/user.h
514 //----------------------------------------------------------------------
515
516 struct vki_user_fp {
517         struct vki_fp_reg {
518                 unsigned int sign1:1;
519                 unsigned int unused:15;
520                 unsigned int sign2:1;
521                 unsigned int exponent:14;
522                 unsigned int j:1;
523                 unsigned int mantissa1:31;
524                 unsigned int mantissa0:32;
525         } fpregs[8];
526         unsigned int fpsr:32;
527         unsigned int fpcr:32;
528         unsigned char ftype[8];
529         unsigned int init_flag;
530 };
531
532 struct vki_user_vfp {
533         unsigned long long fpregs[32];
534         unsigned long fpscr;
535 };
536
537 #define VKI_IWMMXT_SIZE 0x98
538
539 struct vki_iwmmxt_struct {
540         unsigned int save[VKI_IWMMXT_SIZE / sizeof(unsigned int)];
541 };
542
543 struct vki_crunch_state {
544         unsigned int    mvdx[16][2];
545         unsigned int    mvax[4][3];
546         unsigned int    dspsc[2];
547 };
548
549 #define VKI_CRUNCH_SIZE sizeof(struct vki_crunch_state)
550
551 struct vki_user_regs_struct {
552     long uregs[18];
553 };
554 #define ARM_cpsr        uregs[16]
555 #define ARM_pc          uregs[15]
556 #define ARM_lr          uregs[14]
557 #define ARM_sp          uregs[13]
558 #define ARM_ip          uregs[12]
559 #define ARM_fp          uregs[11]
560 #define ARM_r10         uregs[10]
561 #define ARM_r9          uregs[9]
562 #define ARM_r8          uregs[8]
563 #define ARM_r7          uregs[7]
564 #define ARM_r6          uregs[6]
565 #define ARM_r5          uregs[5]
566 #define ARM_r4          uregs[4]
567 #define ARM_r3          uregs[3]
568 #define ARM_r2          uregs[2]
569 #define ARM_r1          uregs[1]
570 #define ARM_r0          uregs[0]
571 #define ARM_ORIG_r0     uregs[17]
572 //----------------------------------------------------------------------
573 // From linux-2.6.8.1/include/asm-i386/elf.h
574 //----------------------------------------------------------------------
575
576 typedef unsigned long vki_elf_greg_t;
577
578 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
579 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
580
581 typedef struct vki_user_fp vki_elf_fpregset_t;
582
583 #define VKI_AT_SYSINFO          32
584
585 //----------------------------------------------------------------------
586 // From linux-2.6.8.1/include/asm-i386/ucontext.h
587 //----------------------------------------------------------------------
588
589 struct vki_ucontext {
590         unsigned long           uc_flags;
591         struct vki_ucontext    *uc_link;
592         vki_stack_t             uc_stack;
593         struct vki_sigcontext   uc_mcontext;
594         vki_sigset_t            uc_sigmask;     /* mask last for extensibility */
595         int               __unused[32 - (sizeof (vki_sigset_t) / sizeof (int))];
596         unsigned long     uc_regspace[128] __attribute__((__aligned__(8)));
597
598 };
599
600 //----------------------------------------------------------------------
601 // From linux-2.6.8.1/include/asm-i386/segment.h
602 //----------------------------------------------------------------------
603
604 #define VKI_GDT_ENTRY_TLS_ENTRIES       3
605 #define VKI_GDT_ENTRY_TLS_MIN   6
606 #define VKI_GDT_ENTRY_TLS_MAX   (VKI_GDT_ENTRY_TLS_MIN + VKI_GDT_ENTRY_TLS_ENTRIES - 1)
607
608 //----------------------------------------------------------------------
609 // From linux-2.6.8.1/include/asm-i386/ldt.h
610 //----------------------------------------------------------------------
611
612 /* [[Nb: This is the structure passed to the modify_ldt syscall.  Just so as
613    to confuse and annoy everyone, this is _not_ the same as an
614    VgLdtEntry and has to be translated into such.  The logic for doing
615    so, in vg_ldt.c, is copied from the kernel sources.]] */
616 struct vki_user_desc {
617         unsigned int  entry_number;
618         unsigned long base_addr;
619         unsigned int  limit;
620         unsigned int  seg_32bit:1;
621         unsigned int  contents:2;
622         unsigned int  read_exec_only:1;
623         unsigned int  limit_in_pages:1;
624         unsigned int  seg_not_present:1;
625         unsigned int  useable:1;
626         // [[Nb: this field is not in the kernel sources, but it has always
627         // been in the Valgrind sources so I will keep it there in case it's
628         // important... this is an x86-defined data structure so who
629         // knows;  maybe it's important to set this field to zero at some
630         // point.  --njn]]
631         unsigned int  reserved:25;
632 };
633
634 // [[Nb: for our convenience within Valgrind, use a more specific name]]
635 typedef struct vki_user_desc vki_modify_ldt_t;
636
637 //----------------------------------------------------------------------
638 // From linux-2.6.8.1/include/asm-i386/ipcbuf.h
639 //----------------------------------------------------------------------
640
641 struct vki_ipc64_perm
642 {
643         __vki_kernel_key_t      key;
644         __vki_kernel_uid32_t    uid;
645         __vki_kernel_gid32_t    gid;
646         __vki_kernel_uid32_t    cuid;
647         __vki_kernel_gid32_t    cgid;
648         __vki_kernel_mode_t     mode;
649         unsigned short          __pad1;
650         unsigned short          seq;
651         unsigned short          __pad2;
652         unsigned long           __unused1;
653         unsigned long           __unused2;
654 };
655
656 //----------------------------------------------------------------------
657 // From linux-2.6.8.1/include/asm-i386/sembuf.h
658 //----------------------------------------------------------------------
659
660 struct vki_semid64_ds {
661         struct vki_ipc64_perm sem_perm;         /* permissions .. see ipc.h */
662         __vki_kernel_time_t     sem_otime;              /* last semop time */
663         unsigned long   __unused1;
664         __vki_kernel_time_t     sem_ctime;              /* last change time */
665         unsigned long   __unused2;
666         unsigned long   sem_nsems;              /* no. of semaphores in array */
667         unsigned long   __unused3;
668         unsigned long   __unused4;
669 };
670
671 //----------------------------------------------------------------------
672 // From linux-2.6.8.1/include/asm-i386/msgbuf.h
673 //----------------------------------------------------------------------
674
675 struct vki_msqid64_ds {
676         struct vki_ipc64_perm msg_perm;
677         __vki_kernel_time_t msg_stime;  /* last msgsnd time */
678         unsigned long   __unused1;
679         __vki_kernel_time_t msg_rtime;  /* last msgrcv time */
680         unsigned long   __unused2;
681         __vki_kernel_time_t msg_ctime;  /* last change time */
682         unsigned long   __unused3;
683         unsigned long  msg_cbytes;      /* current number of bytes on queue */
684         unsigned long  msg_qnum;        /* number of messages in queue */
685         unsigned long  msg_qbytes;      /* max number of bytes on queue */
686         __vki_kernel_pid_t msg_lspid;   /* pid of last msgsnd */
687         __vki_kernel_pid_t msg_lrpid;   /* last receive pid */
688         unsigned long  __unused4;
689         unsigned long  __unused5;
690 };
691
692 //----------------------------------------------------------------------
693 // From linux-2.6.8.1/include/asm-i386/ipc.h
694 //----------------------------------------------------------------------
695
696 struct vki_ipc_kludge {
697         struct vki_msgbuf __user *msgp;
698         long msgtyp;
699 };
700
701 #define VKI_SEMOP                1
702 #define VKI_SEMGET               2
703 #define VKI_SEMCTL               3
704 #define VKI_SEMTIMEDOP           4
705 #define VKI_MSGSND              11
706 #define VKI_MSGRCV              12
707 #define VKI_MSGGET              13
708 #define VKI_MSGCTL              14
709 #define VKI_SHMAT               21
710 #define VKI_SHMDT               22
711 #define VKI_SHMGET              23
712 #define VKI_SHMCTL              24
713
714 //----------------------------------------------------------------------
715 // From linux-2.6.8.1/include/asm-i386/shmbuf.h
716 //----------------------------------------------------------------------
717
718 struct vki_shmid64_ds {
719         struct vki_ipc64_perm   shm_perm;       /* operation perms */
720         vki_size_t              shm_segsz;      /* size of segment (bytes) */
721         __vki_kernel_time_t     shm_atime;      /* last attach time */
722         unsigned long           __unused1;
723         __vki_kernel_time_t     shm_dtime;      /* last detach time */
724         unsigned long           __unused2;
725         __vki_kernel_time_t     shm_ctime;      /* last change time */
726         unsigned long           __unused3;
727         __vki_kernel_pid_t      shm_cpid;       /* pid of creator */
728         __vki_kernel_pid_t      shm_lpid;       /* pid of last operator */
729         unsigned long           shm_nattch;     /* no. of current attaches */
730         unsigned long           __unused4;
731         unsigned long           __unused5;
732 };
733
734 struct vki_shminfo64 {
735         unsigned long   shmmax;
736         unsigned long   shmmin;
737         unsigned long   shmmni;
738         unsigned long   shmseg;
739         unsigned long   shmall;
740         unsigned long   __unused1;
741         unsigned long   __unused2;
742         unsigned long   __unused3;
743         unsigned long   __unused4;
744 };
745
746 //----------------------------------------------------------------------
747 // DRM ioctls
748 //----------------------------------------------------------------------
749
750 // jrs 20050207: where did all this stuff come from?  Is it really
751 // i386 specific, or should it go into the linux-generic category?
752 //struct vki_drm_buf_pub {
753 //      Int               idx;         /**< Index into the master buffer list */
754 //      Int               total;       /**< Buffer size */
755 //      Int               used;        /**< Amount of buffer in use (for DMA) */
756 //      void      __user *address;     /**< Address of buffer */
757 //};
758 //
759 //struct vki_drm_buf_map {
760 //      Int           count;            /**< Length of the buffer list */
761 //      void          __user *virtual;  /**< Mmap'd area in user-virtual */
762 //      struct vki_drm_buf_pub __user *list;    /**< Buffer information */
763 //};
764 //
765 ///* We need to pay attention to this, because it mmaps memory */
766 //#define VKI_DRM_IOCTL_MAP_BUFS                _VKI_IOWR('d', 0x19, struct vki_drm_buf_map)
767
768 //----------------------------------------------------------------------
769 // From linux-2.6.9/include/asm-i386/ptrace.h
770 //----------------------------------------------------------------------
771
772 #define VKI_PTRACE_GETREGS            12
773 #define VKI_PTRACE_SETREGS            13
774 #define VKI_PTRACE_GETFPREGS          14
775 #define VKI_PTRACE_SETFPREGS          15
776 #define VKI_PTRACE_GETWMMXREGS        18
777 #define VKI_PTRACE_SETWMMXREGS        19
778 #define VKI_PTRACE_GET_THREAD_AREA    22
779 #define VKI_PTRACE_SET_SYSCALL        23
780 #define VKI_PTRACE_GETCRUNCHREGS      25
781 #define VKI_PTRACE_SETCRUNCHREGS      26
782 #define VKI_PTRACE_GETVFPREGS         27
783 #define VKI_PTRACE_SETVFPREGS         28
784 #define VKI_PTRACE_GETHBPREGS         29
785 #define VKI_PTRACE_SETHBPREGS         30
786
787 //----------------------------------------------------------------------
788 // From linux-2.6.15.4/include/asm-i386/vm86.h
789 //----------------------------------------------------------------------
790
791 #define VKI_VM86_PLUS_INSTALL_CHECK     0
792 #define VKI_VM86_ENTER                  1
793 #define VKI_VM86_ENTER_NO_BYPASS        2
794 #define VKI_VM86_REQUEST_IRQ            3
795 #define VKI_VM86_FREE_IRQ               4
796 #define VKI_VM86_GET_IRQ_BITS           5
797 #define VKI_VM86_GET_AND_RESET_IRQ      6
798
799 struct vki_vm86_regs {
800 /*
801  * normal regs, with special meaning for the segment descriptors..
802  */
803         long ebx;
804         long ecx;
805         long edx;
806         long esi;
807         long edi;
808         long ebp;
809         long eax;
810         long __null_ds;
811         long __null_es;
812         long __null_fs;
813         long __null_gs;
814         long orig_eax;
815         long eip;
816         unsigned short cs, __csh;
817         long eflags;
818         long esp;
819         unsigned short ss, __ssh;
820 /*
821  * these are specific to v86 mode:
822  */
823         unsigned short es, __esh;
824         unsigned short ds, __dsh;
825         unsigned short fs, __fsh;
826         unsigned short gs, __gsh;
827 };
828
829 struct vki_revectored_struct {
830         unsigned long __map[8];                 /* 256 bits */
831 };
832
833 struct vki_vm86_struct {
834         struct vki_vm86_regs regs;
835         unsigned long flags;
836         unsigned long screen_bitmap;
837         unsigned long cpu_type;
838         struct vki_revectored_struct int_revectored;
839         struct vki_revectored_struct int21_revectored;
840 };
841
842 struct vki_vm86plus_info_struct {
843         unsigned long force_return_for_pic:1;
844         unsigned long vm86dbg_active:1;       /* for debugger */
845         unsigned long vm86dbg_TFpendig:1;     /* for debugger */
846         unsigned long unused:28;
847         unsigned long is_vm86pus:1;           /* for vm86 internal use */
848         unsigned char vm86dbg_intxxtab[32];   /* for debugger */
849 };
850
851 struct vki_vm86plus_struct {
852         struct vki_vm86_regs regs;
853         unsigned long flags;
854         unsigned long screen_bitmap;
855         unsigned long cpu_type;
856         struct vki_revectored_struct int_revectored;
857         struct vki_revectored_struct int21_revectored;
858         struct vki_vm86plus_info_struct vm86plus;
859 };
860
861 //----------------------------------------------------------------------
862 // From linux-2.6.35.4/arch/arm/include/asm/hwcap.h
863 //----------------------------------------------------------------------
864
865 #define VKI_HWCAP_NEON      4096
866
867 //----------------------------------------------------------------------
868 // And that's it!
869 //----------------------------------------------------------------------
870
871 #endif // __VKI_ARM_LINUX_H
872
873 /*--------------------------------------------------------------------*/
874 /*--- end                                          vki-arm-linux.h ---*/
875 /*--------------------------------------------------------------------*/