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
Errors after switching to PM-Mode and jmp to Kernel-Seg
Errors after switching to PM-Mode and jmp to Kernel-Seg
- Attachments
-
- gdt.txt
- (1.39 KiB) Downloaded 37 times
-
- disk_load.txt
- (1.01 KiB) Downloaded 31 times
-
- boot_sect.txt
- this is the main-asm.
- (835 Bytes) Downloaded 68 times
Re: Errors after switching to PM-Mode and jmp to Kernel-Seg
As I can only add 3 files, I need to make 2 additional posts :/
- Attachments
-
- print_string.txt
- (551 Bytes) Downloaded 37 times
-
- print_hex.txt
- (1.86 KiB) Downloaded 36 times
-
- kernel.txt
- the kernel.c
- (83 Bytes) Downloaded 67 times
Re: Errors after switching to PM-Mode and jmp to Kernel-Seg
The last files. Hope it is okay, to do so?
- Attachments
-
- switch_to_pm.txt
- (362 Bytes) Downloaded 33 times
-
- print_string_pm.txt
- (806 Bytes) Downloaded 54 times
Re: Errors after switching to PM-Mode and jmp to Kernel-Seg
Next time you can just place them inline into the post surrounded byJustJim wrote:As I can only add 3 files, I need to make 2 additional posts :/
Code: Select all
[code]
Right off the bat though I don't see where you setup your initial segments in real-mode, but then you call the disk_read stuff only specifying BX. This could easily mean that your actually reading into 0x07C0:1000 (which is 0x8C00 linear rather than 0x1000 like it looks like you expect).
EDIT: errr, sorry. Meant 0x8C00