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
Protected Mode Problems
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Protected Mode Problems
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 ...
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
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
Thomas Krause