Make sure to set dependency to segment registers in inline asm.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/src/system.c b/src/system.c
index 898c3cc..6658e22 100644
--- a/src/system.c
+++ b/src/system.c
@@ -162,8 +162,8 @@
         // Restore %ds (from %ss)
         "  movw %%ss, %%ax\n"
         "  movw %%ax, %%ds\n"
-        : "+c"(count), "+S"(si)
-        : : "eax", "di", "cc"); // XXX - also clobbers %es
+        : "+c"(count), "+S"(si), "+m" (__segment_ES)
+        : : "eax", "di", "cc");
 
     set_a20(prev_a20_enable);
 
@@ -222,7 +222,7 @@
         "  movw %%ax, %%ds\n"
         "  movw %%ax, %%ss\n"
         :
-        : "S"(gdt_far)
+        : "S"(gdt_far), "m" (__segment_ES)
         : "eax", "cc");
 }
 
diff --git a/src/util.c b/src/util.c
index 0e69913..dcc0b71 100644
--- a/src/util.c
+++ b/src/util.c
@@ -93,7 +93,7 @@
     asm volatile(
         "rep stosb %%es:(%%di)"
         : "+c"(len), "+D"(d_far)
-        : "a"(c)
+        : "a"(c), "m" (__segment_ES)
         : "cc", "memory");
 }
 
@@ -105,7 +105,7 @@
     asm volatile(
         "rep stosw %%es:(%%di)"
         : "+c"(len), "+D"(d_far)
-        : "a"(c)
+        : "a"(c), "m" (__segment_ES)
         : "cc", "memory");
 }
 
@@ -137,7 +137,7 @@
         "rep movsb (%%si),%%es:(%%di)\n"
         "movw %w0, %%ds"
         : "=&r"(bkup_ds), "+c"(len), "+S"(s_far), "+D"(d_far)
-        : "r"(s_seg)
+        : "r"(s_seg), "m" (__segment_ES)
         : "cc", "memory");
 }
 
@@ -166,7 +166,7 @@
         asm volatile(
             "rep movsb (%%esi),%%es:(%%edi)"
             : "+c"(len), "+S"(s1), "+D"(d)
-            : : "cc", "memory");
+            : "m" (__segment_ES) : "cc", "memory");
         return d1;
     }
     // Common case - use 4-byte copy
@@ -174,7 +174,7 @@
     asm volatile(
         "rep movsl (%%esi),%%es:(%%edi)"
         : "+c"(len), "+S"(s1), "+D"(d)
-        : : "cc", "memory");
+        : "m" (__segment_ES) : "cc", "memory");
     return d1;
 }
 
@@ -183,6 +183,7 @@
 void
 iomemcpy(void *d, const void *s, u32 len)
 {
+    ASSERT32FLAT();
     yield();
     while (len > 3) {
         u32 copylen = len;