/* Load the contents of GOT_SLOT into dreg, clobbering ip0 */
+/* Must emit 12 bytes of instructions */
static void
arm64_emit_load_got_slot (MonoAotCompile *acfg, int dreg, int got_slot)
{
g_assert (acfg->fp);
emit_unset_mode (acfg);
/* r16==ip0 */
- offset = (int)(got_slot * sizeof (target_mgreg_t));
+ offset = (int)(got_slot * TARGET_SIZEOF_VOID_P);
#ifdef TARGET_MACH
/* clang's integrated assembler */
fprintf (acfg->fp, "adrp x16, %s@PAGE+%d\n", acfg->got_symbol, offset & 0xfffff000);
+#ifdef MONO_ARCH_ILP32
+ fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF+%d\n", acfg->got_symbol, offset & 0xfff);
+ fprintf (acfg->fp, "ldr w%d, [x16, #%d]\n", dreg, 0);
+#else
fprintf (acfg->fp, "add x16, x16, %s@PAGEOFF\n", acfg->got_symbol);
fprintf (acfg->fp, "ldr x%d, [x16, #%d]\n", dreg, offset & 0xfff);
+#endif
#else
/* Linux GAS */
fprintf (acfg->fp, "adrp x16, %s+%d\n", acfg->got_symbol, offset & 0xfffff000);
/* Compute the data slot address */
arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1);
/* Trampoline argument */
- arm_ldrx (code, arg_reg, ARMREG_IP0, 0);
+ arm_ldrp (code, arg_reg, ARMREG_IP0, 0);
/* Address */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 8);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP0, TARGET_SIZEOF_VOID_P);
arm_brx (code, ARMREG_IP0);
/* Emit it */
arm_adrx (code, ARMREG_IP0, code);
/* Branch to the generic code */
arm_b (code, code - 4 - (i * specific_tramp_size) - common_tramp_size);
+#ifndef MONO_ARCH_ILP32
/* This has to be 2 pointers long */
arm_nop (code);
arm_nop (code);
+#endif
g_assert (code - buf == specific_tramp_size);
emit_code_bytes (acfg, buf, code - buf);
}
guint8 *code;
guint8 *labels [16];
int common_tramp_size;
- int specific_tramp_size = 2 * 8;
+ int specific_tramp_size = 2 * TARGET_SIZEOF_VOID_P;
int imm, pagesize;
char symbol [128];
/* Compute the data slot address */
arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1);
/* Address */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP0, 0);
arm_brx (code, ARMREG_IP0);
/* Emit it */
/* Compute the data slot address */
arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_IP1);
/* Trampoline argument */
- arm_ldrx (code, ARMREG_IP1, ARMREG_IP0, 0);
+ arm_ldrp (code, ARMREG_IP1, ARMREG_IP0, 0);
/* Same as arch_emit_imt_trampoline () */
labels [0] = code;
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 0);
- arm_cmpx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP1, 0);
+ arm_cmpp (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG);
labels [1] = code;
arm_bcc (code, ARMCOND_EQ, 0);
arm_cbzx (code, ARMREG_IP0, 0);
/* Loop footer */
- arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 2 * 8);
+ arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, 2 * TARGET_SIZEOF_VOID_P);
arm_b (code, labels [0]);
/* Match */
mono_arm_patch (labels [1], code, MONO_R_ARM64_BCC);
/* Load vtable slot addr */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP1, TARGET_SIZEOF_VOID_P);
/* Load vtable slot */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP0, 0);
arm_brx (code, ARMREG_IP0);
/* No match */
mono_arm_patch (labels [2], code, MONO_R_ARM64_CBZ);
/* Load fail addr */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP1, TARGET_SIZEOF_VOID_P);
arm_brx (code, ARMREG_IP0);
emit_code_bytes (acfg, buf, code - buf);
code = buf;
labels [0] = code;
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 0);
- arm_cmpx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP1, 0);
+ arm_cmpp (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG);
labels [1] = code;
arm_bcc (code, ARMCOND_EQ, 0);
/* Match */
mono_arm_patch (labels [1], code, MONO_R_ARM64_BCC);
/* Load vtable slot addr */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP1, TARGET_SIZEOF_VOID_P);
/* Load vtable slot */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP0, 0);
arm_brx (code, ARMREG_IP0);
/* No match */
mono_arm_patch (labels [2], code, MONO_R_ARM64_CBZ);
/* Load fail addr */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP1, 8);
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP1, TARGET_SIZEOF_VOID_P);
arm_brx (code, ARMREG_IP0);
emit_code_bytes (acfg, buf, code - buf);
/* ip0 = lmf */
arm_addx_imm (code, ARMREG_IP0, ARMREG_FP, lmf_offset);
/* lmf->lmf_addr = lmf_addr */
- arm_strx (code, ARMREG_R0, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, lmf_addr));
+ arm_strp (code, ARMREG_R0, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, lmf_addr));
/* lmf->previous_lmf = *lmf_addr */
- arm_ldrx (code, ARMREG_IP1, ARMREG_R0, 0);
- arm_strx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, previous_lmf));
+ arm_ldrp (code, ARMREG_IP1, ARMREG_R0, 0);
+ arm_strp (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, previous_lmf));
/* *lmf_addr = lmf */
- arm_strx (code, ARMREG_IP0, ARMREG_R0, 0);
+ arm_strp (code, ARMREG_IP0, ARMREG_R0, 0);
/* Call the C trampoline function */
/* Arg 1 = gregs */
/* ip0 = lmf */
arm_addx_imm (code, ARMREG_IP0, ARMREG_FP, lmf_offset);
/* ip1 = lmf->previous_lmf */
- arm_ldrx (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, previous_lmf));
+ arm_ldrp (code, ARMREG_IP1, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, previous_lmf));
/* ip0 = lmf->lmf_addr */
- arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, lmf_addr));
+ arm_ldrp (code, ARMREG_IP0, ARMREG_IP0, MONO_STRUCT_OFFSET (MonoLMF, lmf_addr));
/* *lmf_addr = previous_lmf */
- arm_strx (code, ARMREG_IP1, ARMREG_IP0, 0);
+ arm_strp (code, ARMREG_IP1, ARMREG_IP0, 0);
/* Check for thread interruption */
/* This is not perf critical code so no need to check the interrupt flag */
arm_strx (code, ARMREG_R0, ARMREG_FP, off_targetaddr);
/* allocate the stack space necessary for the call */
- arm_ldrx (code, ARMREG_R0, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack_size));
+ arm_ldrw (code, ARMREG_R0, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack_size));
arm_movspx (code, ARMREG_IP0, ARMREG_SP);
arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_R0);
arm_movspx (code, ARMREG_SP, ARMREG_IP0);
/* copy stack from the CallContext, IP0 = dest, IP1 = source */
arm_movspx (code, ARMREG_IP0, ARMREG_SP);
- arm_ldrx (code, ARMREG_IP1, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack));
+ arm_ldrp (code, ARMREG_IP1, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack));
label_start_copy = code;
/* set the stack pointer to the value at call site */
arm_addx_imm (code, ARMREG_R0, ARMREG_FP, framesize);
- arm_strx (code, ARMREG_R0, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, stack));
+ arm_strp (code, ARMREG_R0, ARMREG_FP, ccontext_offset + MONO_STRUCT_OFFSET (CallContext, stack));
/* call interp_entry with the ccontext and rmethod as arguments */
arm_addx_imm (code, ARMREG_R0, ARMREG_FP, ccontext_offset);
- arm_ldrx (code, ARMREG_R1, MONO_ARCH_RGCTX_REG, MONO_STRUCT_OFFSET (MonoFtnDesc, arg));
- arm_ldrx (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG, MONO_STRUCT_OFFSET (MonoFtnDesc, addr));
+ arm_ldrp (code, ARMREG_R1, MONO_ARCH_RGCTX_REG, MONO_STRUCT_OFFSET (MonoFtnDesc, arg));
+ arm_ldrp (code, ARMREG_IP0, MONO_ARCH_RGCTX_REG, MONO_STRUCT_OFFSET (MonoFtnDesc, addr));
arm_blrx (code, ARMREG_IP0);
/* load the return values from the context */