Code: Select all
movl %esp, %ebp
addl $0x8, %ebp
movl (%ebp), %eax
movl %eax, (eip) // eip is here no register, but a double word from my c code.
Thanks.
Code: Select all
movl %esp, %ebp
addl $0x8, %ebp
movl (%ebp), %eax
movl %eax, (eip) // eip is here no register, but a double word from my c code.
hehe ... stack garbage ... the usual assembly error.Poseidon wrote: it works now... i forgot to pop ebp from the stack :-[
AR got me right. If the exception comes from loading an invalid DS segment, or if it comes from userland, you'll be in trouble when trying to use DS. so it'd be wise to have something likei didn't really understand you pype. what value should ds have then?
Code: Select all
exception__x:
push ebp
mov ebp, esp
pushad ;; just to make sure
push ds
push es
mov ax, KERNEL_SEGMENT
mov ds,ax
mov es,ax
__handle your exception here__
pop es
pop ds
popad
pop ebp
__add esp,4 if some error code was pushed__
iret