nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 3 | /*--- Arch-specific stuff for the core. x86/core_arch.h ---*/ |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 4 | /*--------------------------------------------------------------------*/ |
| 5 | |
| 6 | /* |
njn | b9c427c | 2004-12-01 14:14:42 +0000 | [diff] [blame] | 7 | This file is part of Valgrind, a dynamic binary instrumentation |
| 8 | framework. |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 9 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame] | 10 | Copyright (C) 2000-2005 Nicholas Nethercote |
njn | 2bc1012 | 2005-05-08 02:10:27 +0000 | [diff] [blame] | 11 | njn@valgrind.org |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 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 __X86_CORE_ARCH_H |
| 32 | #define __X86_CORE_ARCH_H |
| 33 | |
| 34 | #include "core_arch_asm.h" // arch-specific asm stuff |
| 35 | #include "tool_arch.h" // arch-specific tool stuff |
| 36 | |
sewardj | 8b635a4 | 2004-11-22 19:01:47 +0000 | [diff] [blame] | 37 | #include "libvex_guest_x86.h" |
| 38 | |
njn | 09aa128 | 2004-11-30 23:39:13 +0000 | [diff] [blame] | 39 | /* --------------------------------------------------------------------- |
| 40 | Basic properties |
| 41 | ------------------------------------------------------------------ */ |
| 42 | |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 43 | #define VGA_ELF_ENDIANNESS ELFDATA2LSB |
| 44 | #define VGA_ELF_MACHINE EM_386 |
| 45 | #define VGA_ELF_CLASS ELFCLASS32 |
njn | 09aa128 | 2004-11-30 23:39:13 +0000 | [diff] [blame] | 46 | |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 47 | /* --------------------------------------------------------------------- |
nethercote | 86c5dcb | 2004-09-05 21:32:37 +0000 | [diff] [blame] | 48 | Interesting registers |
| 49 | ------------------------------------------------------------------ */ |
| 50 | |
njn | cf45fd4 | 2004-11-24 16:30:22 +0000 | [diff] [blame] | 51 | // Vex field names |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 52 | #define VGA_INSTR_PTR guest_EIP |
| 53 | #define VGA_STACK_PTR guest_ESP |
| 54 | #define VGA_FRAME_PTR guest_EBP |
sewardj | 8b635a4 | 2004-11-22 19:01:47 +0000 | [diff] [blame] | 55 | |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 56 | #define VGA_CLREQ_ARGS guest_EAX |
| 57 | #define VGA_CLREQ_RET guest_EDX |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 58 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 59 | //extern const Char VG_(helper_wrapper_before)[]; /* in dispatch.S */ |
| 60 | //extern const Char VG_(helper_wrapper_return)[]; /* in dispatch.S */ |
| 61 | |
| 62 | //extern const Char VG_(helper_undefined_instruction)[]; |
| 63 | //extern const Char VG_(helper_INT)[]; |
| 64 | //extern const Char VG_(helper_breakpoint)[]; |
| 65 | |
| 66 | |
nethercote | 2e05c33 | 2004-09-06 16:43:37 +0000 | [diff] [blame] | 67 | /* --------------------------------------------------------------------- |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 68 | Architecture-specific part of a ThreadState |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 69 | ------------------------------------------------------------------ */ |
| 70 | |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 71 | typedef |
| 72 | struct { |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 73 | /* --- BEGIN vex-mandated guest state --- */ |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 74 | |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 75 | /* Saved machine context. */ |
| 76 | VexGuestX86State vex; |
| 77 | |
| 78 | /* Saved shadow context. */ |
| 79 | VexGuestX86State vex_shadow; |
| 80 | |
| 81 | /* Spill area. */ |
| 82 | UChar vex_spill[LibVEX_N_SPILL_BYTES]; |
| 83 | |
| 84 | /* --- END vex-mandated guest state --- */ |
| 85 | } |
| 86 | ThreadArchState; |
| 87 | |
njn | cf45fd4 | 2004-11-24 16:30:22 +0000 | [diff] [blame] | 88 | typedef VexGuestX86State VexGuestArchState; |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 89 | |
nethercote | 9b3c765 | 2004-10-19 13:18:00 +0000 | [diff] [blame] | 90 | /* --------------------------------------------------------------------- |
nethercote | 2513064 | 2004-10-18 14:08:16 +0000 | [diff] [blame] | 91 | Miscellaneous constants |
nethercote | b24cbc8 | 2004-09-03 23:25:33 +0000 | [diff] [blame] | 92 | ------------------------------------------------------------------ */ |
| 93 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 94 | // Valgrind's stack size, in words. |
njn | 8095073 | 2005-03-26 00:18:45 +0000 | [diff] [blame] | 95 | #define VGA_STACK_SIZE_W 16384 |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 96 | |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 97 | #endif // __X86_CORE_ARCH_H |
| 98 | |
| 99 | /*--------------------------------------------------------------------*/ |
| 100 | /*--- end ---*/ |
| 101 | /*--------------------------------------------------------------------*/ |