Cannot access memory above 0x8000000 in protected mode x86

208 Views Asked by At

I am quite enthusiastic about computers and I managed to create my own bootloader and kernel.

So far it jumps to protected mode from real mode and can execute C code. But the thing is that I cannot write to memory addresses above 0x8000000. The code runs fine but whenever I read from that address it seems that the data was not written.

I know that all memory addresses are not mapped to ram but according to this article addresses from 100000-FEBFFFFF are mapped to ram. So my code should work. http://staff.ustc.edu.cn/~xyfeng/research/cos/resources/machine/mem.htm

Here is a snippet to help you understand

char *data1 = (char*)0x8000000; // This cannot be written to
char *data2 = (char*)0x7ffffff; // This can be written to

*data1 = 'A'; // Will run but not actually write to that ram address
*data2 = 'A'; // Will run properly 

Note - I am running my code in qemu(an emulator) and have not tested this on raw hardware yet.

Any help would be appreciated.

0

There are 0 best solutions below