Skip to content

Commit 1a12074

Browse files
committed
readjust base pointer after stack switch, x64_msvc
1 parent 2469fbe commit 1a12074

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/win_x64/stackman.lib

34 Bytes
Binary file not shown.

src/platforms/switch_x64_msvc.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ NESTED_ENTRY stackman_switch, _TEXT$00
5858
mov rcx, r13 ;arg1, context
5959
mov rdx, 0 ;arg2, opcode STACKMAN_OP_SAVE
6060
lea r8, [rsp+20h] ;arg3, stack pointer
61+
mov rbx, rsp; ; keep old stack pointer
6162
call r12 ;
6263

6364
;actual stack switch (and re-allocating the shadow stack):
6465
lea rsp, [rax-20h]
66+
;re-adjust base pointer
67+
sub rbx, rsp;
68+
sub rbp, rbx;
6569
6670
mov rcx, r13 ;arg1, context
6771
mov rdx, 1 ;arg2, opcode STACKMAN_OP_RESTORE

0 commit comments

Comments
 (0)