Always trible fault! :-(

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.
Wacky

Always trible fault! :-(

Post by Wacky »

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
Whatever5k

Re:Always trible fault! :-(

Post by Whatever5k »

302 Found
403 Forbidden
Wacky

Re:Always trible fault! :-(

Post by Wacky »

Sorry! (i hate my webspace)... it is an attachement..
Wacky

Re:Always trible fault! :-(

Post by Wacky »

Wacky wrote: Sorry! (i hate my webspace)... it is an attachement..
hmmm, it should work: http://home.pages.at/popangler/OS.zip
Xardas

Re:Always trible fault! :-(

Post by Xardas »

I can?t download the file!!!
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:Always trible fault! :-(

Post by Pype.Clicker »

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)
Whatever5k

Re:Always trible fault! :-(

Post by Whatever5k »

And remove the '?, ?' and so on. A normal text editor won't be able to display that correctly.
Wacky

Re:Always trible fault! :-(

Post by Wacky »

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 8))
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:Always trible fault! :-(

Post by Pype.Clicker »

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 .
Wacky

Re:Always trible fault! :-(

Post by Wacky »

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. :-\
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Always trible fault! :-(

Post by distantvoices »

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

Code: Select all

  mov ax,0x10
  mov es,ax
  mov bx,0xffff
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 ;-)
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
FlashBurn

Re:Always trible fault! :-(

Post by FlashBurn »

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!
Wacky

Re:Always trible fault! :-(

Post by Wacky »

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
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:Always trible fault! :-(

Post by Pype.Clicker »

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 ...
Wacky

Re:Always trible fault! :-(

Post by Wacky »

OK, you think i should include the A20 line.. ok. Where can i find tutorials, or better some documetations about this?
Post Reply