Page 1 of 1

stack value changes inside isr_common_stub after sti

Posted: Tue Jun 02, 2020 3:36 am
by ITchimp
I am on my way to try set up and test idt... so far so good, using bochs, I was able to debug the instructions...
but what I discovered is that (see code below) right after I turned on interrupt (sti), the stack value just changed
dramatically from previous instructions, what happened????

Code: Select all

call isr_handler

pop %ebx
mov %bx, %ds
mov %bx, %es
mov %bx, %fs
mov %bx, %gs
mov %bx, %ss

popa
add 8, %esp
sti
iret

Re: stack value changes inside isr_common_stub after sti

Posted: Tue Jun 02, 2020 4:18 am
by Octocontrabass
It looks like you're copying buggy code from a tutorial.

Also, in AT&T syntax, immediate values have a $ prefix.

Re: stack value changes inside isr_common_stub after sti

Posted: Tue Jun 02, 2020 1:06 pm
by kzinti
Yeah you are basically adding whatever is at address 8 to %esp. That's not going to work.

Re: stack value changes inside isr_common_stub after sti

Posted: Tue Jun 02, 2020 8:10 pm
by ITchimp
the dollar sign was there it was $8, i thought about again,and realized that maybe some interrupt signals were causing these...