Hi @all,
I´m writing my kernel in FreeBASIC. Now I´m at the point where I should use interrupts. So I wrote some functions that create and load a IDT. I wrote a function and created an IDT-entry for it. Then I tried to call int 0 to test it, but instead of printing text to the screen, the kernel crashed.
I hope you can help me, I have no ideas what to do.
The version of my kernel with the problem is here: http://darkinsanity.freehoster.ch/FROST_debug.zip
The logfile of Bochs is here: http://darkinsanity.freehoster.ch/bochs.log
Problem with the IDT
- darkinsanity
- Member
- Posts: 45
- Joined: Wed Sep 17, 2008 3:59 am
- Location: Germany
Re: Problem with the IDT
I bet you loaded the wrong address into the idtr. Whats the code that actually loads it?
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Problem with the IDT
Try adding a break point in Bochs at the instruction where you invoke the error, then running 'info itd' in the debugger.
Then add restart and add a break point for the required error handler then run again. If the handler is called step through it until it errors itself.
I think that the fault is caused by calling 'IRET' from within a function's stack frame, normally you would use an assembler stub that saves the registers and then calls the C/BASIC handler.
Then add restart and add a break point for the required error handler then run again. If the handler is called step through it until it errors itself.
I think that the fault is caused by calling 'IRET' from within a function's stack frame, normally you would use an assembler stub that saves the registers and then calls the C/BASIC handler.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: Problem with the IDT
I looked at your code and I bet it crashes because the idt is loaded wrong. put a breakpoint right after the lidt instruction, then type info idt 0x00 and see what laddr of that entry is
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Problem with the IDT
Ouchouchouch
No stack configured
Broken ISR stubs (mixing assembly with freebasic prologue/epilogue)
General language abuse (WTF is code doing in HEADER files)
the horror
No stack configured
Broken ISR stubs (mixing assembly with freebasic prologue/epilogue)
General language abuse (WTF is code doing in HEADER files)
the horror
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Problem with the IDT
This reminds me of good ol' PascalCombuster wrote:(WTF is code doing in HEADER files)
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- darkinsanity
- Member
- Posts: 45
- Joined: Wed Sep 17, 2008 3:59 am
- Location: Germany
Re: Problem with the IDT
ok, the problem is solved. it was because the structure of the IDT-entries were automaticaly aligned on the 4-byte boundaries.
and i´ll fix that broken isr stubs soon ^^
thx for your help
and i´ll fix that broken isr stubs soon ^^
thx for your help