From: Nicholas Nethercote Date: Tue, 30 Nov 2004 15:56:47 +0000 (+0000) Subject: Added AMD64 skeleton, just defining LibVEX_GuestAMD64_initialise(). X-Git-Tag: svn/VALGRIND_3_0_1^2~733 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45357238cd9a381eff08210a7c24504253355205;p=thirdparty%2Fvalgrind.git Added AMD64 skeleton, just defining LibVEX_GuestAMD64_initialise(). git-svn-id: svn://svn.valgrind.org/vex/trunk@601 --- diff --git a/VEX/Makefile b/VEX/Makefile index 5824ff4b1e..bed2d78e4a 100644 --- a/VEX/Makefile +++ b/VEX/Makefile @@ -26,6 +26,7 @@ LIB_OBJS = priv/ir/irdefs.o \ priv/host-generic/h_generic_regs.o \ priv/host-generic/reg_alloc2.o \ priv/guest-x86/ghelpers.o \ + priv/guest-amd64/ghelpers.o \ priv/guest-arm/ghelpers.o \ priv/guest-x86/toIR.o \ priv/guest-arm/toIR.o @@ -125,6 +126,10 @@ priv/guest-x86/ghelpers.o: $(ALL_HEADERS) priv/guest-x86/ghelpers.c $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest-x86/ghelpers.o \ -c priv/guest-x86/ghelpers.c +priv/guest-amd64/ghelpers.o: $(ALL_HEADERS) priv/guest-amd64/ghelpers.c + $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest-amd64/ghelpers.o \ + -c priv/guest-amd64/ghelpers.c + priv/guest-arm/ghelpers.o: $(ALL_HEADERS) priv/guest-arm/ghelpers.c $(CC) $(CCFLAGS) $(ALL_INCLUDES) -o priv/guest-arm/ghelpers.o \ -c priv/guest-arm/ghelpers.c diff --git a/VEX/priv/guest-amd64/ghelpers.c b/VEX/priv/guest-amd64/ghelpers.c new file mode 100644 index 0000000000..cca2764a08 --- /dev/null +++ b/VEX/priv/guest-amd64/ghelpers.c @@ -0,0 +1,84 @@ + +/*---------------------------------------------------------------*/ +/*--- ---*/ +/*--- This file (guest-amd64/ghelpers.c) is ---*/ +/*--- Copyright (c) 2004 OpenWorks LLP. All rights reserved. ---*/ +/*--- ---*/ +/*---------------------------------------------------------------*/ + +/* + This file is part of LibVEX, a library for dynamic binary + instrumentation and translation. + + Copyright (C) 2004 OpenWorks, LLP. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; Version 2 dated June 1991 of the + license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or liability + for damages. See the GNU General Public License for more details. + + Neither the names of the U.S. Department of Energy nor the + University of California nor the names of its contributors may be + used to endorse or promote products derived from this software + without prior written permission. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +*/ + +#include "libvex_basictypes.h" +#include "libvex_emwarn.h" +#include "libvex_guest_amd64.h" +#include "libvex_ir.h" +#include "libvex.h" + +#include "main/vex_util.h" +//#include "guest-amd64/gdefs.h" // put back in when that file is added + + +/* VISIBLE TO LIBVEX CLIENT */ +void LibVEX_GuestAMD64_initialise ( /*OUT*/VexGuestAMD64State* vex_state ) +{ + //Int i; + + vex_state->guest_RAX = 0; + vex_state->guest_RCX = 0; + vex_state->guest_RDX = 0; + vex_state->guest_RBX = 0; + vex_state->guest_RSP = 0; + vex_state->guest_RBP = 0; + vex_state->guest_RSI = 0; + vex_state->guest_RDI = 0; + vex_state->guest_R8 = 0; + vex_state->guest_R9 = 0; + vex_state->guest_R10 = 0; + vex_state->guest_R11 = 0; + vex_state->guest_R12 = 0; + vex_state->guest_R13 = 0; + vex_state->guest_R14 = 0; + vex_state->guest_R15 = 0; + + vex_state->guest_CC_OP = 999;//X86G_CC_OP_COPY; // XXX ??? + vex_state->guest_CC_DEP1 = 0; + vex_state->guest_CC_DEP2 = 0; + vex_state->guest_CC_NDEP = 0; + + // XXX: add more here later, for D/ID flags + + vex_state->guest_RIP = 0; + + // XXX: add more here later, for segment registers, FPU, etc. + + vex_state->guest_EMWARN = EmWarn_NONE; +} + +/*---------------------------------------------------------------*/ +/*--- end guest-amd64/ghelpers.c ---*/ +/*---------------------------------------------------------------*/ diff --git a/VEX/pub/libvex_guest_amd64.h b/VEX/pub/libvex_guest_amd64.h index 35aa26de05..b70c681c9c 100644 --- a/VEX/pub/libvex_guest_amd64.h +++ b/VEX/pub/libvex_guest_amd64.h @@ -89,14 +89,14 @@ typedef /*--- Utility functions for amd64 guest stuff. ---*/ /*---------------------------------------------------------------*/ -#if 0 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ /* Initialise all guest x86 state. The FPU is put in default mode. */ extern -void LibVEX_GuestX86_initialise ( /*OUT*/VexGuestX86State* vex_state ); +void LibVEX_GuestAMD64_initialise ( /*OUT*/VexGuestAMD64State* vex_state ); +#if 0 /* Convert a saved x87 FPU image (as created by fsave) and write it into the supplied VexGuestX86State structure. The non-FP parts of said structure are left unchanged.