-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add x64 instrumentation callback hook
- Loading branch information
1 parent
d26e4dd
commit 66ec9ad
Showing
7 changed files
with
166 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
include ksamd64.inc | ||
|
||
extern InstrumentationCallback:near | ||
|
||
.code | ||
InstrumentationCallbackAsm proc | ||
|
||
cmp eax, 0 ; STATUS_SUCCESS | ||
jne ReturnToCaller | ||
|
||
push rax ; return value | ||
push rcx | ||
push rbx | ||
push rbp | ||
push rdi | ||
push rsi | ||
push rsp | ||
push r10 | ||
push r11 | ||
push r12 | ||
push r13 | ||
push r14 | ||
push r15 | ||
|
||
sub rsp, 20h | ||
mov rcx, r10 | ||
mov rdx, rax | ||
call InstrumentationCallback | ||
add rsp, 20h | ||
|
||
pop r15 | ||
pop r14 | ||
pop r13 | ||
pop r12 | ||
pop r11 | ||
pop r10 | ||
pop rsp | ||
pop rsi | ||
pop rdi | ||
pop rbp | ||
pop rbx | ||
pop rcx | ||
add rsp, 8 ; preserve new rax | ||
|
||
ReturnToCaller: | ||
jmp r10 | ||
|
||
InstrumentationCallbackAsm endp | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters