form1
Code: Select all
mov eax, int_handler
call eax
Code: Select all
call int_handler
Code: Select all
mov eax, int_handler
call eax
Code: Select all
call int_handler
Code: Select all
; ...
and eax,byte 0x7f
push eax ; IRQ number
call _processIrqList ; call list processing
add esp,4
; ...
IIRC, the first makes it an absolute indirect call, while the second would make it a relative direct call.rootel77 wrote: can anyone tell me what is the diff between the tow codes below
form1and form2Code: Select all
mov eax, int_handler call eax
and why the first form is encountered in all samples i've read about interrupt handlers (written in asm and calling a c handler)?Code: Select all
call int_handler
I assume there's some pointer to the location in the mov that loads the address. If so, you can replace that instantly without any significant delay. You can't just replace a relative call, and some compilers optimize relative calls to nearby code to a shorter opcode. If they do that, the code is smaller and you get unpredictable crashes.
Code: Select all
; setvect() changes the operand of the CALL instruction at run-time,
; so we need its location = 27 bytes from start of stub. We also want
; the CALL to use absolute addressing instead of EIP-relative, so:
mov eax,fault ; (26)
call eax ; (31)