Arch-abstraction:
- moved a lot of the baseBlock initialisation into x86/, including all the
  VGOFF variables, and all the x86 asm helper functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2668 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/core.h b/coregrind/core.h
index 51467ad..e51242d 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -1280,6 +1280,10 @@
 
 extern void VG_(print_scheduler_stats) ( void );
 
+extern Int  VG_(alloc_BaB)( Int );      // Allocate slots in baseBlock
+extern void VG_(align_BaB)( UInt );     // Align baseBlock offset
+extern Int  VG_(alloc_BaB_1_set)( Addr ); // Allocate & init baseBlock slot
+
 /* ---------------------------------------------------------------------
    Exports of vg_memory.c
    ------------------------------------------------------------------ */
@@ -1446,57 +1450,6 @@
    Exports of vg_helpers.S
    ------------------------------------------------------------------ */
 
-/* Mul, div, etc, -- we don't codegen these directly. */
-extern void VG_(helper_idiv_64_32);
-extern void VG_(helper_div_64_32);
-extern void VG_(helper_idiv_32_16);
-extern void VG_(helper_div_32_16);
-extern void VG_(helper_idiv_16_8);
-extern void VG_(helper_div_16_8);
-
-extern void VG_(helper_imul_32_64);
-extern void VG_(helper_mul_32_64);
-extern void VG_(helper_imul_16_32);
-extern void VG_(helper_mul_16_32);
-extern void VG_(helper_imul_8_16);
-extern void VG_(helper_mul_8_16);
-
-extern void VG_(helper_CLD);
-extern void VG_(helper_STD);
-extern void VG_(helper_get_dirflag);
-
-extern void VG_(helper_CLC);
-extern void VG_(helper_STC);
-extern void VG_(helper_CMC);
-
-extern void VG_(helper_shldl);
-extern void VG_(helper_shldw);
-extern void VG_(helper_shrdl);
-extern void VG_(helper_shrdw);
-
-extern void VG_(helper_IN);
-extern void VG_(helper_OUT);
-
-extern void VG_(helper_RDTSC);
-extern void VG_(helper_CPUID);
-
-extern void VG_(helper_bsfw);
-extern void VG_(helper_bsfl);
-extern void VG_(helper_bsrw);
-extern void VG_(helper_bsrl);
-
-extern void VG_(helper_fstsw_AX);
-extern void VG_(helper_SAHF);
-extern void VG_(helper_LAHF);
-extern void VG_(helper_DAS);
-extern void VG_(helper_DAA);
-extern void VG_(helper_AAS);
-extern void VG_(helper_AAA);
-extern void VG_(helper_AAD);
-extern void VG_(helper_AAM);
-
-extern void VG_(helper_cmpxchg8b);
-
 extern void VG_(helper_undefined_instruction);
 
 /* Information about trampoline code (for signal return and syscalls) */
@@ -1522,12 +1475,7 @@
    The state of the simulated CPU.
    ------------------------------------------------------------------ */
 
-/* ---------------------------------------------------------------------
-   Offsets into baseBlock for everything which needs to referred to
-   from generated code.  The order of these decls does not imply 
-   what the order of the actual offsets is.  The latter is important
-   and is set up in vg_main.c.
-   ------------------------------------------------------------------ */
+#define INVALID_OFFSET (-1)
 
 /* An array of words.  In generated code, %ebp always points to the
    start of this array.  Useful stuff, like the simulated CPU state,
@@ -1540,64 +1488,14 @@
 
 extern UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS];
 
-/* -----------------------------------------------------
-   Read-write parts of baseBlock.
-   -------------------------------------------------- */
-
-/* State of the simulated CPU. */
-extern Int VGOFF_(m_eax);
-extern Int VGOFF_(m_ecx);
-extern Int VGOFF_(m_edx);
-extern Int VGOFF_(m_ebx);
-extern Int VGOFF_(m_esp);
-extern Int VGOFF_(m_ebp);
-extern Int VGOFF_(m_esi);
-extern Int VGOFF_(m_edi);
-extern Int VGOFF_(m_eflags);
-extern Int VGOFF_(m_ssestate);
-extern Int VGOFF_(m_eip);
-
-extern Int VGOFF_(m_dflag);	/* D flag is handled specially */
-
-extern Int VGOFF_(m_cs);
-extern Int VGOFF_(m_ss);
-extern Int VGOFF_(m_ds);
-extern Int VGOFF_(m_es);
-extern Int VGOFF_(m_fs);
-extern Int VGOFF_(m_gs);
-
-/* Reg-alloc spill area (VG_MAX_SPILLSLOTS words long). */
-extern Int VGOFF_(spillslots);
-
-/* Records the valid bits for the 8 integer regs & flags reg. */
-extern Int VGOFF_(sh_eax);
-extern Int VGOFF_(sh_ecx);
-extern Int VGOFF_(sh_edx);
-extern Int VGOFF_(sh_ebx);
-extern Int VGOFF_(sh_esp);
-extern Int VGOFF_(sh_ebp);
-extern Int VGOFF_(sh_esi);
-extern Int VGOFF_(sh_edi);
-extern Int VGOFF_(sh_eflags);
-
-/* -----------------------------------------------------
-   Read-only parts of baseBlock.
-   -------------------------------------------------- */
-
-/* This thread's LDT pointer. */
-extern Int VGOFF_(ldt);
-
-/* This thread's TLS pointer. */
-extern Int VGOFF_(tls_ptr);
-
-/* Nb: Most helper offsets are in include/tool.h, for use by tools */
-
-extern Int VGOFF_(helper_undefined_instruction);
-
 // ---------------------------------------------------------------------
 // Architecture-specific things defined in eg. x86/*.c
 // ---------------------------------------------------------------------
 
+/* For setting up the baseBlock */    
+extern void VGA_(init_low_baseBlock)  ( Addr client_eip, Addr esp_at_startup );
+extern void VGA_(init_high_baseBlock) ( Addr client_eip, Addr esp_at_startup );
+
 extern void VGA_(load_state) ( arch_thread_t*, ThreadId tid );
 extern void VGA_(save_state) ( arch_thread_t*, ThreadId tid );