This jumbo-checkin is the Full Virtualization checkin.  This eliminates
Valgrind's dependency on the dynamic linker for getting started, and
instead takes things into its own hands.

This checkin doesn't add much in the way of new functionality, but it
is the basis for all future work on Valgrind.  It allows us much more
flexibility in implementation, and well as increasing the reliability
of Valgrind by protecting it more from its clients.

This patch requires some changes to tools to update them to the changes
in the tool API, but they are straightforward.  See the posting "Heads
up: Full Virtualization" on valgrind-developers for a more complete
description of this change and its effects on you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2118 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_dispatch.S b/coregrind/vg_dispatch.S
index fe6a7bc..f8bfaf9 100644
--- a/coregrind/vg_dispatch.S
+++ b/coregrind/vg_dispatch.S
@@ -76,6 +76,16 @@
 	pushl	%edi
 	pushl	%ebp
 
+	/* check to see if we're doing pointer checking */
+	movl	VG_(clo_pointercheck), %eax
+	testl	%eax,%eax
+	jz	1f
+	
+	pushl	%fs						/* save %fs     */
+	mov	$(VG_POINTERCHECK_SEGIDX << 3) + 7, %eax	/* load new %fs */
+	movw	%ax,%fs
+
+1:	
 	/* Set up the baseBlock pointer */
 	movl	$VG_(baseBlock), %ebp
 
@@ -137,7 +147,14 @@
 	jmp	run_innerloop_exit
 	
 run_innerloop_exit:
-	popl	%ebp
+	movl	VG_(clo_pointercheck), %ebx
+	testl	%ebx,%ebx
+	jz	1f
+
+	/* restore %fs */
+	popl	%fs
+	
+1:	popl	%ebp
 	popl	%edi
 	popl	%esi
 	popl	%edx