Weird, the version of bochs I normally use (2.0.2) only prints "Exception: divide by zero" once, as it should, but the new version (2.3.6) I got to be able to do dbg prints it out loads of times, yet theres no loop in the code and only a single divide by zero in the code (and anyway it only ever does the interrupt once because of the LDTR error...).
Thanks, Combuster, that helps allot, it gave me this:
Code: Select all
| STACK 0x0000 [0xff55]
| STACK 0x0002 [0xf000]
| STACK 0x0004 [0xff53]
| STACK 0x0006 [0xf000]
| STACK 0x0008 [0xff53]
| STACK 0x000a [0xf000]
| STACK 0x000c [0x0053]
| STACK 0x000e [0xf007]
| STACK 0x0010 [0x0700]
| STACK 0x0012 [0x2f00]
| STACK 0x0014 [0xff53]
| STACK 0x0016 [0xf000]
| STACK 0x0018 [0xff53]
| STACK 0x001a [0xf000]
| STACK 0x001c [0xff53]
| STACK 0x001e [0xf000]
If I let it run till error
But that looks like the top off the stack after the iret has removed the top of it...
Anybody see what im doing wrong, ive made sure theres a pop for every push, etc...
Here's the isr's code:
Code: Select all
_isr:
mov [store_1], eax
pop eax
mov [store_2], eax
mov eax, [store_1]
pusha
push es
push ds
push fs
push gs
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, _int_handler
mov ebx, [store_2]
push ebx
call eax
pop eax
pop gs
pop fs
pop ds
pop es
popa
add esp, 4
sti
iret
...
SECTION .data
...
store_1 dd 0
store_2 dd 0
Its called by stubs that look like this:
Code: Select all
_isr0:
cli
hlt
push byte 0
push byte 0
jmp _isr
_isr1:
cli
push byte 0
push byte 1
jmp _isr
...
numbered 0 - 31.
and the int handler looks like this:
Code: Select all
void int_handler(int err_code)
{
k_printf(exception_messages[err_code], 0x04);
return;
};
everything compiles/assembles/links with no errors/warnings (except compile warning: "warning: division by zero", but that's done on purpose to trigger an interrupt).
Can't see what I'm doing wrong...
Anybody see what's wrong with it?
Thanks in advance,
Jules
P.S. Sorry for dumping so much code... (But there's been worse...)
edit: changed Dex to Combuster, I always get confused because you use a picture of dexter from the cartoon dex's lab as your avatar, sorry...
second edit: thanks for the tip Combuster, that can be really useful