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 | |
nethercote | 86c5dcb | 2004-09-05 21:32:37 +0000 | [diff] [blame] | 59 | // Stack frame layout and linkage |
njn | db9b773 | 2005-03-26 00:32:29 +0000 | [diff] [blame] | 60 | #define VGA_FIRST_STACK_FRAME(ebp) (ebp) |
| 61 | #define VGA_STACK_FRAME_RET(ebp) (((UInt*)ebp)[1]) |
| 62 | #define VGA_STACK_FRAME_NEXT(ebp) (((UInt*)ebp)[0]) |
nethercote | 86c5dcb | 2004-09-05 21:32:37 +0000 | [diff] [blame] | 63 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 64 | //extern const Char VG_(helper_wrapper_before)[]; /* in dispatch.S */ |
| 65 | //extern const Char VG_(helper_wrapper_return)[]; /* in dispatch.S */ |
| 66 | |
| 67 | //extern const Char VG_(helper_undefined_instruction)[]; |
| 68 | //extern const Char VG_(helper_INT)[]; |
| 69 | //extern const Char VG_(helper_breakpoint)[]; |
| 70 | |
| 71 | |
nethercote | 2e05c33 | 2004-09-06 16:43:37 +0000 | [diff] [blame] | 72 | /* --------------------------------------------------------------------- |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 73 | Architecture-specific part of a ThreadState |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 74 | ------------------------------------------------------------------ */ |
| 75 | |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 76 | typedef |
| 77 | struct { |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 78 | /* --- BEGIN vex-mandated guest state --- */ |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 79 | |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 80 | /* Saved machine context. */ |
| 81 | VexGuestX86State vex; |
| 82 | |
| 83 | /* Saved shadow context. */ |
| 84 | VexGuestX86State vex_shadow; |
| 85 | |
| 86 | /* Spill area. */ |
| 87 | UChar vex_spill[LibVEX_N_SPILL_BYTES]; |
| 88 | |
| 89 | /* --- END vex-mandated guest state --- */ |
| 90 | } |
| 91 | ThreadArchState; |
| 92 | |
njn | cf45fd4 | 2004-11-24 16:30:22 +0000 | [diff] [blame] | 93 | typedef VexGuestX86State VexGuestArchState; |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 94 | |
nethercote | 9b3c765 | 2004-10-19 13:18:00 +0000 | [diff] [blame] | 95 | /* --------------------------------------------------------------------- |
nethercote | 2513064 | 2004-10-18 14:08:16 +0000 | [diff] [blame] | 96 | Miscellaneous constants |
nethercote | b24cbc8 | 2004-09-03 23:25:33 +0000 | [diff] [blame] | 97 | ------------------------------------------------------------------ */ |
| 98 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 99 | // Valgrind's stack size, in words. |
njn | 8095073 | 2005-03-26 00:18:45 +0000 | [diff] [blame] | 100 | #define VGA_STACK_SIZE_W 16384 |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 101 | |
nethercote | c06e213 | 2004-09-03 13:45:29 +0000 | [diff] [blame] | 102 | #endif // __X86_CORE_ARCH_H |
| 103 | |
| 104 | /*--------------------------------------------------------------------*/ |
| 105 | /*--- end ---*/ |
| 106 | /*--------------------------------------------------------------------*/ |