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 | /* |
| 9 | This file is part of Valgrind, an x86 protected-mode emulator |
| 10 | designed for debugging and profiling binaries on x86-Unixes. |
| 11 | |
| 12 | Copyright (C) 2000-2002 Julian Seward |
| 13 | jseward@acm.org |
| 14 | Julian_Seward@muraroa.demon.co.uk |
| 15 | |
| 16 | This program is free software; you can redistribute it and/or |
| 17 | modify it under the terms of the GNU General Public License as |
| 18 | published by the Free Software Foundation; either version 2 of the |
| 19 | License, or (at your option) any later version. |
| 20 | |
| 21 | This program is distributed in the hope that it will be useful, but |
| 22 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 24 | General Public License for more details. |
| 25 | |
| 26 | You should have received a copy of the GNU General Public License |
| 27 | along with this program; if not, write to the Free Software |
| 28 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 29 | 02111-1307, USA. |
| 30 | |
| 31 | The GNU General Public License is contained in the file LICENSE. |
| 32 | */ |
| 33 | |
| 34 | #ifndef __VG_KERNELIFACE_H |
| 35 | #define __VG_KERNELIFACE_H |
| 36 | |
| 37 | /* This file is ONLY to be included into vg_include.h. Do not include |
| 38 | it directly into valgrind source .c files. This file defines types |
| 39 | and constants for the kernel interface, and to make that clear |
| 40 | everything is prefixed VKI. */ |
| 41 | |
| 42 | /*--- All the following stuff is correct for Linux kernels 2.2.X and |
| 43 | 2.4.X. |
| 44 | ---*/ |
| 45 | |
| 46 | /* Should really get this from an include file somewhere. */ |
| 47 | #define VKI_BYTES_PER_PAGE_BITS 12 |
| 48 | #define VKI_BYTES_PER_PAGE (1 << VKI_BYTES_PER_PAGE_BITS) |
| 49 | |
| 50 | #define VKI_BYTES_PER_WORD 4 |
| 51 | #define VKI_WORDS_PER_PAGE (VKI_BYTES_PER_PAGE / VKI_BYTES_PER_WORD) |
| 52 | |
| 53 | |
| 54 | /* For system call numbers __NR_... */ |
| 55 | #include <asm/unistd.h> |
| 56 | |
| 57 | /* An implementation of signal sets. These are the same as the sigset |
| 58 | implementations in the relevant Linux kernels. Note carefully that |
| 59 | this has nothing to do with glibc's signal sets. We work entirely |
| 60 | at the kernel boundary, so the libc stuff is invisible and |
| 61 | irrelevant. */ |
| 62 | |
| 63 | /* The following is copied from |
| 64 | /usr/src/linux-2.4.9-13/include/asm-i386/signal.h */ |
| 65 | #define VKI_KNSIG 64 /* true for linux 2.2.X and 2.4.X */ |
| 66 | #define VKI_KNSIG_BPW 32 /* since we're using UInts */ |
| 67 | #define VKI_KNSIG_WORDS (VKI_KNSIG / VKI_KNSIG_BPW) |
| 68 | |
| 69 | typedef |
| 70 | struct { |
| 71 | UInt ws[VKI_KNSIG_WORDS]; |
| 72 | } |
| 73 | vki_ksigset_t; |
| 74 | |
| 75 | typedef |
| 76 | struct { |
| 77 | void* ksa_handler; |
| 78 | unsigned long ksa_flags; |
| 79 | void (*ksa_restorer)(void); |
| 80 | vki_ksigset_t ksa_mask; |
| 81 | } |
| 82 | vki_ksigaction; |
| 83 | |
| 84 | typedef |
| 85 | struct { |
| 86 | void* ss_sp; |
| 87 | Int ss_flags; |
| 88 | UInt ss_size; |
| 89 | } |
| 90 | vki_kstack_t; |
| 91 | |
| 92 | |
| 93 | #define VKI_SIG_BLOCK 0 /* for blocking signals */ |
| 94 | #define VKI_SIG_UNBLOCK 1 /* for unblocking signals */ |
| 95 | #define VKI_SIG_SETMASK 2 /* for setting the signal mask */ |
| 96 | |
| 97 | #define VKI_SIG_DFL ((void*)0) /* default signal handling */ |
| 98 | #define VKI_SIG_IGN ((void*)1) /* ignore signal */ |
| 99 | #define VKI_SIG_ERR ((void*)-1) /* error return from signal */ |
| 100 | |
| 101 | #define VKI_SA_ONSTACK 0x08000000 |
| 102 | #define VKI_SA_RESTART 0x10000000 |
| 103 | #if 0 |
| 104 | #define VKI_SA_NOCLDSTOP 0x00000001 |
| 105 | #define VKI_SA_NOCLDWAIT 0x00000002 /* not supported yet */ |
| 106 | #define VKI_SA_SIGINFO 0x00000004 |
| 107 | #define VKI_SA_NODEFER 0x40000000 |
| 108 | #define VKI_SA_RESETHAND 0x80000000 |
| 109 | #define VKI_SA_NOMASK SA_NODEFER |
| 110 | #define VKI_SA_ONESHOT SA_RESETHAND |
| 111 | #define VKI_SA_INTERRUPT 0x20000000 /* dummy -- ignored */ |
| 112 | #define VKI_SA_RESTORER 0x04000000 |
| 113 | #endif |
| 114 | |
| 115 | #define VKI_SIGABRT 6 |
| 116 | #define VKI_SIGSEGV 11 |
| 117 | #define VKI_SIGBUS 7 |
| 118 | #define VKI_SIGILL 4 |
| 119 | #define VKI_SIGFPE 8 |
| 120 | #define VKI_SIGKILL 9 |
| 121 | #define VKI_SIGABRT 6 |
| 122 | #define VKI_SIGSTOP 19 |
| 123 | #define VKI_SIGTERM 15 |
| 124 | |
| 125 | /* The following are copied from /usr/include/bits/mman.h, which in |
| 126 | turn claims to have got them from the kernel headers. */ |
| 127 | |
| 128 | #define VKI_PROT_READ 0x1 /* Page can be read. */ |
| 129 | #define VKI_PROT_WRITE 0x2 /* Page can be written. */ |
| 130 | #define VKI_PROT_EXEC 0x4 /* Page can be executed. */ |
| 131 | #define VKI_MAP_ANONYMOUS 0x20 /* Don't use a file. */ |
| 132 | #define VKI_MAP_PRIVATE 0x02 /* Changes are private. */ |
| 133 | |
| 134 | |
| 135 | /* Gawd ... hack ... */ |
| 136 | |
| 137 | typedef struct vki__user_cap_header_struct { |
| 138 | UInt version; |
| 139 | int pid; |
| 140 | } vki_cap_user_header_t; |
| 141 | |
| 142 | typedef struct vki__user_cap_data_struct { |
| 143 | UInt effective; |
| 144 | UInt permitted; |
| 145 | UInt inheritable; |
| 146 | } vki_cap_user_data_t; |
| 147 | |
| 148 | |
| 149 | /* "Byrial Jensen" <byrial@image.dk> says: |
| 150 | [various] ioctls take a pointer to a "struct |
| 151 | termios" but this is another and shorter "struct |
| 152 | termios" than the one defined in <termios.h> and used |
| 153 | by tcgetattr(3) and tcsetattr(3) and other library |
| 154 | functions. GNU libc translate between its library |
| 155 | termios and the kernel termios. |
| 156 | */ |
| 157 | |
| 158 | #define VKI_SIZEOF_STRUCT_TERMIOS 36 |
| 159 | |
| 160 | |
| 161 | #endif /* ndef __VG_KERNELIFACE_H */ |
| 162 | |
| 163 | /*--------------------------------------------------------------------*/ |
| 164 | /*--- end vg_kerneliface.h ---*/ |
| 165 | /*--------------------------------------------------------------------*/ |