]> Devi Nivas Git - cs3210-lab1.git/commitdiff
Cannot use "g" as an arg constraint because
authorrsc <rsc>
Tue, 14 Aug 2007 04:05:27 +0000 (04:05 +0000)
committerrsc <rsc>
Tue, 14 Aug 2007 04:05:27 +0000 (04:05 +0000)
some memory references aren't actually valid
and gcc is a bit too smart in parsing (%0) and
a bit too dumb in knowing which memory refs
are not valid.  Using "r" seems to constrain gcc
to use a register as in (%eax) and not substitute
a memory reference like (-36(%ebp)).

No one really understands these things.

x86.h

diff --git a/x86.h b/x86.h
index ab7882a32bc377389033b206e0e3657b02bb53b8..4774e7585d1f96f6d5e63bd25e31d8b371b3a5d2 100644 (file)
--- a/x86.h
+++ b/x86.h
@@ -50,7 +50,7 @@ lgdt(struct segdesc *p, int size)
   pd[1] = (uint)p;
   pd[2] = (uint)p >> 16;
 
-  asm volatile("lgdt (%0)" : : "g" (pd));
+  asm volatile("lgdt (%0)" : : "r" (&pd));
 }
 
 struct gatedesc;