From: Nicholas Nethercote Date: Tue, 26 Oct 2004 11:18:32 +0000 (+0000) Subject: Arch-abstraction: X-Git-Tag: svn/VALGRIND_3_0_0~1450 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70a543e5a1305e07fbfe3b57743752c19a04e5d4;p=thirdparty%2Fvalgrind.git Arch-abstraction: - move some asm things into x86/ - also added a check at the start of init_tt_tc() to make sure that VG_CODE_OFFSET is correct. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2846 --- diff --git a/coregrind/core_asm.h b/coregrind/core_asm.h index 5d43ffd289..c222152474 100644 --- a/coregrind/core_asm.h +++ b/coregrind/core_asm.h @@ -54,29 +54,6 @@ #define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */ #define VG_TRC_UNRESUMABLE_SIGNAL 37 /* TRC only; got sigsegv/sigbus */ -/* maximum number of normal jumps which can appear in a basic block */ -#define VG_MAX_JUMPS 2 - -/* Offset of code in a TCEntry */ -#define VG_CODE_OFFSET (8 + VG_MAX_JUMPS * 2) - -/* Client address space segment limit descriptor entry */ -#define VG_POINTERCHECK_SEGIDX 1 - -/* Debugging hack for assembly code ... sigh. */ -#if 0 -#define OYNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal -#else -#define OYNK(nnn) -#endif - -#if 0 -#define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal -#else -#define OYNNK(nnn) -#endif - - /* Constants for the fast translation lookup cache. */ #define VG_TT_FAST_BITS 15 #define VG_TT_FAST_SIZE (1 << VG_TT_FAST_BITS) @@ -88,6 +65,7 @@ /* Assembly code stubs make this request */ #define VG_USERREQ__SIGNAL_RETURNS 0x4001 +// XXX: all this will go into x86/ eventually... /* 0 - standard feature flags 1 - Intel extended flags @@ -152,7 +130,7 @@ #define VG_AMD_FEAT_3DNOWEXT (VG_AMD_FEAT*32 + 30) #define VG_AMD_FEAT_3DNOW (VG_AMD_FEAT*32 + 31) -#endif /* ndef __CORE_ASM_H */ +#endif /* __CORE_ASM_H */ /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/coregrind/vg_transtab.c b/coregrind/vg_transtab.c index 6640bc2f76..a6b7779bb5 100644 --- a/coregrind/vg_transtab.c +++ b/coregrind/vg_transtab.c @@ -707,6 +707,9 @@ void VG_(init_tt_tc) ( void ) TCEntries. */ vg_assert((VG_MAX_JUMPS % 2) == 0); + // Otherwise lots of things go wrong... + vg_assert(VG_CODE_OFFSET == sizeof(TCEntry)); + /* Figure out how big each sector should be. */ vg_tc_sector_szB = (VG_TT_LIMIT /* max TT entries we expect */ diff --git a/coregrind/x86/Makefile.am b/coregrind/x86/Makefile.am index 11d131baea..91aff9f146 100644 --- a/coregrind/x86/Makefile.am +++ b/coregrind/x86/Makefile.am @@ -6,7 +6,8 @@ AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g noinst_HEADERS = \ core_arch.h \ core_arch_asm.h \ - x86_private.h + x86_private.h \ + x86_private_asm.h noinst_LIBRARIES = libarch.a diff --git a/coregrind/x86/core_arch_asm.h b/coregrind/x86/core_arch_asm.h index dfb16ac847..0f932f6f3c 100644 --- a/coregrind/x86/core_arch_asm.h +++ b/coregrind/x86/core_arch_asm.h @@ -36,6 +36,26 @@ /* size of jmp instruction which overwrites the call */ #define VG_PATCHME_JMPSZ 5 +/* maximum number of normal jumps which can appear in a basic block */ +#define VG_MAX_JUMPS 2 + +/* Offset of code in a TCEntry */ +#define VG_CODE_OFFSET (8 + VG_MAX_JUMPS * 2) + +/* Debugging hack for assembly code ... sigh. */ +#if 0 +#define OYNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal +#else +#define OYNK(nnn) +#endif + +#if 0 +#define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal +#else +#define OYNNK(nnn) +#endif + + #endif // __X86_CORE_ARCH_ASM_H /*--------------------------------------------------------------------*/ diff --git a/coregrind/x86/x86_private.h b/coregrind/x86/x86_private.h index ec8df1c0a4..e307d8cba6 100644 --- a/coregrind/x86/x86_private.h +++ b/coregrind/x86/x86_private.h @@ -32,6 +32,7 @@ #define __X86_PRIVATE_H #include "core_arch_asm.h" // arch-specific asm stuff +#include "x86_private_asm.h" // private arch-specific asm stuff #include "tool_arch.h" // arch-specific tool stuff /* --------------------------------------------------------------------- diff --git a/coregrind/x86/x86_private_asm.h b/coregrind/x86/x86_private_asm.h new file mode 100644 index 0000000000..f3ab91ab36 --- /dev/null +++ b/coregrind/x86/x86_private_asm.h @@ -0,0 +1,41 @@ + +/*--------------------------------------------------------------------*/ +/*--- Private x86 specific header. x86/x86_private_asm.h ---*/ +/*--------------------------------------------------------------------*/ + +/* + This file is part of Valgrind, an extensible x86 protected-mode + emulator for monitoring program execution on x86-Unixes. + + Copyright (C) 2000-2004 Nicholas Nethercote + njn25@cam.ac.uk + + 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; either version 2 of the + License, or (at your option) any later version. + + 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. See the GNU + General Public License for more details. + + 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. + + The GNU General Public License is contained in the file COPYING. +*/ + +#ifndef __X86_PRIVATE_ASM_H +#define __X86_PRIVATE_ASM_H + +/* Client address space segment limit descriptor entry */ +#define VG_POINTERCHECK_SEGIDX 1 + +#endif // __X86_PRIVATE_ASM_H + +/*--------------------------------------------------------------------*/ +/*--- end ---*/ +/*--------------------------------------------------------------------*/