Allow GET/SET_SEG asm to access memory or a register.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 19 Jan 2009 22:58:54 +0000 (17:58 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 19 Jan 2009 22:58:54 +0000 (17:58 -0500)
This is a minor optimization that can improve gcc code generation.

src/farptr.h

index 3256848b65fe4fe8a25552f86da95611ea2ea9af..a26cf08724e7c751d56ef62424567b39f5803268 100644 (file)
@@ -49,10 +49,10 @@ extern u16 __segment_FS, __segment_GS;
 // Low level macros for getting/setting a segment register.
 #define __SET_SEG(SEG, value)                                   \
     __asm__("movw %w1, %%" #SEG : "=m"(__segment_ ## SEG)       \
-            : "r"(value))
+            : "rm"(value))
 #define __GET_SEG(SEG) ({                                       \
     u16 __seg;                                                  \
-    __asm__("movw %%" #SEG ", %w0" : "=r"(__seg)                \
+    __asm__("movw %%" #SEG ", %w0" : "=rm"(__seg)               \
             : "m"(__segment_ ## SEG));                          \
     __seg;})