On Mon, Mar 15, 2010 at 04:28:02PM +0100, Antoine Leca wrote:
http://bochs.sourceforge.net/cgi-bin/lxr/source/bios/rombios.c has:
[...]
3660 ;; make sure DS and ES limits are 64KB 3661 mov ax, #0x28 3662 mov ds, ax 3663 mov es, ax
[...]
In SeaBIOS, the applicable code is in src/system.c, and looks like
[...]
Note that while the basic scheme is the same, the "cleaning up" of lines 3660-3663 "make sure DS and ES limits are 64KB" is not present.
That does appear to be a SeaBIOS error. I'll commit a fix (see below).
[...]
(qemu) info registers EIP=0000f4a7 EFL=00023002 [-------] CPL=3 II=0 A20=1 SMM=0 HLT=0 ES =0000 00000000 0000ffff 0000f300 CS =f000 000f0000 0000ffff 0000f300 SS =9492 00094920 0000ffff 0000f300 DS =97ce 00097cec 0000ffff 0000f300
A ds.base of 0x97cec cannot be translated to a real mode segment.
However, it's not clear why it would make a difference. The segment limit is shown as 0xffff here - it's the segment base which is not aligned. On return to real mode, the segment base should have been reloaded..
-Kevin
--- a/src/system.c +++ b/src/system.c @@ -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"