Always trible fault! :-(
Always trible fault! :-(
Hello, i wrote a bootsector inc. Protected Mode, A20, GDT,...
After the Bootimage, i load a C-Kernel in 0x1000. In Bochs this work fine, but on a real PC.. ARGHH -> Trible fault!
i've put my complete Source (ASM, C, How to compile..) on my webspace: http://home.pages.at/popangler/OS.zip --> All my comments are written in german language, bacause i'm german (I hope this doesn't matter!) So, please download it and have a look on it... i don't know where my mistake is.
I hope that someone of you can help. Thanks for every help and/or tip
greets Wacky
After the Bootimage, i load a C-Kernel in 0x1000. In Bochs this work fine, but on a real PC.. ARGHH -> Trible fault!
i've put my complete Source (ASM, C, How to compile..) on my webspace: http://home.pages.at/popangler/OS.zip --> All my comments are written in german language, bacause i'm german (I hope this doesn't matter!) So, please download it and have a look on it... i don't know where my mistake is.
I hope that someone of you can help. Thanks for every help and/or tip
greets Wacky
Re:Always trible fault! :-(
hmmm, it should work: http://home.pages.at/popangler/OS.zipWacky wrote: Sorry! (i hate my webspace)... it is an attachement..
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Always trible fault! :-(
what is the last thing you see on your display ? what exactly do make you think it tripple faults ?
btw, you should have a "jmp far" rather than a near jump as your first instruction, so that you can make sure the CS:IP values are really known at startup (most likely, bochs starts with CS=0 and your PC starts with CS=0x7C0)
btw, you should have a "jmp far" rather than a near jump as your first instruction, so that you can make sure the CS:IP values are really known at startup (most likely, bochs starts with CS=0 and your PC starts with CS=0x7C0)
Re:Always trible fault! :-(
And remove the '?, ?' and so on. A normal text editor won't be able to display that correctly.
Re:Always trible fault! :-(
1) Now, everytime my PC reboot (like a trible fault).
2) If i write "jmp $" (self jump/loop) before it jump into Kernel, my system halt (so my boot.asm should be correct, right?!)
and all these seems for me, like a trible fault, because i've get this error by jumping into my C-Kernel!
What do you meen with "Far Jump"?? is it the same like "08h:0x1000"? (i did that!)
(thx for your help )
2) If i write "jmp $" (self jump/loop) before it jump into Kernel, my system halt (so my boot.asm should be correct, right?!)
and all these seems for me, like a trible fault, because i've get this error by jumping into my C-Kernel!
What do you meen with "Far Jump"?? is it the same like "08h:0x1000"? (i did that!)
(thx for your help )
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Always trible fault! :-(
i was rather thinking at a "jmp 0x0000:start" (as you have ORG 0x7C00, you assume CS = 0. Stop assuming ... enforce )
i also think it's a bad idea to load your kernel at 0x0000:0x1000 ... if it becomes big enough, it will overwrite your boot sector. Load it at 0x1000:0x0000 instead .
i also think it's a bad idea to load your kernel at 0x0000:0x1000 ... if it becomes big enough, it will overwrite your boot sector. Load it at 0x1000:0x0000 instead .
Re:Always trible fault! :-(
I?ve done that, but then my boot-image doesn?t boot anymore.
My PC hangs and doesn?t print any message.
And before I did this, i saw my little boot-message.
So this couldn?t be my mistake. :-\
My PC hangs and doesn?t print any message.
And before I did this, i saw my little boot-message.
So this couldn?t be my mistake. :-\
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Always trible fault! :-(
Nay, I wouldna bet a thousand bucks on that if I were you, wacky!
1. You have zero aligned selectors. Given this, you have to jump to 0x08:0x100000 after enabling pmode.
2. you can load your kernel to 0x100000 by some trick of
real mode adressing: edit: thx flashburn - 's been some typo
put this code where you determine the target adress for loading the kernel image via int 0x13
3. you can use grub to do the work for you
1. You have zero aligned selectors. Given this, you have to jump to 0x08:0x100000 after enabling pmode.
2. you can load your kernel to 0x100000 by some trick of
real mode adressing: edit: thx flashburn - 's been some typo
Code: Select all
mov ax,0x10
mov es,ax
mov bx,0xffff
3. you can use grub to do the work for you
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:Always trible fault! :-(
Your problem is that you don?t know the difference between pmode and rmode! 0x1000 in rmode is 0x10000 ind pmode!
rmode : seg:offset
pmode : seg << 16 + offset!!
Edit::
Also your gdt enables not the whole 4gb!
rmode : seg:offset
pmode : seg << 16 + offset!!
Edit::
Also your gdt enables not the whole 4gb!
Re:Always trible fault! :-(
Hey, thx all for the help. I'll test this stuff tomorrow, because, it's late and i have to go to school tomorrow .
What is wrong in my gdt? (It's not my own, it's from another OS --> OO-Stubs)
cu tomorrow,.. Wacky
What is wrong in my gdt? (It's not my own, it's from another OS --> OO-Stubs)
cu tomorrow,.. Wacky
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Always trible fault! :-(
1. What happens when you put the "jmp $" at the start of main(), for instance ?
2. Did you made sure your code was starting at offset 0 in your kernel.bin (or whatever) file ? Some compiler start with strings rather than with text ... make sure yours don't.
i don't see anything wrong with your GDT. and it DO enable access to the whole 4GB as it has BIG and GRAN bits sets and the whole 20 bits of limit fields are set.
BTw, as long as you don't enable A20 gate, don't expect successful read/writes above 1MB.
Bochs is also known to enable A20 at bios startup. Your realPC(tm) behaviour may be different ...
2. Did you made sure your code was starting at offset 0 in your kernel.bin (or whatever) file ? Some compiler start with strings rather than with text ... make sure yours don't.
i don't see anything wrong with your GDT. and it DO enable access to the whole 4GB as it has BIG and GRAN bits sets and the whole 20 bits of limit fields are set.
BTw, as long as you don't enable A20 gate, don't expect successful read/writes above 1MB.
Bochs is also known to enable A20 at bios startup. Your realPC(tm) behaviour may be different ...
Re:Always trible fault! :-(
OK, you think i should include the A20 line.. ok. Where can i find tutorials, or better some documetations about this?