Protected Mode Problems

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
aKzenT

Protected Mode Problems

Post 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
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Protected Mode Problems

Post 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 ...
aKzenT

Re:Protected Mode Problems

Post 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
Post Reply