Hi All...
I have written a basic kernel that works in PMode. I have a GDT with 2 segment descriptors for Code and Data segments, both starting at physical address 0x00000000 and ending at 0xFFFFFFFF.
The kernel works fine on Bochs, but on a real machine, I have a very strange problem.
Video RAM is normally mapped at address 0xA0000, and in text mode, we use the address space starting at 0xB8000.
On a real machine, Video RAM is mapped at BOTH 0xA0000 AND 0x1A0000!! Which means that when I write 0x41 at address 0xB8000 OR 0x1B8000, the character 'A' appears on the screen. However, writing at address 0x2B8000 does nothing (Thank God).
Is this normal? Can anyone please tell me what is going on?
Ayman Madkour
Video RAM at 1B8000 ???
Re: Video RAM at 1B8000 ???
Hi,
sounds as if you didn't enable the a20 line-gate which is needed to access memory above the 1 MB mark. Without it, addresses higher than that will just be truncated to fit this restriction. Have a look at http://www.win.tue.nl/~aeb/linux/kbd/A20.html for a detailed explanation and some code examples to enable it.
regards,
gaf
sounds as if you didn't enable the a20 line-gate which is needed to access memory above the 1 MB mark. Without it, addresses higher than that will just be truncated to fit this restriction. Have a look at http://www.win.tue.nl/~aeb/linux/kbd/A20.html for a detailed explanation and some code examples to enable it.
regards,
gaf
-
- Posts: 11
- Joined: Sat Feb 05, 2005 12:00 am
Re: Video RAM at 1B8000 ???
If you are talking about setting bit 0 in CR0 register, then I DID enable the A20 gate. Am I missing something?
Code: Select all
MOV EAX, CR0
OR EAX, 0x00000001
MOV CR0, EAX
Re: Video RAM at 1B8000 ???
Setting the pmode bit in cr0 won't automatically enable the a20 gate. The purpose of the gate is to ensure backward compability with programs written for real-mode (and that exploited the fact that addresses greather than 0x100000 were back then simply truncated) when pmode was introduced. Since such apps are rather rare today, bochs aswell as some of todays BIOSes simply boot with the a20 line-gate enabled, but you unfortunately can't rely on that. You therefore always have to enable it once pmode was entered as described on the site I pointed you to.
regards,
gaf
regards,
gaf
-
- Posts: 11
- Joined: Sat Feb 05, 2005 12:00 am
Re: Video RAM at 1B8000 ???
Hey.. It worked!
Thanks...
Thanks...