Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions fast_fwd/arm64/thunks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
NESTED_ENTRY InvokeForwarder

; Save enregistered args
PROLOG_SAVE_REG_PAIR fp, lr, #-64!
PROLOG_SAVE_REG_PAIR x19, x20, #16
PROLOG_NOP stp x0, x1, [sp, #32]
PROLOG_NOP stp x2, x3, [sp, #48]
PROLOG_SAVE_REG_PAIR fp, lr, #-48!
PROLOG_NOP stp x0, x1, [sp, #16]
PROLOG_NOP stp x2, x3, [sp, #32]

; Replace forwarder abi with owner abi
ldr x1, [x0, #8]
Expand All @@ -26,23 +25,20 @@

; Get method address from owner abi vtable
ldr x0, [x1]
ldr x19, [x0, x12, lsl #3]
mov x0, x19
ldr x15, [x0, x12, lsl #3]

; Verify indirect call target
adrp x12, __guard_check_icall_fptr
ldr x12, [x12, __guard_check_icall_fptr]
blr x12

; Restore method address, return address, and args
mov x12, x19
EPILOG_NOP ldp x2, x3, [sp, #48]
EPILOG_NOP ldp x0, x1, [sp, #32]
EPILOG_RESTORE_REG_PAIR x19, x20, #16
EPILOG_RESTORE_REG_PAIR fp, lr, #64!
; Restore return address, and args
EPILOG_NOP ldp x2, x3, [sp, #32]
EPILOG_NOP ldp x0, x1, [sp, #16]
EPILOG_RESTORE_REG_PAIR fp, lr, #48!

; Jump to method
EPILOG_NOP br x12
EPILOG_NOP br x15

NESTED_END InvokeForwarder

Expand Down