aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Baylis <charles.baylis@linaro.org>2016-05-31 14:06:00 +0100
committerCharles Baylis <charles.baylis@linaro.org>2016-05-31 14:06:00 +0100
commitdb53339981c584984dc3cc9346f23de879fc97e6 (patch)
tree27fbc784d104cee60c8096e4ba66878b5dbddd62
parent930a3feef784f97688db80dd18db22b96eb555cf (diff)
more vm_exit_handler fixes, now hits NYI at endstuff
-rw-r--r--src/lj_asm_arm64.h2
-rw-r--r--src/lj_target_arm64.h2
-rw-r--r--src/vm_arm64.dasc20
3 files changed, 12 insertions, 12 deletions
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h
index 7c4172e..9c1faa2 100644
--- a/src/lj_asm_arm64.h
+++ b/src/lj_asm_arm64.h
@@ -58,7 +58,7 @@ static MCode *asm_exitstub_gen(ASMState *as, ExitNo group)
*mxp++ = (MCode)((dispatch >> 32) & 0xffffffff); /* DISPATCH address (hi) */
*mxp++ = group*EXITSTUBS_PER_GROUP;
for (i = 0; i < EXITSTUBS_PER_GROUP; i++)
- *mxp++ = A64I_B|((-4-i)&0x03ffffffu);
+ *mxp++ = A64I_B|((-5-i)&0x03ffffffu);
lj_mcode_sync(as->mcbot, mxp);
lj_mcode_commitbot(as->J, mxp);
as->mcbot = mxp;
diff --git a/src/lj_target_arm64.h b/src/lj_target_arm64.h
index ca7c7e3..8433234 100644
--- a/src/lj_target_arm64.h
+++ b/src/lj_target_arm64.h
@@ -110,7 +110,7 @@ typedef struct {
} ExitState;
/* PC after instruction that caused an exit. Used to find the trace number. */
-#define EXITSTATE_PCREG RID_SP
+#define EXITSTATE_PCREG RID_LR
/* Highest exit + 1 indicates stack check. */
#define EXITSTATE_CHECKEXIT 1
diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc
index f4f0782..2302c0d 100644
--- a/src/vm_arm64.dasc
+++ b/src/vm_arm64.dasc
@@ -1892,20 +1892,20 @@ static void build_subroutines(BuildCtx *ctx)
| stp x24, x25, [sp, #448]
| stp x26, x27, [sp, #464]
| stp x28, x29, [sp, #480]
- | str x30, [sp, #496] // x31 not valid
- | ldr CARG1, [sp, #496] // Load original value of lr.
+ | str lr, [sp, #496] // x31 not valid
+ | ldr CARG1, [sp, #1536] // Load original value of lr.
| ldr TMP0, [lr] // Load DISPATCH.
| add CARG3, sp, #1536 // Recompute original value of sp.
| mv_vmstate CARG4, EXIT
- | str CARG3, [sp, #496] // Store sp in RID_SP
+ | str CARG3, [sp, #504] // Store sp in RID_SP
| st_vmstate CARG4
| ldr CARG2, [CARG1, #-4]! // Get exit instruction.
- | str CARG1, [sp, #504] // Store exit pc in RID_LR and ...
- | str CARG1, [sp, #512] // RID_SP (EXITSTATE_REG)
- | lsl CARG2, CARG2, #8 // !!!TODO is this extracting branch target?
- | add CARG1, CARG1, CARG2, asr #6 // I think it is, so 8/6 are wrong here
+ | str CARG1, [sp, #496] // Store exit pc in RID_LR and ...
+ |// str CARG1, [sp, #504] // RID_SP (EXITSTATE_REG)
+ | lsl CARG2, CARG2, #38 // !!!TODO is this extracting branch target?
+ | add CARG1, CARG1, CARG2, asr #36 // I think it is, so 8/6 are wrong here
| // !!!TODO w or x here?
- | ldr CARG2, [lr, #4] // Load exit stub group offset.
+ | ldr CARG2w, [lr, #8] // Load exit stub group offset.
| sub CARG1, CARG1, lr
| movn TMP1, #~DISPATCH_GL(cur_L)
| ldr L, [TMP0, TMP1]
@@ -1913,7 +1913,7 @@ static void build_subroutines(BuildCtx *ctx)
| movn TMP1, #~DISPATCH_GL(jit_base)
| ldr BASE, [TMP0, TMP1]
| movn TMP1, #~DISPATCH_J(exitno)
- | str CARG1, [TMP0, TMP1]
+ | str CARG1w, [TMP0, TMP1]
| mov CARG4, #0
| str BASE, L->base
| movn TMP1, #~DISPATCH_J(L)
@@ -1928,7 +1928,7 @@ static void build_subroutines(BuildCtx *ctx)
| ldr CARG2, L->cframe
| ldr BASE, L->base
| movn TMP1, #~CFRAME_RAWMASK
- | bic CARG2, CARG2, TMP1
+ | and CARG2, CARG2, TMP1
| mov sp, CARG2
| ldr PC, SAVE_PC // Get SAVE_PC.
| str L, SAVE_L // Set SAVE_L (on-trace resume/yield).