Subject: Re: memtest86 in bochs
To: David Laight <>
From: Ben Collver <>
List: port-i386
Date: 01/07/2004 08:36:18
On Mon, Jan 05, 2004 at 10:19:09PM +0000, David Laight wrote:
> What is in the vector table you are setting for real mode?

I'll try to show it here:

> b 0x2604
> c
(0) Breakpoint 6, 0x2604 in ?? ()
Next at t=1702604
(0) [0x00002604] 0010:00002604 (unk. ctxt): lidt DS:[EBX + fffef64c]
> info registers
eax            0x2540           9536
ecx            0x0              0
edx            0x0              0
ebx            0x13110          78096
esp            0x1425c          0x1425c   
ebp            0x1c3            0x1c3     
esi            0x2000           8192
edi            0x13110          78096
eip            0x2604           0x2604    
eflags         0x6              6
cs             0x10             16
ss             0x18             24
ds             0x18             24
es             0x18             24
fs             0x18             24
gs             0x18             24

$ echo "obase=16;$(echo 'ibase=16;180+13110+FFFEF64C'|bc)"|bc    

> x/3wx 0x1000028DC
0xffffffff <bogus+0>:   0x00000000      0x00000000      0x00000000
I believe this corresponds to idt_real: in head.S, and so the the IDT base is
set to 0x0.  Dumping 0x0 just shows a long sequence of zero values.

> And is it following the correct procedure for the mode switch?
> I think the code in sys/arch/i386/stand/lib/realtoprot.S (or threabouts)
> is ok

It appears to be correct from my muddy understanding.  References:

head.S:query_pcbios() and realprot.S:prot_to_real() handle the switch in a
very similar way.  memtest86 has extra code before the switch and NetBSD has
an extra test after the switch.

A hacker does for love what others would not do for money.