njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Arch-specific stuff for the core. amd64/core_arch.h ---*/ |
| 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. |
njn | c616819 | 2004-11-29 13:54:10 +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 |
njn | c616819 | 2004-11-29 13:54:10 +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 __AMD64_CORE_ARCH_H |
| 32 | #define __AMD64_CORE_ARCH_H |
| 33 | |
| 34 | #include "core_arch_asm.h" // arch-specific asm stuff |
| 35 | #include "tool_arch.h" // arch-specific tool stuff |
| 36 | |
| 37 | #include "libvex_guest_amd64.h" |
| 38 | |
| 39 | /* --------------------------------------------------------------------- |
njn | 09aa128 | 2004-11-30 23:39:13 +0000 | [diff] [blame] | 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_X86_64 |
| 45 | #define VGA_ELF_CLASS ELFCLASS64 |
njn | 09aa128 | 2004-11-30 23:39:13 +0000 | [diff] [blame] | 46 | |
njn | 09aa128 | 2004-11-30 23:39:13 +0000 | [diff] [blame] | 47 | /* --------------------------------------------------------------------- |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 48 | Interesting registers |
| 49 | ------------------------------------------------------------------ */ |
| 50 | |
| 51 | // Vex field names |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 52 | #define VGA_INSTR_PTR guest_RIP |
| 53 | #define VGA_STACK_PTR guest_RSP |
| 54 | #define VGA_FRAME_PTR guest_RBP |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 55 | |
njn | 35172bc | 2005-03-26 00:04:03 +0000 | [diff] [blame] | 56 | #define VGA_CLREQ_ARGS guest_RAX |
| 57 | #define VGA_CLREQ_RET guest_RDX |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 58 | |
njn | c616819 | 2004-11-29 13:54:10 +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(rbp) (rbp) |
| 61 | #define VGA_STACK_FRAME_RET(rbp) (((UWord*)rbp)[1]) |
| 62 | #define VGA_STACK_FRAME_NEXT(rbp) (((UWord*)rbp)[0]) |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 63 | |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 64 | /* --------------------------------------------------------------------- |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 65 | Architecture-specific part of a ThreadState |
| 66 | ------------------------------------------------------------------ */ |
| 67 | |
| 68 | // Architecture-specific part of a ThreadState |
| 69 | // XXX: eventually this should be made abstract, ie. the fields not visible |
sewardj | 45f02c4 | 2005-02-05 18:27:14 +0000 | [diff] [blame] | 70 | // to the core... |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 71 | typedef |
| 72 | struct { |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 73 | /* --- BEGIN vex-mandated guest state --- */ |
| 74 | |
| 75 | /* Saved machine context. */ |
| 76 | VexGuestAMD64State vex; |
| 77 | |
| 78 | /* Saved shadow context. */ |
| 79 | VexGuestAMD64State 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 | |
| 88 | typedef VexGuestAMD64State VexGuestArchState; |
| 89 | |
| 90 | /* --------------------------------------------------------------------- |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 91 | Miscellaneous constants |
| 92 | ------------------------------------------------------------------ */ |
| 93 | |
sewardj | 4d89e30 | 2005-03-16 22:04:40 +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 | 4d89e30 | 2005-03-16 22:04:40 +0000 | [diff] [blame] | 96 | |
njn | c616819 | 2004-11-29 13:54:10 +0000 | [diff] [blame] | 97 | #endif // __AMD64_CORE_ARCH_H |
| 98 | |
| 99 | /*--------------------------------------------------------------------*/ |
| 100 | /*--- end ---*/ |
| 101 | /*--------------------------------------------------------------------*/ |
njn | 8095073 | 2005-03-26 00:18:45 +0000 | [diff] [blame] | 102 | |