
www.angusenterprises.co.uk/message.txt
Any ideas? (I'm not just being lazy - I'm still working at it! Just curious if you can point me in the right direction)
Thanks.

Okay, I'm having problems with my ISRs for the exceptions...
I've set up my IDT, and have written a few (exceptionally basic, for now, I'll actually turn them into proper ISRs later, they're just checking the concept for this build) ISRs to cover interrupts 0-31 in the IDT.
I then do a divide by zero in the main in order to trigger isr0. This should just cancel interrupts, call the C handler, and print a message before going into an infinite loop.
Here's a few pieces of relevant code (I've left out tonnes to keep the readability except where I feel it might be helpful):
Code: Select all
puts((unsigned char*) "[Masking IRQs...", strlen((unsigned char*) "[Masking IRQs..."));
Code: Select all
int puts(const char *s);
Code: Select all
isr14: ; Page fault exception
cli ; Cancel interrupts
call CISR14 ; Call our C handler
iret ; Return from interrupt
Code: Select all
<bochs:41> s
Next at t=76248443
(0) [0x00100358] 0008:0x00100358 (unk. ctxt): idiv eax, ecx ; f7f9
<bochs:42> s
CPU_LOOP 1
Error: (0) print_guard_results: guard_found ? (stop reason 0)
Next at t=76248443
(0) [0x00100358] 0008:100358 (unk. ctxt): idiv eax, ecx ; f7f9
Yeah, I realised that.Pype.Clicker wrote: yep, machine reset upon exception is usually the sign of a triple fault.
I tried that, and it very definitely isn't reaching the ISR.You can check wether the handler is okay or not by setting a breakpoint on the first instruction of the exception handler. If you can get there, it means your IDT is okay. If the bochs resets before the breakpoint is met, then you have something terribly wrong with your IDT...
Paging isn't enabled yet, and I used xp (to read a physical address, yes?): xp /8b[t] 0x102020 to be precise.just a thought: have you paging enabled already ? if yes, did you use "x ..." or "xp ..." to check your IDT ?
I hadn't thought of that, thanks for the information. At the moment however I've just got a flat setup with a null descriptor, and a code (0x08) and data (0x10) segment for ring 0, with base = 0 and limit = 4GB.The reason i ask is that it's fairly common to forget that the CPU will use the base address of IDT regardless of any data segment (e.g. if your data segment has base!=0, make sure you've added data segment base to the offset before you load idtr.base) and that it will have to access the IDT through the paging MMU (that is, if the virtual address of your IDT isn't mapped, you're doomed).
Thanks for the wishes, and having edited bochs I can see that it is indeed triple faulting:good luck ... don't hesitate to hack your bochs to make it more informative (e.g. make it print the interrupt vector before it tries to use it, etc.)
Code: Select all
debug: action=ignore
panic: action=fatal
error: action=ask
info: action=report
I'm not too lazy, but I'll heed your advice and add them to my bochsrc.paulbarker wrote: Looks like you've solved half the problem. "CPU_LOOP 1" is a bochs configuration problem, and I've explained it here and elsewhere. Short answer, expect it to come back next time you see a bug, and remember that it hides some pretty useful information (get rid of the message and bochs should print out register values when it dies).
Oh, and whenever that message is around it worries me. On my comp it was associated with segfaults (of bochs, not of the virtualised system) and good old fashioned lockups (bochs refusing to exit).
If you're lazy and just want the fix without the explaination, add the following to your bochsrc:
Code: Select all
debug: action=ignore panic: action=fatal error: action=ask info: action=report