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