In the page fault handler of the linux kernel using some opcode disassembly I am seeing that on the x86 architecture the CALL or 0xE8 instruction occasionally throws a write fault and ESI and EDI are both NULL. I was wondering if there is a specific reason for this as CALL takes a memory address and just changes EIP to that value and that doesn’t require a page since it’s just EIP + relative_offset. If anyone could clear this up it would be much appreciated.
Share
The
callinstruction doesn’t just changeeip– it also has to write the currenteip(updated to point to the next instruction) to the stack before that change. Ajmp-type instruction would act as you suggest butcallis slightly different in that you have to be able toretto the current location later on.I can’t be sure since you haven’t given us the code, full register contents and page tables (that would be a large amount of information for a question), but it seems to me the likeliest explanation is that the stack is currently switched out and needs to be bought back in.
The other possibility I originally thought of was that the address you were jumping to was non-resident but I don’t think that would cause a fault on the
callitself.It would cause a fault very quickly afterwards as the CPU tried to fetch the next instruction but I don’t think that’s what your description indicates, since:
call; andThe
esiandedivalues are a non-issue – they take no part in acall.