1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| #define FUNCTION(name) \ .data; \ .align 4; \ .global name; \ name:
#define VAR(name) \ .global name; \ name:\ name##_addr:
#define LDVAR(reg, name) \ ldr reg, name##_addr;
FUNCTION(pine_bridge_jump_trampoline)
LDVAR(x17, pine_bridge_jump_trampoline_target_method) cmp x0, x17 bne jump_to_original LDVAR(x17, pine_bridge_jump_trampoline_extras) b acquire_lock
lock_failed: wfe
acquire_lock: ldaxr w16, [x17] cbz w16, lock_failed stlxr w16, wzr, [x17] cbnz w16, lock_failed
str x1, [x17, #4] str x2, [x17, #12] str x3, [x17, #20] str d0, [x17, #28] str d1, [x17, #36] str d2, [x17, #44] str d3, [x17, #52] str d4, [x17, #60] str d5, [x17, #68] str d6, [x17, #76] str d7, [x17, #84] mov x1, x0 mov x2, x17 mov x3, sp LDVAR(x0, pine_bridge_jump_trampoline_bridge_method) LDVAR(x17, pine_bridge_jump_trampoline_bridge_entry) br x17
jump_to_original: LDVAR(x17, pine_bridge_jump_trampoline_call_origin_entry) br x17
|