]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Arch-abstraction:
authorNicholas Nethercote <n.nethercote@gmail.com>
Tue, 26 Oct 2004 11:18:32 +0000 (11:18 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Tue, 26 Oct 2004 11:18:32 +0000 (11:18 +0000)
- 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

coregrind/core_asm.h
coregrind/vg_transtab.c
coregrind/x86/Makefile.am
coregrind/x86/core_arch_asm.h
coregrind/x86/x86_private.h
coregrind/x86/x86_private_asm.h [new file with mode: 0644]

index 5d43ffd289ec2cfed5061c7d462655f731595388..c2221524748abd261094c24cd88b11753c9976d1 100644 (file)
 #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
 #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                                                          ---*/
index 6640bc2f764d135c987a439b5d33d8e7b4e463ea..a6b7779bb5c47fe9dce8782fd937bf6f9c873d87 100644 (file)
@@ -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 */
index 11d131baeae07b2cebc21983798d859b83df61c2..91aff9f14697445a7b7d201aa64753ba65f19868 100644 (file)
@@ -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
 
index dfb16ac8471aa6024b0b68b439e03392fb043d56..0f932f6f3cf34d32bc3043831db71414408fcefa 100644 (file)
 /* 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
 
 /*--------------------------------------------------------------------*/
index ec8df1c0a417168e31bf9515e8f9abc624e69932..e307d8cba6b4d6c4e65d4debb5c15e31198dc327 100644 (file)
@@ -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 (file)
index 0000000..f3ab91a
--- /dev/null
@@ -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                                                          ---*/
+/*--------------------------------------------------------------------*/