Subject: Re: memtest86 in bochs
To: David Laight <david@l8s.co.uk>
From: Ben Collver <collver1@comcast.net>
List: port-i386
Date: 01/04/2004 10:50:38
On Sun, Jan 04, 2004 at 06:37:40PM +0000, David Laight wrote:
> On Wed, Dec 31, 2003 at 11:35:45AM +0100, Christian Biere wrote:
> > Ben Collver wrote:
> > > The confusing part is in query_pcbios(), at line 730 of head.S
> > >         xorl    %eax, %eax
> > > 
> > > At this point in the function, bochs is in real mode.  I expected the xorl
> > > to cause eax to be zeroed out, but instead it zeroes cs and sets eip to 2.
> > > Can someone advise me if this is a quirk of the 80386 in real mode, or if
> > > it looks like a bug in bochs?
> > 
> > There's definately no such side-effect of "xor eax,eax". You can use all
> > 32-bit registers in real-mode just like in protected mode. I'd even say to
> > enter the latter successfully you have to use them. However, it's unlikely
> > that the emulation is buggy here because a lot of DOS apps use 32-bit
> > registers etc.  Though I haven't used bochs in quite a while. I'd guess
> > it's rather a problem of the debugger. Maybe it damaged the stack or an
> > interrupt got in-between.
> 
> More likely the source is compiled for the wrpong mode.
> Try adding '.code 16' directives to the .S files.

Thank you for the response.

There already is a '.code 16' in query_pcbios() at line 688 of head.S, and
there are no calls and no '.code 32' before the odd behavior I see at line
730.

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