Errors after switching to PM-Mode and jmp to Kernel-Seg
Posted: Sun Nov 24, 2013 6:49 am
Hey. I'm really new to OS-Development.
Just started a few days ago, playing around with boot sector.
Everything worked fine. Printing a String or converting an address to print it, switching to Protecte-Mode and print
with VGA.
But the last step threw away my motivation.
What i tried to, was to start in 16-Bit RealMode, Load the Kernel from offset 0x1000, switch to Protected-Mode and jump to
the Start-Address of the Kernel.
Firstly I need to say, I am using a 64bit Ubuntu-Ver. I'm using Qemu. Bochs won't start working at all, always dying.
I'm using .asm files, building with nasm.
At first I used gcc and ld without the 32bit-Flag.
It didn't work out, for sure. It just landed in an loop. When I wrote:
times 1000-($-$$) db 0
times 1000 dw 0
after padding to the magic number 55aa, it worked and it printed an 'X' to the upper left. After giving several StatusMessages which I implemented.
Altering the C-Code of the Kernel results again in an Loop or Crash.
Using gcc and ld with 32-Bit-Flag will result in an loop too. I'm confused.
Sometimes it gives Status "Failed to load all Sectors" or "Error while loading". I used this messages as information and error-catcher.
I'll attach the code (its well commented by me)
Hope you can help me.
Thank you,
JustJim
Just started a few days ago, playing around with boot sector.
Everything worked fine. Printing a String or converting an address to print it, switching to Protecte-Mode and print
with VGA.
But the last step threw away my motivation.
What i tried to, was to start in 16-Bit RealMode, Load the Kernel from offset 0x1000, switch to Protected-Mode and jump to
the Start-Address of the Kernel.
Firstly I need to say, I am using a 64bit Ubuntu-Ver. I'm using Qemu. Bochs won't start working at all, always dying.
I'm using .asm files, building with nasm.
At first I used gcc and ld without the 32bit-Flag.
It didn't work out, for sure. It just landed in an loop. When I wrote:
times 1000-($-$$) db 0
times 1000 dw 0
after padding to the magic number 55aa, it worked and it printed an 'X' to the upper left. After giving several StatusMessages which I implemented.
Altering the C-Code of the Kernel results again in an Loop or Crash.
Using gcc and ld with 32-Bit-Flag will result in an loop too. I'm confused.
Sometimes it gives Status "Failed to load all Sectors" or "Error while loading". I used this messages as information and error-catcher.
I'll attach the code (its well commented by me)
Hope you can help me.
Thank you,
JustJim