osdeve wrote:
I am trying to save the return value of a syscall in register eax.
I'm somehow confused ... you talk about both "syscall" (that is, invoking the kernel to perform e.g. file open, file close ...) and "IRQ" (that is, handling a request from a hardware device).
In the first one, you want to produce output values in _more_ than eax ... in the second one, you do not want any register to be modified because the handling event should not be noticed by the interrupted program.
So, I can't do popa. However, if I do it the manual way [pop ..., pop ...], I get a GPF on pop edi.
Chances are that you're messing up with the stack ... if it actually GPFs on "pop esp" or "pop ds", the reason might be different, but i suggest you cross-check the stack state...
Is there any other way?
access directly the place where EAX is saved on stack ... this may be more convenient in a C-based handler as shown by proxy, since it's your only way to manipulate the return values properly (without having the compiler messing the value of %ebx, for instance).
In an asm-based handler, you can still achieve that with mov [esp+offset_of_eax_on_stack], new_value.