sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- A header file defining structures and constants which are ---*/ |
| 4 | /*--- important at the kernel boundary for this platform. ---*/ |
| 5 | /*--- vg_kerneliface.h ---*/ |
| 6 | /*--------------------------------------------------------------------*/ |
| 7 | |
| 8 | /* |
njn | c953984 | 2002-10-02 13:26:35 +0000 | [diff] [blame] | 9 | This file is part of Valgrind, an extensible x86 protected-mode |
| 10 | emulator for monitoring program execution on x86-Unixes. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 11 | |
nethercote | bb1c991 | 2004-01-04 16:43:23 +0000 | [diff] [blame] | 12 | Copyright (C) 2000-2004 Julian Seward |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 13 | jseward@acm.org |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 14 | |
| 15 | This program is free software; you can redistribute it and/or |
| 16 | modify it under the terms of the GNU General Public License as |
| 17 | published by the Free Software Foundation; either version 2 of the |
| 18 | License, or (at your option) any later version. |
| 19 | |
| 20 | This program is distributed in the hope that it will be useful, but |
| 21 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | General Public License for more details. |
| 24 | |
| 25 | You should have received a copy of the GNU General Public License |
| 26 | along with this program; if not, write to the Free Software |
| 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 28 | 02111-1307, USA. |
| 29 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 30 | The GNU General Public License is contained in the file COPYING. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #ifndef __VG_KERNELIFACE_H |
| 34 | #define __VG_KERNELIFACE_H |
| 35 | |
| 36 | /* This file is ONLY to be included into vg_include.h. Do not include |
| 37 | it directly into valgrind source .c files. This file defines types |
| 38 | and constants for the kernel interface, and to make that clear |
| 39 | everything is prefixed VKI. */ |
| 40 | |
| 41 | /*--- All the following stuff is correct for Linux kernels 2.2.X and |
| 42 | 2.4.X. |
| 43 | ---*/ |
| 44 | |
| 45 | /* Should really get this from an include file somewhere. */ |
| 46 | #define VKI_BYTES_PER_PAGE_BITS 12 |
| 47 | #define VKI_BYTES_PER_PAGE (1 << VKI_BYTES_PER_PAGE_BITS) |
| 48 | |
| 49 | #define VKI_BYTES_PER_WORD 4 |
| 50 | #define VKI_WORDS_PER_PAGE (VKI_BYTES_PER_PAGE / VKI_BYTES_PER_WORD) |
| 51 | |
| 52 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 53 | /* An implementation of signal sets. These are the same as the sigset |
| 54 | implementations in the relevant Linux kernels. Note carefully that |
| 55 | this has nothing to do with glibc's signal sets. We work entirely |
| 56 | at the kernel boundary, so the libc stuff is invisible and |
| 57 | irrelevant. */ |
| 58 | |
| 59 | /* The following is copied from |
| 60 | /usr/src/linux-2.4.9-13/include/asm-i386/signal.h */ |
| 61 | #define VKI_KNSIG 64 /* true for linux 2.2.X and 2.4.X */ |
| 62 | #define VKI_KNSIG_BPW 32 /* since we're using UInts */ |
| 63 | #define VKI_KNSIG_WORDS (VKI_KNSIG / VKI_KNSIG_BPW) |
| 64 | |
| 65 | typedef |
| 66 | struct { |
| 67 | UInt ws[VKI_KNSIG_WORDS]; |
| 68 | } |
| 69 | vki_ksigset_t; |
| 70 | |
sewardj | b48e500 | 2002-05-13 00:16:03 +0000 | [diff] [blame] | 71 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 72 | typedef |
| 73 | struct { |
| 74 | void* ksa_handler; |
| 75 | unsigned long ksa_flags; |
| 76 | void (*ksa_restorer)(void); |
| 77 | vki_ksigset_t ksa_mask; |
| 78 | } |
| 79 | vki_ksigaction; |
| 80 | |
| 81 | typedef |
| 82 | struct { |
| 83 | void* ss_sp; |
| 84 | Int ss_flags; |
| 85 | UInt ss_size; |
| 86 | } |
| 87 | vki_kstack_t; |
| 88 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 89 | #define SI_MAX_SIZE 128 |
| 90 | #define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3) |
| 91 | |
| 92 | union vki_sigval { |
| 93 | Int sival_int; |
| 94 | void *sival_ptr; |
| 95 | }; |
| 96 | |
| 97 | typedef |
| 98 | struct { |
| 99 | Int si_signo; |
| 100 | Int si_errno; |
| 101 | Int si_code; |
| 102 | |
| 103 | union { |
| 104 | Int _pad[SI_PAD_SIZE]; |
| 105 | |
| 106 | /* kill() */ |
| 107 | struct { |
| 108 | Int _pid; /* sender's pid */ |
| 109 | Short _uid; /* sender's uid */ |
| 110 | } _kill; |
| 111 | |
| 112 | /* POSIX.1b timers */ |
| 113 | struct { |
| 114 | UInt _timer1; |
| 115 | UInt _timer2; |
| 116 | } _timer; |
| 117 | |
| 118 | /* POSIX.1b signals */ |
| 119 | struct { |
| 120 | Int _pid; /* sender's pid */ |
| 121 | UShort _uid; /* sender's uid */ |
| 122 | union vki_sigval _sigval; |
| 123 | } _rt; |
| 124 | |
| 125 | /* SIGCHLD */ |
| 126 | struct { |
| 127 | Int _pid; /* which child */ |
| 128 | UShort _uid; /* sender's uid */ |
| 129 | Int _status; /* exit code */ |
| 130 | Int _utime; |
| 131 | Int _stime; |
| 132 | } _sigchld; |
| 133 | |
| 134 | /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ |
| 135 | struct { |
| 136 | void *_addr; /* faulting insn/memory ref. */ |
| 137 | } _sigfault; |
| 138 | |
| 139 | /* SIGPOLL */ |
| 140 | struct { |
| 141 | Int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ |
| 142 | Int _fd; |
| 143 | } _sigpoll; |
| 144 | } _sifields; |
| 145 | } vki_ksiginfo_t; |
| 146 | |
| 147 | /* linux-2.6/include/asm-generic/siginfo.h */ |
| 148 | |
| 149 | #define VKI_SI_USER 0 |
| 150 | #define VKI_SI_QUEUE -1 |
| 151 | #define VKI_SI_TKILL -6 |
| 152 | |
| 153 | struct vki_fpreg { |
| 154 | UShort significand[4]; |
| 155 | UShort exponent; |
| 156 | }; |
| 157 | |
| 158 | struct vki_fpxreg { |
| 159 | UShort significand[4]; |
| 160 | UShort exponent; |
| 161 | UShort padding[3]; |
| 162 | }; |
| 163 | |
| 164 | struct vki_xmmreg { |
| 165 | UInt element[4]; |
| 166 | }; |
| 167 | |
| 168 | struct vki_fpstate { |
| 169 | /* Regular FPU environment */ |
| 170 | unsigned long cw; |
| 171 | unsigned long sw; |
| 172 | unsigned long tag; |
| 173 | unsigned long ipoff; |
| 174 | unsigned long cssel; |
| 175 | unsigned long dataoff; |
| 176 | unsigned long datasel; |
| 177 | struct vki_fpreg _st[8]; |
| 178 | unsigned short status; |
| 179 | unsigned short magic; /* 0xffff = regular FPU data only */ |
| 180 | |
| 181 | /* FXSR FPU environment */ |
| 182 | unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */ |
| 183 | unsigned long mxcsr; |
| 184 | unsigned long reserved; |
| 185 | struct vki_fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */ |
| 186 | struct vki_xmmreg _xmm[8]; |
| 187 | unsigned long padding[56]; |
| 188 | }; |
| 189 | |
| 190 | #define X86_FXSR_MAGIC 0x0000 |
| 191 | |
| 192 | struct vki_sigcontext { |
| 193 | UShort gs, __gsh; |
| 194 | UShort fs, __fsh; |
| 195 | UShort es, __esh; |
| 196 | UShort ds, __dsh; |
| 197 | UInt edi; |
| 198 | UInt esi; |
| 199 | UInt ebp; |
| 200 | UInt esp; |
| 201 | UInt ebx; |
| 202 | UInt edx; |
| 203 | UInt ecx; |
| 204 | UInt eax; |
| 205 | UInt trapno; |
| 206 | UInt err; |
| 207 | UInt eip; |
| 208 | UShort cs, __csh; |
| 209 | UInt eflags; |
| 210 | UInt esp_at_signal; |
| 211 | UShort ss, __ssh; |
| 212 | struct vki_fpstate * fpstate; |
| 213 | UInt oldmask; |
| 214 | UInt cr2; |
| 215 | }; |
| 216 | |
| 217 | struct vki_ucontext { |
| 218 | UInt uc_flags; |
| 219 | struct vki_ucontext *uc_link; |
| 220 | vki_kstack_t uc_stack; |
| 221 | struct vki_sigcontext uc_mcontext; |
| 222 | vki_ksigset_t uc_sigmask; /* mask last for extensibility */ |
| 223 | }; |
| 224 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 225 | |
sewardj | 2342c97 | 2002-05-22 23:34:20 +0000 | [diff] [blame] | 226 | /* sigaltstack controls */ |
| 227 | #define VKI_SS_ONSTACK 1 |
| 228 | #define VKI_SS_DISABLE 2 |
| 229 | |
| 230 | #define VKI_MINSIGSTKSZ 2048 |
| 231 | #define VKI_SIGSTKSZ 8192 |
| 232 | |
sewardj | b48e500 | 2002-05-13 00:16:03 +0000 | [diff] [blame] | 233 | |
| 234 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 235 | #define VKI_SIG_BLOCK 0 /* for blocking signals */ |
| 236 | #define VKI_SIG_UNBLOCK 1 /* for unblocking signals */ |
| 237 | #define VKI_SIG_SETMASK 2 /* for setting the signal mask */ |
| 238 | |
| 239 | #define VKI_SIG_DFL ((void*)0) /* default signal handling */ |
| 240 | #define VKI_SIG_IGN ((void*)1) /* ignore signal */ |
| 241 | #define VKI_SIG_ERR ((void*)-1) /* error return from signal */ |
| 242 | |
| 243 | #define VKI_SA_ONSTACK 0x08000000 |
| 244 | #define VKI_SA_RESTART 0x10000000 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 245 | #define VKI_SA_NOCLDSTOP 0x00000001 |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 246 | #define VKI_SA_SIGINFO 0x00000004 |
sewardj | 018f762 | 2002-05-15 21:13:39 +0000 | [diff] [blame] | 247 | #define VKI_SA_RESETHAND 0x80000000 |
| 248 | #define VKI_SA_ONESHOT VKI_SA_RESETHAND |
| 249 | #define VKI_SA_NODEFER 0x40000000 |
| 250 | #define VKI_SA_NOMASK VKI_SA_NODEFER |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 251 | #define VKI_SA_NOCLDWAIT 0x00000002 |
fitzhardinge | 4f10ada | 2004-06-03 10:00:42 +0000 | [diff] [blame] | 252 | #define VKI_SA_RESTORER 0x04000000 |
sewardj | 018f762 | 2002-05-15 21:13:39 +0000 | [diff] [blame] | 253 | #if 0 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 254 | #define VKI_SA_INTERRUPT 0x20000000 /* dummy -- ignored */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 255 | #endif |
| 256 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 257 | /* extra wait flags */ |
| 258 | #define VKI_WNOHANG 1 /* Don't block waiting. */ |
| 259 | #define VKI_WUNTRACED 2 /* Report status of stopped children. */ |
| 260 | #define VKI__WALL 0x40000000 /* Wait for any child. */ |
| 261 | #define VKI__WCLONE 0x80000000 /* Wait for cloned process. */ |
| 262 | |
| 263 | #define VKI_SIGHUP 1 /* Hangup (POSIX). */ |
| 264 | #define VKI_SIGINT 2 /* Interrupt (ANSI). */ |
| 265 | #define VKI_SIGQUIT 3 /* Quit (POSIX). */ |
| 266 | #define VKI_SIGILL 4 /* Illegal instruction (ANSI). */ |
| 267 | #define VKI_SIGTRAP 5 /* Trace trap (POSIX). */ |
| 268 | #define VKI_SIGABRT 6 /* Abort (ANSI). */ |
| 269 | #define VKI_SIGIOT 6 /* IOT trap (4.2 BSD). */ |
| 270 | #define VKI_SIGBUS 7 /* BUS error (4.2 BSD). */ |
| 271 | #define VKI_SIGFPE 8 /* Floating-point exception (ANSI). */ |
| 272 | #define VKI_SIGKILL 9 /* Kill, unblockable (POSIX). */ |
| 273 | #define VKI_SIGUSR1 10 /* User-defined signal 1 (POSIX). */ |
| 274 | #define VKI_SIGSEGV 11 /* Segmentation violation (ANSI). */ |
| 275 | #define VKI_SIGUSR2 12 /* User-defined signal 2 (POSIX). */ |
| 276 | #define VKI_SIGPIPE 13 /* Broken pipe (POSIX). */ |
| 277 | #define VKI_SIGALRM 14 /* Alarm clock (POSIX). */ |
| 278 | #define VKI_SIGTERM 15 /* Termination (ANSI). */ |
| 279 | #define VKI_SIGSTKFLT 16 /* Stack fault. */ |
| 280 | #define VKI_SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ |
| 281 | #define VKI_SIGCHLD 17 /* Child status has changed (POSIX). */ |
| 282 | #define VKI_SIGCONT 18 /* Continue (POSIX). */ |
| 283 | #define VKI_SIGSTOP 19 /* Stop, unblockable (POSIX). */ |
| 284 | #define VKI_SIGTSTP 20 /* Keyboard stop (POSIX). */ |
| 285 | #define VKI_SIGTTIN 21 /* Background read from tty (POSIX). */ |
| 286 | #define VKI_SIGTTOU 22 /* Background write to tty (POSIX). */ |
| 287 | #define VKI_SIGURG 23 /* Urgent condition on socket (4.2 BSD). */ |
| 288 | #define VKI_SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ |
| 289 | #define VKI_SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ |
| 290 | #define VKI_SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ |
| 291 | #define VKI_SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ |
| 292 | #define VKI_SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ |
| 293 | #define VKI_SIGPOLL SIGIO /* Pollable event occurred (System V). */ |
| 294 | #define VKI_SIGIO 29 /* I/O now possible (4.2 BSD). */ |
| 295 | #define VKI_SIGPWR 30 /* Power failure restart (System V). */ |
| 296 | #define VKI_SIGSYS 31 /* Bad system call. */ |
| 297 | #define VKI_SIGUNUSED 31 |
| 298 | |
| 299 | #define VKI_SIGRTMIN 32 |
| 300 | #define VKI_SIGRTMAX 63 |
| 301 | |
| 302 | #define VKI_SIGVGINT (VKI_SIGRTMIN+0) /* signal for internal use - interrupt */ |
| 303 | #define VKI_SIGVGKILL (VKI_SIGRTMIN+1) /* signal for internal use - kill */ |
| 304 | #define VKI_SIGRTUSERMIN (VKI_SIGRTMIN+2) /* first user-usable RT signal */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 305 | |
sewardj | 64039bb | 2002-06-03 00:58:18 +0000 | [diff] [blame] | 306 | /* The following are copied from include/asm-i386/mman.h .*/ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 307 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 308 | #define VKI_PROT_NONE 0x0 /* No page permissions */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 309 | #define VKI_PROT_READ 0x1 /* Page can be read. */ |
| 310 | #define VKI_PROT_WRITE 0x2 /* Page can be written. */ |
| 311 | #define VKI_PROT_EXEC 0x4 /* Page can be executed. */ |
| 312 | #define VKI_MAP_ANONYMOUS 0x20 /* Don't use a file. */ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 313 | #define VKI_MAP_SHARED 0x01 /* Share changes. */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 314 | #define VKI_MAP_PRIVATE 0x02 /* Changes are private. */ |
sewardj | 64039bb | 2002-06-03 00:58:18 +0000 | [diff] [blame] | 315 | #define VKI_MAP_FIXED 0x10 /* Interpret addr exactly */ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 316 | #define VKI_MAP_NOSYMS 0x40000000 /* internal pseudo-flag to disable symbol loading */ |
| 317 | #define VKI_MAP_CLIENT 0x80000000 /* internal pseudo-flag to distinguish client mappings */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 318 | |
fitzhardinge | 1a30304 | 2003-12-22 08:48:50 +0000 | [diff] [blame] | 319 | /* linux/mman.h */ |
| 320 | #define VKI_MREMAP_MAYMOVE 1 |
| 321 | #define VKI_MREMAP_FIXED 2 |
| 322 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 323 | /* Copied from linux-2.4.19/include/asm-i386/fcntl.h */ |
| 324 | |
sewardj | f912dfc | 2002-11-13 21:51:10 +0000 | [diff] [blame] | 325 | #define VKI_O_ACCMODE 0003 |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 326 | #define VKI_O_RDONLY 00 |
| 327 | #define VKI_O_WRONLY 01 |
| 328 | #define VKI_O_RDWR 02 |
| 329 | #define VKI_O_CREAT 0100 /* not fcntl */ |
| 330 | #define VKI_O_EXCL 0200 /* not fcntl */ |
| 331 | #define VKI_O_TRUNC 01000 /* not fcntl */ |
| 332 | #define VKI_O_APPEND 02000 |
| 333 | #define VKI_O_NONBLOCK 04000 |
| 334 | #define VKI_O_SYNC 010000 |
| 335 | #define VKI_FASYNC 020000 /* fcntl, for BSD compatibility */ |
| 336 | #define VKI_O_DIRECT 040000 /* direct disk access hint */ |
| 337 | #define VKI_O_LARGEFILE 0100000 |
| 338 | #define VKI_O_DIRECTORY 0200000 /* must be a directory */ |
| 339 | #define VKI_O_NOFOLLOW 0400000 /* don't follow links */ |
| 340 | |
rjwalsh | f5f536f | 2003-11-17 17:45:00 +0000 | [diff] [blame] | 341 | #define VKI_SEEK_SET 0 |
| 342 | #define VKI_SEEK_CUR 1 |
| 343 | #define VKI_SEEK_END 2 |
| 344 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 345 | /* Copied from linux-2.4.19/include/linux/stat.h */ |
| 346 | |
| 347 | #define VKI_S_IRWXU 00700 |
| 348 | #define VKI_S_IRUSR 00400 |
| 349 | #define VKI_S_IWUSR 00200 |
| 350 | #define VKI_S_IXUSR 00100 |
| 351 | |
| 352 | #define VKI_S_IRWXG 00070 |
| 353 | #define VKI_S_IRGRP 00040 |
| 354 | #define VKI_S_IWGRP 00020 |
| 355 | #define VKI_S_IXGRP 00010 |
| 356 | |
| 357 | #define VKI_S_IRWXO 00007 |
| 358 | #define VKI_S_IROTH 00004 |
| 359 | #define VKI_S_IWOTH 00002 |
| 360 | #define VKI_S_IXOTH 00001 |
| 361 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 362 | |
sewardj | 0ca2a6b | 2002-03-29 14:02:34 +0000 | [diff] [blame] | 363 | /* Copied from /usr/src/linux-2.4.9-13/include/asm/errno.h */ |
| 364 | |
sewardj | 2342c97 | 2002-05-22 23:34:20 +0000 | [diff] [blame] | 365 | #define VKI_EPERM 1 /* Operation not permitted */ |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 366 | #define VKI_ENOENT 2 /* No such file or directory */ |
sewardj | 018f762 | 2002-05-15 21:13:39 +0000 | [diff] [blame] | 367 | #define VKI_ESRCH 3 /* No such process */ |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 368 | #define VKI_EINTR 4 /* Interrupted system call */ |
| 369 | #define VKI_EBADF 9 /* Bad file number */ |
| 370 | #define VKI_ENOMEM 12 /* Out of memory */ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 371 | #define VKI_EWOULDBLOCK VKI_EAGAIN /* Operation would block */ |
| 372 | #define VKI_EAGAIN 11 /* Try again */ |
fitzhardinge | e1c06d8 | 2003-10-30 07:21:44 +0000 | [diff] [blame] | 373 | #define VKI_EACCES 13 /* Permission denied */ |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 374 | #define VKI_EFAULT 14 /* Bad address */ |
jsgf | f3c3f1a | 2003-10-14 22:13:28 +0000 | [diff] [blame] | 375 | #define VKI_EEXIST 17 /* File exists */ |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 376 | #define VKI_EINVAL 22 /* Invalid argument */ |
nethercote | 493dd18 | 2004-02-24 23:57:47 +0000 | [diff] [blame] | 377 | #define VKI_ENFILE 23 /* File table overflow */ |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 378 | #define VKI_EMFILE 24 /* Too many open files */ |
| 379 | #define VKI_ENOSYS 38 /* Function not implemented */ |
| 380 | |
fitzhardinge | a09a1b5 | 2003-11-07 23:09:48 +0000 | [diff] [blame] | 381 | #define VKI_ERESTARTSYS 512 /* Restart the syscall */ |
sewardj | 0ca2a6b | 2002-03-29 14:02:34 +0000 | [diff] [blame] | 382 | |
mueller | a4b153a | 2003-11-19 22:07:14 +0000 | [diff] [blame] | 383 | /* Copied from linux/isdn.h */ |
| 384 | |
| 385 | #define VKI_IIOCGETCPS _IO( 'I',21 ) |
| 386 | #define VKI_IIOCNETGPN _IO( 'I',34 ) |
| 387 | |
| 388 | #define ISDN_MSNLEN 32 |
| 389 | |
| 390 | typedef struct { |
| 391 | char name[ 10 ]; |
| 392 | char phone[ ISDN_MSNLEN ]; |
| 393 | int outgoing; |
| 394 | } isdn_net_ioctl_phone; |
| 395 | |
sewardj | 0ca2a6b | 2002-03-29 14:02:34 +0000 | [diff] [blame] | 396 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 397 | /* Gawd ... hack ... */ |
| 398 | |
| 399 | typedef struct vki__user_cap_header_struct { |
| 400 | UInt version; |
| 401 | int pid; |
| 402 | } vki_cap_user_header_t; |
| 403 | |
| 404 | typedef struct vki__user_cap_data_struct { |
| 405 | UInt effective; |
| 406 | UInt permitted; |
| 407 | UInt inheritable; |
| 408 | } vki_cap_user_data_t; |
| 409 | |
| 410 | |
| 411 | /* "Byrial Jensen" <byrial@image.dk> says: |
| 412 | [various] ioctls take a pointer to a "struct |
| 413 | termios" but this is another and shorter "struct |
| 414 | termios" than the one defined in <termios.h> and used |
| 415 | by tcgetattr(3) and tcsetattr(3) and other library |
| 416 | functions. GNU libc translate between its library |
| 417 | termios and the kernel termios. |
| 418 | */ |
| 419 | |
| 420 | #define VKI_SIZEOF_STRUCT_TERMIOS 36 |
| 421 | |
sewardj | 2f0de32 | 2002-03-24 10:17:25 +0000 | [diff] [blame] | 422 | /* Adam Gundy <arg@cyberscience.com>, 20 Mar 2002, says: */ |
| 423 | #define VKI_SIZEOF_STRUCT_TERMIO 17 |
| 424 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 425 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 426 | /* File descriptor sets, for doing select(). Copied from |
| 427 | /usr/src/linux-2.4.9-31/include/linux/posix_types.h |
| 428 | */ |
| 429 | /* |
| 430 | * This allows for 1024 file descriptors: if NR_OPEN is ever grown |
| 431 | * beyond that you'll have to change this too. But 1024 fd's seem to be |
| 432 | * enough even for such "real" unices like OSF/1, so hopefully this is |
| 433 | * one limit that doesn't have to be changed [again]. |
| 434 | * |
| 435 | * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in |
| 436 | * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical |
| 437 | * place for them. Solved by having dummy defines in <sys/time.h>. |
| 438 | */ |
| 439 | |
| 440 | /* |
| 441 | * Those macros may have been defined in <gnu/types.h>. But we always |
| 442 | * use the ones here. |
| 443 | */ |
| 444 | #undef VKI_NFDBITS |
| 445 | #define VKI_NFDBITS (8 * sizeof(unsigned long)) |
| 446 | |
| 447 | #undef VKI_FD_SETSIZE |
| 448 | #define VKI_FD_SETSIZE 1024 |
| 449 | |
| 450 | #undef VKI_FDSET_LONGS |
| 451 | #define VKI_FDSET_LONGS (VKI_FD_SETSIZE/VKI_NFDBITS) |
| 452 | |
| 453 | #undef VKI_FDELT |
| 454 | #define VKI_FDELT(d) ((d) / VKI_NFDBITS) |
| 455 | |
| 456 | #undef VKI_FDMASK |
| 457 | #define VKI_FDMASK(d) (1UL << ((d) % VKI_NFDBITS)) |
| 458 | |
| 459 | typedef struct { |
| 460 | unsigned long vki_fds_bits [VKI_FDSET_LONGS]; |
| 461 | } vki_fd_set; |
| 462 | |
| 463 | |
| 464 | /* Gawd ... |
| 465 | Copied from /usr/src/linux-2.4.9-31/./include/asm-i386/posix_types.h |
| 466 | */ |
| 467 | #undef VKI_FD_SET |
| 468 | #define VKI_FD_SET(fd,fdsetp) \ |
| 469 | __asm__ __volatile__("btsl %1,%0": \ |
| 470 | "=m" (*(vki_fd_set *) (fdsetp)):"r" ((int) (fd))) |
| 471 | |
| 472 | #undef VKI_FD_CLR |
| 473 | #define VKI_FD_CLR(fd,fdsetp) \ |
| 474 | __asm__ __volatile__("btrl %1,%0": \ |
| 475 | "=m" (*(vki_fd_set *) (fdsetp)):"r" ((int) (fd))) |
| 476 | |
| 477 | #undef VKI_FD_ISSET |
| 478 | #define VKI_FD_ISSET(fd,fdsetp) (__extension__ ({ \ |
| 479 | unsigned char __result; \ |
| 480 | __asm__ __volatile__("btl %1,%2 ; setb %0" \ |
| 481 | :"=q" (__result) :"r" ((int) (fd)), \ |
| 482 | "m" (*(vki_fd_set *) (fdsetp))); \ |
| 483 | __result; })) |
| 484 | |
| 485 | #undef VKI_FD_ZERO |
| 486 | #define VKI_FD_ZERO(fdsetp) \ |
| 487 | do { \ |
| 488 | int __d0, __d1; \ |
| 489 | __asm__ __volatile__("cld ; rep ; stosl" \ |
| 490 | :"=m" (*(vki_fd_set *) (fdsetp)), \ |
| 491 | "=&c" (__d0), "=&D" (__d1) \ |
| 492 | :"a" (0), "1" (VKI_FDSET_LONGS), \ |
| 493 | "2" ((vki_fd_set *) (fdsetp)) : "memory"); \ |
| 494 | } while (0) |
| 495 | |
| 496 | |
| 497 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 498 | struct vki_pollfd { |
| 499 | Int fd; |
| 500 | Short events; |
| 501 | Short revents; |
| 502 | }; |
| 503 | |
| 504 | /* asm/poll.h */ |
| 505 | #define VKI_POLLIN 0x0001 |
| 506 | #define VKI_POLLPRI 0x0002 |
| 507 | #define VKI_POLLOUT 0x0004 |
| 508 | #define VKI_POLLERR 0x0008 |
| 509 | #define VKI_POLLHUP 0x0010 |
| 510 | #define VKI_POLLNVAL 0x0020 |
| 511 | |
| 512 | |
nethercote | 9af69b3 | 2004-02-10 23:44:15 +0000 | [diff] [blame] | 513 | /* sys/epoll.h */ |
| 514 | typedef union vki_epoll_data { |
| 515 | void *ptr; |
| 516 | Int fd; |
| 517 | UInt u32; |
| 518 | ULong u64; |
| 519 | } vki_epoll_data_t; |
| 520 | |
| 521 | struct vki_epoll_event { |
| 522 | UInt events; /* Epoll events */ |
| 523 | vki_epoll_data_t data; /* User data variable */ |
| 524 | }; |
| 525 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 526 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 527 | /* |
| 528 | ./include/asm-i386/posix_types.h:typedef long __kernel_suseconds_t; |
| 529 | ./include/linux/types.h:typedef __kernel_suseconds_t suseconds_t; |
| 530 | |
| 531 | ./include/asm-i386/posix_types.h:typedef long __kernel_time_t; |
| 532 | ./include/linux/types.h:typedef __kernel_time_t time_t; |
| 533 | */ |
| 534 | |
| 535 | struct vki_timeval { |
| 536 | /* time_t */ long tv_sec; /* seconds */ |
| 537 | /* suseconds_t */ long tv_usec; /* microseconds */ |
| 538 | }; |
| 539 | |
| 540 | |
| 541 | |
| 542 | /* For fcntl on fds .. |
| 543 | from ./include/asm-i386/fcntl.h */ |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 544 | #define VKI_F_DUPFD 0 /* dup */ |
| 545 | #define VKI_F_GETFD 1 /* get close_on_exec */ |
| 546 | #define VKI_F_SETFD 2 /* set/clear close_on_exec */ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 547 | #define VKI_F_GETFL 3 /* get file->f_flags */ |
| 548 | #define VKI_F_SETFL 4 /* set file->f_flags */ |
| 549 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 550 | /* for F_[GET|SET]FL */ |
| 551 | #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */ |
| 552 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 553 | #define VKI_O_NONBLOCK 04000 |
| 554 | |
| 555 | /* For nanosleep ... |
| 556 | from ./include/linux/time.h */ |
| 557 | struct vki_timespec { |
| 558 | /* time_t */ long tv_sec; /* seconds */ |
| 559 | long tv_nsec; /* nanoseconds */ |
| 560 | }; |
| 561 | |
| 562 | |
sewardj | b358620 | 2002-05-09 17:38:13 +0000 | [diff] [blame] | 563 | /* STAT stuff |
| 564 | from /usr/src/linux-2.4.9-31/include/asm-i386/stat.h */ |
| 565 | struct vki_stat { |
| 566 | unsigned short st_dev; |
| 567 | unsigned short __pad1; |
| 568 | unsigned long st_ino; |
| 569 | unsigned short st_mode; |
| 570 | unsigned short st_nlink; |
| 571 | unsigned short st_uid; |
| 572 | unsigned short st_gid; |
| 573 | unsigned short st_rdev; |
| 574 | unsigned short __pad2; |
| 575 | unsigned long st_size; |
| 576 | unsigned long st_blksize; |
| 577 | unsigned long st_blocks; |
| 578 | unsigned long st_atime; |
| 579 | unsigned long __unused1; |
| 580 | unsigned long st_mtime; |
| 581 | unsigned long __unused2; |
| 582 | unsigned long st_ctime; |
| 583 | unsigned long __unused3; |
| 584 | unsigned long __unused4; |
| 585 | unsigned long __unused5; |
| 586 | }; |
| 587 | |
| 588 | |
sewardj | b48e500 | 2002-05-13 00:16:03 +0000 | [diff] [blame] | 589 | /* To do with the ELF frame constructed by the kernel on a process' |
| 590 | stack just before it transfers control to the program's interpreter |
| 591 | (to use the ELF parlance). |
sewardj | a1679dd | 2002-05-10 22:31:40 +0000 | [diff] [blame] | 592 | Constants from /usr/src/linux-2.4.9-31/include/linux/elf.h |
| 593 | Logic from /usr/src/linux-2.4.9-31/fs/binfmt_elf.c |
| 594 | and its counterpart in the 2.2.14 kernel sources |
sewardj | b48e500 | 2002-05-13 00:16:03 +0000 | [diff] [blame] | 595 | in Red Hat 6.2. */ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 596 | #define VKI_AT_NULL 0 |
sewardj | d5815ec | 2003-04-06 12:23:27 +0000 | [diff] [blame] | 597 | #define VKI_AT_SYSINFO 32 /* address of system info page */ |
sewardj | a1679dd | 2002-05-10 22:31:40 +0000 | [diff] [blame] | 598 | #define VKI_AT_CLKTCK 17 /* frequency at which times() increments */ |
| 599 | #define VKI_AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ |
| 600 | #define VKI_AT_BASE 7 /* base address of interpreter */ |
| 601 | #define VKI_AT_PAGESZ 6 /* system page size */ |
| 602 | #define VKI_AT_PHNUM 5 /* number of program headers */ |
| 603 | #define VKI_AT_PHENT 4 /* size of program header entry */ |
| 604 | #define VKI_AT_PHDR 3 /* program headers for program */ |
sewardj | ce61d05 | 2002-07-25 00:49:51 +0000 | [diff] [blame] | 605 | #define VKI_AT_USER_AUX_SEGMENT 23 /* tell glibc what address segment |
| 606 | 0x3B points to. (Needed for |
| 607 | Red Hat Limbo, 7.3.92) */ |
sewardj | a1679dd | 2002-05-10 22:31:40 +0000 | [diff] [blame] | 608 | |
sewardj | a83005f | 2002-06-13 16:07:51 +0000 | [diff] [blame] | 609 | /* Including <linux/module.h> leads to loads of hassle because then we |
| 610 | need <asm/atomic.h> sometimes (RedHat 7.3) and that is a |
| 611 | kernel-only header which deliberately #errors on gcc-3.1. Mucho |
| 612 | hassle considering that we only want to know sizeof(struct module). |
| 613 | Hence ... |
| 614 | |
| 615 | #include <stdio.h> |
| 616 | #include <asm/atomic.h> |
| 617 | #include <linux/module.h> |
| 618 | |
| 619 | int main ( void ) |
| 620 | { |
| 621 | printf ("sizeof(struct module) = %d\n", sizeof(struct module) ); |
| 622 | return 0; |
| 623 | } |
| 624 | */ |
| 625 | |
| 626 | #define VKI_SIZEOF_STRUCT_MODULE 96 |
sewardj | a1679dd | 2002-05-10 22:31:40 +0000 | [diff] [blame] | 627 | |
sewardj | 92a5956 | 2002-09-30 00:53:10 +0000 | [diff] [blame] | 628 | |
| 629 | /* This is the structure passed to the modify_ldt syscall. Just so as |
| 630 | to confuse and annoy everyone, this is _not_ the same as an |
| 631 | VgLdtEntry and has to be translated into such. The logic for doing |
| 632 | so, in vg_ldt.c, is copied from the kernel sources. */ |
| 633 | /* |
| 634 | * ldt.h |
| 635 | * |
| 636 | * Definitions of structures used with the modify_ldt system call. |
| 637 | */ |
| 638 | typedef struct vki_modify_ldt_ldt_s { |
| 639 | unsigned int entry_number; |
| 640 | unsigned long base_addr; |
| 641 | unsigned int limit; |
| 642 | unsigned int seg_32bit:1; |
| 643 | unsigned int contents:2; |
| 644 | unsigned int read_exec_only:1; |
| 645 | unsigned int limit_in_pages:1; |
| 646 | unsigned int seg_not_present:1; |
| 647 | unsigned int useable:1; |
fitzhardinge | 47735af | 2004-01-21 01:27:27 +0000 | [diff] [blame] | 648 | unsigned int reserved:25; |
sewardj | 92a5956 | 2002-09-30 00:53:10 +0000 | [diff] [blame] | 649 | } vki_modify_ldt_t; |
| 650 | |
| 651 | #define VKI_MODIFY_LDT_CONTENTS_DATA 0 |
| 652 | #define VKI_MODIFY_LDT_CONTENTS_STACK 1 |
| 653 | #define VKI_MODIFY_LDT_CONTENTS_CODE 2 |
| 654 | |
fitzhardinge | 47735af | 2004-01-21 01:27:27 +0000 | [diff] [blame] | 655 | #define VKI_GDT_TLS_ENTRIES 3 |
| 656 | #define VKI_GDT_TLS_MIN 6 |
| 657 | #define VKI_GDT_TLS_MAX (VKI_GDT_TLS_MIN + VKI_GDT_TLS_ENTRIES) |
sewardj | 92a5956 | 2002-09-30 00:53:10 +0000 | [diff] [blame] | 658 | |
jsgf | 855d93d | 2003-10-13 22:26:55 +0000 | [diff] [blame] | 659 | /* Flags for clone() */ |
| 660 | /* linux/sched.h */ |
| 661 | #define VKI_CSIGNAL 0x000000ff /* signal mask to be sent at exit */ |
| 662 | #define VKI_CLONE_VM 0x00000100 /* set if VM shared between processes */ |
| 663 | #define VKI_CLONE_FS 0x00000200 /* set if fs info shared between processes */ |
| 664 | #define VKI_CLONE_FILES 0x00000400 /* set if open files shared between processes */ |
| 665 | #define VKI_CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */ |
| 666 | #define VKI_CLONE_IDLETASK 0x00001000 /* set if new pid should be 0 (kernel only)*/ |
| 667 | #define VKI_CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ |
| 668 | #define VKI_CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ |
| 669 | #define VKI_CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ |
| 670 | #define VKI_CLONE_THREAD 0x00010000 /* Same thread group? */ |
| 671 | #define VKI_CLONE_NEWNS 0x00020000 /* New namespace group? */ |
| 672 | #define VKI_CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
| 673 | #define VKI_CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ |
| 674 | #define VKI_CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ |
| 675 | #define VKI_CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ |
| 676 | #define VKI_CLONE_DETACHED 0x00400000 /* parent wants no child-exit signal */ |
| 677 | #define VKI_CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force VKI_CLONE_PTRACE on this clone */ |
| 678 | #define VKI_CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ |
sewardj | 92a5956 | 2002-09-30 00:53:10 +0000 | [diff] [blame] | 679 | |
rjwalsh | f5f536f | 2003-11-17 17:45:00 +0000 | [diff] [blame] | 680 | /* This is the structure passed to the getdents syscall. */ |
| 681 | /* |
| 682 | * linux/dirent.h |
| 683 | */ |
| 684 | typedef struct vki_dirent { |
| 685 | long d_ino; |
| 686 | long d_off; |
| 687 | unsigned short d_reclen; |
| 688 | char d_name[256]; |
| 689 | } vki_dirent; |
| 690 | |
| 691 | |
| 692 | |
| 693 | /* This is the structure passed to the getrlimit syscall. */ |
| 694 | /* |
| 695 | * bits/resource.h |
| 696 | */ |
| 697 | typedef struct vki_rlimit { |
| 698 | unsigned long rlim_cur; |
| 699 | unsigned long rlim_max; |
| 700 | } vki_rlimit; |
| 701 | |
fitzhardinge | b50068f | 2004-02-24 23:42:55 +0000 | [diff] [blame] | 702 | #define VKI_RLIMIT_CPU 0 /* CPU time in ms */ |
| 703 | #define VKI_RLIMIT_FSIZE 1 /* Maximum filesize */ |
| 704 | #define VKI_RLIMIT_DATA 2 /* max data size */ |
| 705 | #define VKI_RLIMIT_STACK 3 /* max stack size */ |
| 706 | #define VKI_RLIMIT_CORE 4 /* max core file size */ |
| 707 | #define VKI_RLIMIT_RSS 5 /* max resident set size */ |
| 708 | #define VKI_RLIMIT_NPROC 6 /* max number of processes */ |
| 709 | #define VKI_RLIMIT_NOFILE 7 /* max number of open files */ |
| 710 | #define VKI_RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */ |
| 711 | #define VKI_RLIMIT_AS 9 /* address space limit */ |
| 712 | #define VKI_RLIMIT_LOCKS 10 /* maximum file locks held */ |
rjwalsh | f5f536f | 2003-11-17 17:45:00 +0000 | [diff] [blame] | 713 | |
| 714 | /* Socket stuff. */ |
| 715 | /* |
| 716 | * sys/socket.h |
| 717 | */ |
| 718 | typedef unsigned short vki_sa_family_t; |
| 719 | struct vki_sockaddr { |
| 720 | vki_sa_family_t sa_family; /* Address family. */ |
| 721 | char sa_data[14]; /* Address data. */ |
| 722 | }; |
| 723 | |
mueller | a48f792 | 2003-11-19 16:54:52 +0000 | [diff] [blame] | 724 | /* statfs structs */ |
| 725 | /* |
| 726 | * bits/statfs.h |
| 727 | */ |
rjwalsh | f5f536f | 2003-11-17 17:45:00 +0000 | [diff] [blame] | 728 | |
thughes | 66d8009 | 2004-06-19 12:41:05 +0000 | [diff] [blame] | 729 | struct vki_statfs { |
mueller | a48f792 | 2003-11-19 16:54:52 +0000 | [diff] [blame] | 730 | unsigned int f_type; |
| 731 | unsigned int f_bsize; |
| 732 | unsigned int f_blocks; |
| 733 | unsigned int f_bfree; |
| 734 | unsigned int f_bavail; |
| 735 | unsigned int f_files; |
| 736 | unsigned int f_ffree; |
| 737 | int f_fsid[ 2 ]; |
| 738 | unsigned int f_namelen; |
| 739 | unsigned int f_frsize; |
| 740 | unsigned int f_spare[5]; |
| 741 | }; |
| 742 | |
thughes | 66d8009 | 2004-06-19 12:41:05 +0000 | [diff] [blame] | 743 | struct vki_statfs64 { |
mueller | a48f792 | 2003-11-19 16:54:52 +0000 | [diff] [blame] | 744 | unsigned int f_type; |
| 745 | unsigned int f_bsize; |
| 746 | unsigned long long f_blocks; |
| 747 | unsigned long long f_bfree; |
| 748 | unsigned long long f_bavail; |
| 749 | unsigned long long f_files; |
| 750 | unsigned long long f_ffree; |
| 751 | int f_fsid[ 2 ]; |
| 752 | unsigned int f_namelen; |
| 753 | unsigned int f_frsize; |
| 754 | unsigned int f_spare[5]; |
| 755 | }; |
| 756 | |
fitzhardinge | 47735af | 2004-01-21 01:27:27 +0000 | [diff] [blame] | 757 | /* |
| 758 | * linux/futex.h |
| 759 | */ |
| 760 | |
| 761 | #define VKI_FUTEX_WAIT 0 |
| 762 | #define VKI_FUTEX_WAKE 1 |
| 763 | #define VKI_FUTEX_FD 2 |
| 764 | #define VKI_FUTEX_REQUEUE 3 |
| 765 | |
fitzhardinge | d65dcad | 2004-03-13 02:06:58 +0000 | [diff] [blame] | 766 | /* |
| 767 | * linux/elfcore.h |
| 768 | */ |
| 769 | |
| 770 | struct elf_siginfo |
| 771 | { |
| 772 | int si_signo; /* signal number */ |
| 773 | int si_code; /* extra code */ |
| 774 | int si_errno; /* errno */ |
| 775 | }; |
| 776 | |
| 777 | /* |
| 778 | * This is the old layout of "struct pt_regs", and |
| 779 | * is still the layout used by user mode (the new |
| 780 | * pt_regs doesn't have all registers as the kernel |
| 781 | * doesn't use the extra segment registers) |
| 782 | */ |
| 783 | struct user_regs_struct { |
| 784 | long ebx, ecx, edx, esi, edi, ebp, eax; |
| 785 | unsigned short ds, __ds, es, __es; |
| 786 | unsigned short fs, __fs, gs, __gs; |
| 787 | long orig_eax, eip; |
| 788 | unsigned short cs, __cs; |
| 789 | long eflags, esp; |
| 790 | unsigned short ss, __ss; |
| 791 | }; |
| 792 | |
| 793 | struct user_i387_struct { |
| 794 | long cwd; |
| 795 | long swd; |
| 796 | long twd; |
| 797 | long fip; |
| 798 | long fcs; |
| 799 | long foo; |
| 800 | long fos; |
| 801 | long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ |
| 802 | }; |
| 803 | |
| 804 | struct user_fxsr_struct { |
| 805 | unsigned short cwd; |
| 806 | unsigned short swd; |
| 807 | unsigned short twd; |
| 808 | unsigned short fop; |
| 809 | long fip; |
| 810 | long fcs; |
| 811 | long foo; |
| 812 | long fos; |
| 813 | long mxcsr; |
| 814 | long reserved; |
| 815 | long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ |
| 816 | long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ |
| 817 | long padding[56]; |
| 818 | }; |
| 819 | |
| 820 | typedef unsigned long elf_greg_t; |
| 821 | |
| 822 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) |
| 823 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
| 824 | |
| 825 | typedef struct user_i387_struct elf_fpregset_t; |
| 826 | typedef struct user_fxsr_struct elf_fpxregset_t; |
| 827 | |
| 828 | |
| 829 | /* |
| 830 | * Definitions to generate Intel SVR4-like core files. |
| 831 | * These mostly have the same names as the SVR4 types with "elf_" |
| 832 | * tacked on the front to prevent clashes with linux definitions, |
| 833 | * and the typedef forms have been avoided. This is mostly like |
| 834 | * the SVR4 structure, but more Linuxy, with things that Linux does |
| 835 | * not support and which gdb doesn't really use excluded. |
| 836 | * Fields present but not used are marked with "XXX". |
| 837 | */ |
| 838 | struct elf_prstatus |
| 839 | { |
| 840 | #if 0 |
| 841 | long pr_flags; /* XXX Process flags */ |
| 842 | short pr_why; /* XXX Reason for process halt */ |
| 843 | short pr_what; /* XXX More detailed reason */ |
| 844 | #endif |
| 845 | struct elf_siginfo pr_info; /* Info associated with signal */ |
| 846 | short pr_cursig; /* Current signal */ |
| 847 | unsigned long pr_sigpend; /* Set of pending signals */ |
| 848 | unsigned long pr_sighold; /* Set of held signals */ |
| 849 | #if 0 |
| 850 | struct sigaltstack pr_altstack; /* Alternate stack info */ |
| 851 | struct sigaction pr_action; /* Signal action for current sig */ |
| 852 | #endif |
| 853 | Int pr_pid; |
| 854 | Int pr_ppid; |
| 855 | Int pr_pgrp; |
| 856 | Int pr_sid; |
| 857 | struct vki_timeval pr_utime; /* User time */ |
| 858 | struct vki_timeval pr_stime; /* System time */ |
| 859 | struct vki_timeval pr_cutime; /* Cumulative user time */ |
| 860 | struct vki_timeval pr_cstime; /* Cumulative system time */ |
| 861 | #if 0 |
| 862 | long pr_instr; /* Current instruction */ |
| 863 | #endif |
| 864 | elf_gregset_t pr_reg; /* GP registers */ |
| 865 | int pr_fpvalid; /* True if math co-processor being used. */ |
| 866 | }; |
| 867 | |
| 868 | #define ELF_PRARGSZ (80) /* Number of chars for args */ |
| 869 | |
| 870 | struct elf_prpsinfo |
| 871 | { |
| 872 | char pr_state; /* numeric process state */ |
| 873 | char pr_sname; /* char for pr_state */ |
| 874 | char pr_zomb; /* zombie */ |
| 875 | char pr_nice; /* nice val */ |
| 876 | unsigned long pr_flag; /* flags */ |
| 877 | Int pr_uid; |
| 878 | Int pr_gid; |
| 879 | Int pr_pid, pr_ppid, pr_pgrp, pr_sid; |
| 880 | /* Lots missing */ |
| 881 | char pr_fname[16]; /* filename of executable */ |
| 882 | char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ |
| 883 | }; |
mueller | a48f792 | 2003-11-19 16:54:52 +0000 | [diff] [blame] | 884 | |
| 885 | #endif /* __VG_KERNELIFACE_H */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 886 | |
| 887 | /*--------------------------------------------------------------------*/ |
| 888 | /*--- end vg_kerneliface.h ---*/ |
| 889 | /*--------------------------------------------------------------------*/ |