diff options
Diffstat (limited to 'asmrun/arm64.S')
| -rw-r--r-- | asmrun/arm64.S | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/asmrun/arm64.S b/asmrun/arm64.S index de670e6605..2c16a0eadb 100644 --- a/asmrun/arm64.S +++ b/asmrun/arm64.S @@ -44,30 +44,30 @@ #if defined(__PIC__) #define ADDRGLOBAL(reg,symb) \ - adrp TMP2, :got:symb; \ - ldr reg, [TMP2, #:got_lo12:symb] + adrp TMP2, :got:symb; \ + ldr reg, [TMP2, #:got_lo12:symb] #define LOADGLOBAL(reg,symb) \ - ADDRGLOBAL(TMP2,symb); \ - ldr reg, [TMP2] + ADDRGLOBAL(TMP2,symb); \ + ldr reg, [TMP2] #define STOREGLOBAL(reg,symb) \ - ADDRGLOBAL(TMP2,symb); \ - str reg, [TMP2] + ADDRGLOBAL(TMP2,symb); \ + str reg, [TMP2] #else #define ADDRGLOBAL(reg,symb) \ - adrp reg, symb; \ - add reg, reg, #:lo12:symb + adrp reg, symb; \ + add reg, reg, #:lo12:symb #define LOADGLOBAL(reg,symb) \ - adrp TMP2, symb; \ - ldr reg, [TMP2, #:lo12:symb] + adrp TMP2, symb; \ + ldr reg, [TMP2, #:lo12:symb] #define STOREGLOBAL(reg,symb) \ - adrp TMP2, symb; \ - str reg, [TMP2, #:lo12:symb] + adrp TMP2, symb; \ + str reg, [TMP2, #:lo12:symb] #endif @@ -82,11 +82,11 @@ caml_call_gc: CFI_STARTPROC PROFILE /* Record return address */ - STOREGLOBAL(x30, caml_last_return_address) + STOREGLOBAL(x30, caml_last_return_address) .Lcaml_call_gc: /* Record lowest stack address */ - mov TMP, sp - STOREGLOBAL(TMP, caml_bottom_of_stack) + mov TMP, sp + STOREGLOBAL(TMP, caml_bottom_of_stack) /* Set up stack space, saving return address and frame pointer */ /* (2 regs RA/GP, 24 allocatable int regs, 24 caller-save float regs) * 8 */ stp x29, x30, [sp, -400]! @@ -94,7 +94,7 @@ caml_call_gc: add x29, sp, #0 /* Save allocatable integer registers on the stack, in the order given in proc.ml */ - stp x0, x1, [sp, 16] + stp x0, x1, [sp, 16] stp x2, x3, [sp, 32] stp x4, x5, [sp, 48] stp x6, x7, [sp, 64] @@ -121,16 +121,16 @@ caml_call_gc: stp d28, d29, [sp, 368] stp d30, d31, [sp, 384] /* Store pointer to saved integer registers in caml_gc_regs */ - add TMP, sp, #16 - STOREGLOBAL(TMP, caml_gc_regs) + add TMP, sp, #16 + STOREGLOBAL(TMP, caml_gc_regs) /* Save current allocation pointer for debugging purposes */ - STOREGLOBAL(ALLOC_PTR, caml_young_ptr) + STOREGLOBAL(ALLOC_PTR, caml_young_ptr) /* Save trap pointer in case an exception is raised during GC */ - STOREGLOBAL(TRAP_PTR, caml_exception_pointer) + STOREGLOBAL(TRAP_PTR, caml_exception_pointer) /* Call the garbage collector */ bl caml_garbage_collection /* Restore registers */ - ldp x0, x1, [sp, 16] + ldp x0, x1, [sp, 16] ldp x2, x3, [sp, 32] ldp x4, x5, [sp, 48] ldp x6, x7, [sp, 64] @@ -155,10 +155,10 @@ caml_call_gc: ldp d28, d29, [sp, 368] ldp d30, d31, [sp, 384] /* Reload new allocation pointer and allocation limit */ - LOADGLOBAL(ALLOC_PTR, caml_young_ptr) - LOADGLOBAL(ALLOC_LIMIT, caml_young_limit) + LOADGLOBAL(ALLOC_PTR, caml_young_ptr) + LOADGLOBAL(ALLOC_LIMIT, caml_young_limit) /* Free stack space and return to caller */ - ldp x29, x30, [sp], 400 + ldp x29, x30, [sp], 400 ret CFI_ENDPROC .type caml_call_gc, %function @@ -177,11 +177,11 @@ caml_alloc1: CFI_ADJUST(16) add x29, sp, #0 /* Record return address */ - STOREGLOBAL(x30, caml_last_return_address) + STOREGLOBAL(x30, caml_last_return_address) /* Call GC */ bl .Lcaml_call_gc /* Restore return address */ - ldp x29, x30, [sp], 16 + ldp x29, x30, [sp], 16 CFI_ADJUST(-16) /* Try again */ b 1b @@ -202,18 +202,18 @@ caml_alloc2: CFI_ADJUST(16) add x29, sp, #0 /* Record return address */ - STOREGLOBAL(x30, caml_last_return_address) + STOREGLOBAL(x30, caml_last_return_address) /* Call GC */ bl .Lcaml_call_gc /* Restore return address */ - ldp x29, x30, [sp], 16 + ldp x29, x30, [sp], 16 CFI_ADJUST(-16) /* Try again */ b 1b CFI_ENDPROC .type caml_alloc2, %function .size caml_alloc2, .-caml_alloc2 - + .align 2 .globl caml_alloc3 caml_alloc3: @@ -227,18 +227,18 @@ caml_alloc3: CFI_ADJUST(16) add x29, sp, #0 /* Record return address */ - STOREGLOBAL(x30, caml_last_return_address) + STOREGLOBAL(x30, caml_last_return_address) /* Call GC */ bl .Lcaml_call_gc /* Restore return address */ - ldp x29, x30, [sp], 16 + ldp x29, x30, [sp], 16 CFI_ADJUST(-16) /* Try again */ b 1b CFI_ENDPROC .type caml_alloc2, %function .size caml_alloc2, .-caml_alloc2 - + .align 2 .globl caml_allocN caml_allocN: @@ -252,11 +252,11 @@ caml_allocN: CFI_ADJUST(16) add x29, sp, #0 /* Record return address */ - STOREGLOBAL(x30, caml_last_return_address) + STOREGLOBAL(x30, caml_last_return_address) /* Call GC. This preserves ARG */ bl .Lcaml_call_gc /* Restore return address */ - ldp x29, x30, [sp], 16 + ldp x29, x30, [sp], 16 CFI_ADJUST(-16) /* Try again */ b 1b @@ -279,12 +279,12 @@ caml_c_call: add TMP, sp, #0 STOREGLOBAL(TMP, caml_bottom_of_stack) /* Make the exception handler alloc ptr available to the C code */ - STOREGLOBAL(ALLOC_PTR, caml_young_ptr) + STOREGLOBAL(ALLOC_PTR, caml_young_ptr) STOREGLOBAL(TRAP_PTR, caml_exception_pointer) /* Call the function */ blr ARG /* Reload alloc ptr and alloc limit */ - LOADGLOBAL(ALLOC_PTR, caml_young_ptr) + LOADGLOBAL(ALLOC_PTR, caml_young_ptr) LOADGLOBAL(ALLOC_LIMIT, caml_young_limit) /* Return */ ret x19 @@ -299,7 +299,7 @@ caml_c_call: caml_start_program: CFI_STARTPROC PROFILE - ADDRGLOBAL(ARG, caml_program) + ADDRGLOBAL(ARG, caml_program) /* Code shared with caml_callback* */ /* Address of OCaml code to call is in ARG */ @@ -307,62 +307,62 @@ caml_start_program: .Ljump_to_caml: /* Set up stack frame and save callee-save registers */ - stp x29, x30, [sp, -160]! + stp x29, x30, [sp, -160]! CFI_ADJUST(160) - add x29, sp, #0 + add x29, sp, #0 stp x19, x20, [sp, 16] stp x21, x22, [sp, 32] stp x23, x24, [sp, 48] stp x25, x26, [sp, 64] stp x27, x28, [sp, 80] - stp d8, d9, [sp, 96] + stp d8, d9, [sp, 96] stp d10, d11, [sp, 112] stp d12, d13, [sp, 128] stp d14, d15, [sp, 144] /* Setup a callback link on the stack */ - LOADGLOBAL(x8, caml_bottom_of_stack) + LOADGLOBAL(x8, caml_bottom_of_stack) LOADGLOBAL(x9, caml_last_return_address) LOADGLOBAL(x10, caml_gc_regs) stp x8, x9, [sp, -32]! /* 16-byte alignment */ CFI_ADJUST(32) str x10, [sp, 16] /* Setup a trap frame to catch exceptions escaping the OCaml code */ - LOADGLOBAL(x8, caml_exception_pointer) + LOADGLOBAL(x8, caml_exception_pointer) adr x9, .Ltrap_handler stp x8, x9, [sp, -16]! CFI_ADJUST(16) add TRAP_PTR, sp, #0 /* Reload allocation pointers */ - LOADGLOBAL(ALLOC_PTR, caml_young_ptr) + LOADGLOBAL(ALLOC_PTR, caml_young_ptr) LOADGLOBAL(ALLOC_LIMIT, caml_young_limit) /* Call the OCaml code */ blr ARG .Lcaml_retaddr: /* Pop the trap frame, restoring caml_exception_pointer */ - ldr x8, [sp], 16 + ldr x8, [sp], 16 CFI_ADJUST(-16) STOREGLOBAL(x8, caml_exception_pointer) /* Pop the callback link, restoring the global variables */ .Lreturn_result: - ldr x10, [sp, 16] + ldr x10, [sp, 16] ldp x8, x9, [sp], 32 CFI_ADJUST(-32) - STOREGLOBAL(x8, caml_bottom_of_stack) + STOREGLOBAL(x8, caml_bottom_of_stack) STOREGLOBAL(x9, caml_last_return_address) STOREGLOBAL(x10, caml_gc_regs) /* Update allocation pointer */ - STOREGLOBAL(ALLOC_PTR, caml_young_ptr) + STOREGLOBAL(ALLOC_PTR, caml_young_ptr) /* Reload callee-save registers and return address */ ldp x19, x20, [sp, 16] ldp x21, x22, [sp, 32] ldp x23, x24, [sp, 48] ldp x25, x26, [sp, 64] ldp x27, x28, [sp, 80] - ldp d8, d9, [sp, 96] + ldp d8, d9, [sp, 96] ldp d10, d11, [sp, 112] ldp d12, d13, [sp, 128] ldp d14, d15, [sp, 144] - ldp x29, x30, [sp], 160 + ldp x29, x30, [sp], 160 CFI_ADJUST(-160) /* Return to C caller */ ret @@ -400,7 +400,7 @@ caml_raise_exn: 1: /* Cut stack at current trap handler */ mov sp, TRAP_PTR /* Pop previous handler and jump to it */ - ldr TMP, [sp, 8] + ldr TMP, [sp, 8] ldr TRAP_PTR, [sp], 16 br TMP 2: /* Preserve exception bucket in callee-save register x19 */ @@ -413,7 +413,7 @@ caml_raise_exn: bl caml_stash_backtrace /* Restore exception bucket and raise */ mov x0, x19 - b 1b + b 1b CFI_ENDPROC .type caml_raise_exn, %function .size caml_raise_exn, .-caml_raise_exn @@ -430,12 +430,12 @@ caml_raise_exception: LOADGLOBAL(ALLOC_PTR, caml_young_ptr) LOADGLOBAL(ALLOC_LIMIT, caml_young_limit) /* Test if backtrace is active */ - LOADGLOBAL(TMP, caml_backtrace_active) + LOADGLOBAL(TMP, caml_backtrace_active) cbnz TMP, 2f 1: /* Cut stack at current trap handler */ mov sp, TRAP_PTR /* Pop previous handler and jump to it */ - ldr TMP, [sp, 8] + ldr TMP, [sp, 8] ldr TRAP_PTR, [sp], 16 br TMP 2: /* Preserve exception bucket in callee-save register x19 */ @@ -443,12 +443,12 @@ caml_raise_exception: /* Stash the backtrace */ /* arg1: exn bucket, already in x0 */ LOADGLOBAL(x1, caml_last_return_address) /* arg2: pc of raise */ - LOADGLOBAL(x2, caml_bottom_of_stack) /* arg3: sp of raise */ + LOADGLOBAL(x2, caml_bottom_of_stack) /* arg3: sp of raise */ mov x3, TRAP_PTR /* arg4: sp of handler */ bl caml_stash_backtrace /* Restore exception bucket and raise */ mov x0, x19 - b 1b + b 1b CFI_ENDPROC .type caml_raise_exception, %function .size caml_raise_exception, .-caml_raise_exception @@ -461,7 +461,7 @@ caml_callback_exn: CFI_STARTPROC PROFILE /* Initial shuffling of arguments (x0 = closure, x1 = first arg) */ - mov TMP, x0 + mov TMP, x0 mov x0, x1 /* x0 = first arg */ mov x1, TMP /* x1 = closure environment */ ldr ARG, [TMP] /* code pointer */ @@ -476,11 +476,11 @@ caml_callback2_exn: CFI_STARTPROC PROFILE /* Initial shuffling of arguments (x0 = closure, x1 = arg1, x2 = arg2) */ - mov TMP, x0 + mov TMP, x0 mov x0, x1 /* x0 = first arg */ - mov x1, x2 /* x1 = second arg + mov x1, x2 /* x1 = second arg mov x2, TMP /* x2 = closure environment */ - ADDRGLOBAL(ARG, caml_apply2) + ADDRGLOBAL(ARG, caml_apply2) b .Ljump_to_caml CFI_ENDPROC .type caml_callback2_exn, %function @@ -498,7 +498,7 @@ caml_callback3_exn: mov x1, x2 /* x1 = second arg */ mov x2, x3 /* x2 = third arg */ mov x3, TMP /* x3 = closure environment */ - ADDRGLOBAL(ARG, caml_apply3) + ADDRGLOBAL(ARG, caml_apply3) b .Ljump_to_caml CFI_ENDPROC .type caml_callback3_exn, %function |
