Page 1 of 1

Protected Mode Problems

Posted: Sat Aug 21, 2004 2:58 pm
by aKzenT
I have written a MBR + Kernel that runs in a Virtual VM Ware. The Master Boot Record loads the Kernel, sets Protected Mode and then jumps into the kernel. The kernel consists of an Assembler part and an C part. The Assembler-code just starts the main()-function in C. This works great, but I have a problem in the C-file:

All references to constant data are not working. When I call the printf-function of my kernel:
e.g: printf("bla");

The "bla" is not displayed on the screen, but the function is 100% working. The function sets the local video memory. Putting a simple char in the video memory works great, but strings and constants are messed up.

I think it has to do with my GDT.

I am happy about every suggestion or solution.

I've attached the whole project as an .zip file.

Thank you,
Thomas Krause

Re:Protected Mode Problems

Posted: Sat Aug 21, 2004 3:11 pm
by Pype.Clicker
seems like you're missing the "rodata" section ... (hmm. can't remember if DjGPP uses this)

btw, it's likely that there's a problem with the 'load address'. MBR calls the kernel with SYS:90000 and the linker has targetted the kernel at SYS:100 ...

Re:Protected Mode Problems

Posted: Mon Aug 23, 2004 4:59 pm
by aKzenT
Thank you, that was the problem. I changed the linker parameters to set the Text-Section to 9000 (Ttext=0x9000) and now it is working.

Thomas Krause