blob: dad5515bb0e37ac205227a1da91a3e24540f0109 [file] [log] [blame]
nethercotec06e2132004-09-03 13:45:29 +00001
2/*--------------------------------------------------------------------*/
njnc6168192004-11-29 13:54:10 +00003/*--- Arch-specific stuff for the core. x86/core_arch.h ---*/
nethercotec06e2132004-09-03 13:45:29 +00004/*--------------------------------------------------------------------*/
5
6/*
njnb9c427c2004-12-01 14:14:42 +00007 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
nethercotec06e2132004-09-03 13:45:29 +00009
njn53612422005-03-12 16:22:54 +000010 Copyright (C) 2000-2005 Nicholas Nethercote
njn2bc10122005-05-08 02:10:27 +000011 njn@valgrind.org
nethercotec06e2132004-09-03 13:45:29 +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 __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
sewardj8b635a42004-11-22 19:01:47 +000037#include "libvex_guest_x86.h"
38
njn09aa1282004-11-30 23:39:13 +000039/* ---------------------------------------------------------------------
40 Basic properties
41 ------------------------------------------------------------------ */
42
njn35172bc2005-03-26 00:04:03 +000043#define VGA_ELF_ENDIANNESS ELFDATA2LSB
44#define VGA_ELF_MACHINE EM_386
45#define VGA_ELF_CLASS ELFCLASS32
njn09aa1282004-11-30 23:39:13 +000046
nethercotec06e2132004-09-03 13:45:29 +000047/* ---------------------------------------------------------------------
nethercote86c5dcb2004-09-05 21:32:37 +000048 Interesting registers
49 ------------------------------------------------------------------ */
50
njncf45fd42004-11-24 16:30:22 +000051// Vex field names
njn35172bc2005-03-26 00:04:03 +000052#define VGA_INSTR_PTR guest_EIP
53#define VGA_STACK_PTR guest_ESP
54#define VGA_FRAME_PTR guest_EBP
sewardj8b635a42004-11-22 19:01:47 +000055
njn35172bc2005-03-26 00:04:03 +000056#define VGA_CLREQ_ARGS guest_EAX
57#define VGA_CLREQ_RET guest_EDX
sewardjb5f6f512005-03-10 23:59:00 +000058
nethercote86c5dcb2004-09-05 21:32:37 +000059// Stack frame layout and linkage
njndb9b7732005-03-26 00:32:29 +000060#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])
nethercote86c5dcb2004-09-05 21:32:37 +000063
sewardjb5f6f512005-03-10 23:59:00 +000064//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
nethercote2e05c332004-09-06 16:43:37 +000072/* ---------------------------------------------------------------------
sewardj2a99cf62004-11-24 10:44:19 +000073 Architecture-specific part of a ThreadState
nethercotec06e2132004-09-03 13:45:29 +000074 ------------------------------------------------------------------ */
75
sewardj2a99cf62004-11-24 10:44:19 +000076typedef
77 struct {
sewardj2a99cf62004-11-24 10:44:19 +000078 /* --- BEGIN vex-mandated guest state --- */
nethercotec06e2132004-09-03 13:45:29 +000079
sewardj2a99cf62004-11-24 10:44:19 +000080 /* 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
njncf45fd42004-11-24 16:30:22 +000093typedef VexGuestX86State VexGuestArchState;
nethercotec06e2132004-09-03 13:45:29 +000094
nethercote9b3c7652004-10-19 13:18:00 +000095/* ---------------------------------------------------------------------
nethercote25130642004-10-18 14:08:16 +000096 Miscellaneous constants
nethercoteb24cbc82004-09-03 23:25:33 +000097 ------------------------------------------------------------------ */
98
sewardjb5f6f512005-03-10 23:59:00 +000099// Valgrind's stack size, in words.
njn80950732005-03-26 00:18:45 +0000100#define VGA_STACK_SIZE_W 16384
sewardjb5f6f512005-03-10 23:59:00 +0000101
nethercotec06e2132004-09-03 13:45:29 +0000102#endif // __X86_CORE_ARCH_H
103
104/*--------------------------------------------------------------------*/
105/*--- end ---*/
106/*--------------------------------------------------------------------*/