Page 1 of 1

Problem with print function

Posted: Fri Jun 13, 2003 5:12 pm
by beyondsociety
I'm having sort of a problem with my protected mode kernel. My kernel prints a few messages to the screen and halts. When I create a .img file and run it in bochs, it displays the first two messages and then tripple faults.
Thats sort of my problem but I also noticed something weird with bochs.

When I comment out one of the lines and re run it in bochs, it shows the same thing before even though I have commented out one of the lines. I think my problem has to do with my print function.

The whole code my print function is attached below. The mart of the code is in print function.c and the rest is just the files I need to run it.

[attachment deleted by admin]

Re:Problem with print function

Posted: Sat Jun 14, 2003 8:34 pm
by beyondsociety
I fixed my problem. There was problem with the code in my kernel. When I rewrote it, it wirked fine. Now my only problem is trying to figure out my tripple fault error when I enable interrupts.

Re:Problem with print function

Posted: Sun Jun 15, 2003 3:20 am
by LOneWoolF
I had a double fault when i enable interrupts...
maybe you look at the "loop - double fault" thread <-
my problem first where how i remapped the PIC and i also had a wrong outb function... check this things

dunno if that helps ya, but i hope so :)

GreeZ
LOneWoolF

Re:Problem with print function

Posted: Sun Jun 15, 2003 7:14 am
by Pype.Clicker
if you get "tripple fault", then it means your IDT is likely to be bad, or that the IDTR register content isn't good. tripple fault usually occur when the "double fault" can't be delivered to a valid handler, which occurs usually when the ISR code of your exceptions isn't correct.

As long as you have no IRQs, no exception thus no problems, but once you STI, hardware IRQs find bad interrupt handler or bad descriptor in IDT, try to raise a GPF which also fails and bang double fault.

Give your IDT a try with INTxx instruction before enabling hardware interrupts...

Re:Problem with print function

Posted: Mon Jun 16, 2003 4:35 pm
by beyondsociety
When I issue a int 10 in my C kernel and run it in bochs it gives me a tripple fault. When I open the bochs debugger and set the breakpoint to the EIP address thats tripple faulting I get int 10 which is what I tested. If I go I more address location, I get a tripple fault.

Why is this? Is there a problem with my interrupt handler?

Re:Problem with print function

Posted: Tue Jun 17, 2003 1:56 am
by Pype.Clicker
more likely to be a problem with your IDT itself ... check the IDTR register is loaded with the correct values. Also check you correctly set your IDT descriptor (interrupt gate, DPL0, segment=OSCODE, offset=ISR).

Btw, INT 0x10 is an exception in protected mode, so i would rather use some other interrupt for my tests, if i were you (like -- say -- 0x30 if you mapped IRQs from 0x20 through 0x2f)

Re:Problem with print function

Posted: Thu Jun 19, 2003 12:08 am
by beyondsociety
Thanks for the help Pype Clicker. My main problem was that I didin't have any idt descriptors or interrupt_handlers for my exceptions thus an exception was firing off causing my code to tripple fault.