Restore segment limits in handle_1589 code.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 15 Mar 2010 23:58:55 +0000 (19:58 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 15 Mar 2010 23:58:55 +0000 (19:58 -0400)
Before transitioning back to real mode, the segment registers should
be reloaded so that the hidden register limits are updated.

src/system.c

index f3031af12e721a597e73be654ec2d185ace79f89..898c3ccc9f6c86b52af3ea6b11455e533a872254 100644 (file)
@@ -143,6 +143,11 @@ handle_1587(struct bregs *regs)
         "  xorw %%di, %%di\n"
         "  rep movsw\n"
 
+        // Restore DS and ES segment limits to 0xffff
+        "  movw $(5<<3), %%ax\n" // 5th descriptor in table (SS)
+        "  movw %%ax, %%ds\n"
+        "  movw %%ax, %%es\n"
+
         // Disable protected mode
         "  movl %%cr0, %%eax\n"
         "  andl $~" __stringify(CR0_PE) ", %%eax\n"