blob: c14ad6d6ed759410f7e982197fd3492f5d7f1033 [file] [log] [blame]
njnc6168192004-11-29 13:54:10 +00001
2/*--------------------------------------------------------------------*/
3/*--- Arch-specific stuff for the core. amd64/core_arch.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
njnb9c427c2004-12-01 14:14:42 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
njnc6168192004-11-29 13:54:10 +00009
njn53612422005-03-12 16:22:54 +000010 Copyright (C) 2000-2005 Nicholas Nethercote
njn2bc10122005-05-08 02:10:27 +000011 njn@valgrind.org
njnc6168192004-11-29 13:54:10 +000012
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/* ---------------------------------------------------------------------
njn09aa1282004-11-30 23:39:13 +000040 Basic properties
41 ------------------------------------------------------------------ */
42
njn35172bc2005-03-26 00:04:03 +000043#define VGA_ELF_ENDIANNESS ELFDATA2LSB
44#define VGA_ELF_MACHINE EM_X86_64
45#define VGA_ELF_CLASS ELFCLASS64
njn09aa1282004-11-30 23:39:13 +000046
njn09aa1282004-11-30 23:39:13 +000047/* ---------------------------------------------------------------------
njnc6168192004-11-29 13:54:10 +000048 Interesting registers
49 ------------------------------------------------------------------ */
50
51// Vex field names
njn35172bc2005-03-26 00:04:03 +000052#define VGA_INSTR_PTR guest_RIP
53#define VGA_STACK_PTR guest_RSP
54#define VGA_FRAME_PTR guest_RBP
njnc6168192004-11-29 13:54:10 +000055
njn35172bc2005-03-26 00:04:03 +000056#define VGA_CLREQ_ARGS guest_RAX
57#define VGA_CLREQ_RET guest_RDX
njnc6168192004-11-29 13:54:10 +000058
njnc6168192004-11-29 13:54:10 +000059// Stack frame layout and linkage
njndb9b7732005-03-26 00:32:29 +000060#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])
njnc6168192004-11-29 13:54:10 +000063
njnc6168192004-11-29 13:54:10 +000064/* ---------------------------------------------------------------------
njnc6168192004-11-29 13:54:10 +000065 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
sewardj45f02c42005-02-05 18:27:14 +000070// to the core...
njnc6168192004-11-29 13:54:10 +000071typedef
72 struct {
njnc6168192004-11-29 13:54:10 +000073 /* --- 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
88typedef VexGuestAMD64State VexGuestArchState;
89
90/* ---------------------------------------------------------------------
njnc6168192004-11-29 13:54:10 +000091 Miscellaneous constants
92 ------------------------------------------------------------------ */
93
sewardj4d89e302005-03-16 22:04:40 +000094// Valgrind's stack size, in words.
njn80950732005-03-26 00:18:45 +000095#define VGA_STACK_SIZE_W 16384
sewardj4d89e302005-03-16 22:04:40 +000096
njnc6168192004-11-29 13:54:10 +000097#endif // __AMD64_CORE_ARCH_H
98
99/*--------------------------------------------------------------------*/
100/*--- end ---*/
101/*--------------------------------------------------------------------*/
njn80950732005-03-26 00:18:45 +0000102