Skip to content

Commit

Permalink
Context: Additional documentation about rsp/esp
Browse files Browse the repository at this point in the history
  • Loading branch information
cursey committed Dec 16, 2023
1 parent 83f776c commit c9c26d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/safetyhook/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ union Xmm {
/// @details This structure is used to pass the context of the hooked function to the destination allowing full access
/// to the 64-bit registers at the moment the hook is called.
/// @note rip will point to a trampoline containing the replaced instruction(s).
/// @note rsp is read-only. Modifying it will have no effect. Use trampoline_rsp to modify rsp if needed but make sure
/// the top of the stack is the rip you want to resume at.
struct Context64 {
Xmm xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15;
uintptr_t rflags, r15, r14, r13, r12, r11, r10, r9, r8, rdi, rsi, rdx, rcx, rbx, rax, rbp, rsp, trampoline_rsp, rip;
Expand All @@ -28,6 +30,8 @@ struct Context64 {
/// @details This structure is used to pass the context of the hooked function to the destination allowing full access
/// to the 32-bit registers at the moment the hook is called.
/// @note eip will point to a trampoline containing the replaced instruction(s).
/// @note esp is read-only. Modifying it will have no effect. Use trampoline_esp to modify esp if needed but make sure
/// the top of the stack is the eip you want to resume at.
struct Context32 {
Xmm xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7;
uintptr_t eflags, edi, esi, edx, ecx, ebx, eax, ebp, esp, trampoline_esp, eip;
Expand Down

0 comments on commit c9c26d8

Please sign in to comment.