Page 1 of 1

Problems with Interrupts

Posted: Thu Apr 24, 2003 11:00 pm
by newbie
I have been having a problem with Interrupts recently, where when calling one via software (int 30h), the screen becomes covered with colors, control characters, and etc.  I am currently booting on Bochs if that has anything to do with it.

Any ideas?

Actually I think its a stack problem

Posted: Fri Apr 25, 2003 11:00 pm
by newbie
My kernel loads via GRUB into protected mode, upon which I load a GDT, setup a stack, and Jump to the main function in kernel.c  It runs several functions, including a long_mode_test  ( I have Bochs acting like an AMD Opteron ).  The Long Mode Test Code is below:

long_mode_test:

mov eax, 80000000h
cpuid
cmp eax, 80000000h
jbe no_long_mode
mov eax, 80000001h
cpuid
bt edx, 29
jnc no_long_mode
        mov eax, 1
push eax
call temp_func
ret

no_long_mode:
ret

If I leave move eax, 1 and push eax in the function, the kernel freezes.  If I take them out temp_func is called at it tells me long mode is supported.  This happens on all assembly functions called after I jump to my C code.  I am thinking my stack is setup correctly, but based on this evidence (and that interrupts are behaving strangely), I think I missed something.


I have tried several methods to setup a stack.

Currently, I have the following
mov ebp, stack_sel
mov esp, stack_end



.data
stack_sel:
      times 8192   db 0   ; 8k bytes
stack end:


Have I just done something wrong there, or do I need something else added to my code?   I have code to enable the TSS, IDT, and GDT.  Everything works until I do a push.

Any Ideas?

Thanks in advance

RE:Actually I think its a stack problem

Posted: Sun Apr 27, 2003 11:00 pm
by Anton
It seems that you are not seting the stack selector(SS). If you are tring to do this by mov ebp,stack_sel then its wrong. You need to make a stack selector and load it to ss.
Anton