SamuelTulach/LightHook

JUMP_CODE trashes non-volatile register r15

Benno1308 opened this issue · 3 comments

The JUMP_CODE trashes the r15 register, thus causing undefined behaviour.

I would suggest using any other volatile register that is expected to be trashed anyway, such as RAX

You are right. I don't know what went through my head while writing it and why I didn't notice it. I am preparing for graduation exams now, so I am extremely busy. I will push a fix in a week or so when I am done with them.

RAX cannot be messed about since it's used for returning values in Microsoft ABI, for example. R11 is volatile, though and should be unused (at least most of the time).

Yea I noticed that too, RAX was a bad idea. But r11 was indeed used somewhere in winload.efi. I’ve just replaced the jump code with jmp [rip] followed by the absolute address.

Thanks for fixing this tho