2021-04-27 08:23:37 +00:00
|
|
|
|
|
|
|
#include <asm.inc>
|
|
|
|
|
2020-01-26 17:59:05 +00:00
|
|
|
#include <ksamd64.inc>
|
|
|
|
|
2021-04-27 08:23:37 +00:00
|
|
|
.code64
|
|
|
|
|
|
|
|
PUBLIC KdbpStackSwitchAndCall
|
|
|
|
KdbpStackSwitchAndCall:
|
|
|
|
|
2020-01-26 17:59:05 +00:00
|
|
|
/* Save old stack */
|
|
|
|
mov rax, rsp
|
|
|
|
|
|
|
|
/* Set new stack */
|
2021-04-27 08:23:37 +00:00
|
|
|
mov rsp, rcx
|
|
|
|
|
2020-01-26 17:59:05 +00:00
|
|
|
/* Save old stack on new stack */
|
|
|
|
push rax
|
|
|
|
|
2021-04-27 08:23:37 +00:00
|
|
|
/* Call function */
|
|
|
|
call rdx
|
|
|
|
|
2020-01-26 17:59:05 +00:00
|
|
|
/* Restore old stack */
|
|
|
|
pop rax
|
|
|
|
mov rsp, rax
|
2021-04-27 08:23:37 +00:00
|
|
|
|
2020-01-26 17:59:05 +00:00
|
|
|
/* Return */
|
|
|
|
ret
|
2021-04-27 08:23:37 +00:00
|
|
|
|
|
|
|
END
|