Bochs and a20

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Bochs and a20

Post by neon »

Hey everyone,

I was updating my bootloader to add more flexibility and content. Everything was going smooth, until I started running into random memory problems.

I was certain bochs enabled a20 by default, so never thought much about it. However, everything I tried either caused a double fault exception from bochs, or cause VirtualPC to give an error.

Then I decided to re-enable a20--and it works fine now and both emulators. This brings me here to ask the following:

Is a20 enabled by default in bochs? I was certain that it was... Can someone please confirm this?

Thanks :)
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
inx
Member
Member
Posts: 142
Joined: Wed Mar 05, 2008 12:52 am

Post by inx »

I highly, highly doubt Bochs would start with A20 enabled. The purpose of A20 being maskable is for backwards compatibility with real-mode programs that assume a 20-bit address space. It allows for the 0x100000-0 rollover some of these programs expect. Unless the Bochs developers decided to not have true PC-compatibility for DOS, A20 will be disabled at boot.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

Normally A20 IS enabled in bochs. Because bochs runs a lot faster if it doesn't have to check the A20 enabled bit on every single simulated memory access.

However, the option is there to turn it off.

It is done at COMPILE time. If you even have the ability to turn A20 off, then you need to recompile yourself a new version of bochs -- and I think you will be happy with how much faster it runs!
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

Even still, I would enable A20 yourself to ensure compatibility with everything else other than Bochs.
Post Reply