diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_ccallback.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/lj_ccallback.c b/src/lj_ccallback.c index fce6a3ed..846827b1 100644 --- a/src/lj_ccallback.c +++ b/src/lj_ccallback.c | |||
@@ -173,16 +173,16 @@ static void callback_mcode_init(global_State *g, uint32_t *page) | |||
173 | uint32_t *p = page; | 173 | uint32_t *p = page; |
174 | void *target = (void *)lj_vm_ffi_callback; | 174 | void *target = (void *)lj_vm_ffi_callback; |
175 | MSize slot; | 175 | MSize slot; |
176 | *p++ = A64I_LDRLx | A64F_D(RID_X11) | A64F_S19(4); | 176 | *p++ = A64I_LE(A64I_LDRLx | A64F_D(RID_X11) | A64F_S19(4)); |
177 | *p++ = A64I_LDRLx | A64F_D(RID_X10) | A64F_S19(5); | 177 | *p++ = A64I_LE(A64I_LDRLx | A64F_D(RID_X10) | A64F_S19(5)); |
178 | *p++ = A64I_BR | A64F_N(RID_X11); | 178 | *p++ = A64I_LE(A64I_BR | A64F_N(RID_X11)); |
179 | *p++ = A64I_NOP; | 179 | *p++ = A64I_LE(A64I_NOP); |
180 | ((void **)p)[0] = target; | 180 | ((void **)p)[0] = target; |
181 | ((void **)p)[1] = g; | 181 | ((void **)p)[1] = g; |
182 | p += 4; | 182 | p += 4; |
183 | for (slot = 0; slot < CALLBACK_MAX_SLOT; slot++) { | 183 | for (slot = 0; slot < CALLBACK_MAX_SLOT; slot++) { |
184 | *p++ = A64I_MOVZw | A64F_D(RID_X9) | A64F_U16(slot); | 184 | *p++ = A64I_LE(A64I_MOVZw | A64F_D(RID_X9) | A64F_U16(slot)); |
185 | *p = A64I_B | A64F_S26((page-p) & 0x03ffffffu); | 185 | *p = A64I_LE(A64I_B | A64F_S26((page-p) & 0x03ffffffu)); |
186 | p++; | 186 | p++; |
187 | } | 187 | } |
188 | lua_assert(p - page <= CALLBACK_MCODE_SIZE); | 188 | lua_assert(p - page <= CALLBACK_MCODE_SIZE); |
@@ -624,6 +624,10 @@ static void callback_conv_result(CTState *cts, lua_State *L, TValue *o) | |||
624 | if (ctype_isfp(ctr->info)) | 624 | if (ctype_isfp(ctr->info)) |
625 | dp = (uint8_t *)&cts->cb.fpr[0]; | 625 | dp = (uint8_t *)&cts->cb.fpr[0]; |
626 | #endif | 626 | #endif |
627 | #if LJ_TARGET_ARM64 && LJ_BE | ||
628 | if (ctype_isfp(ctr->info) && ctr->size == sizeof(float)) | ||
629 | dp = (uint8_t *)&cts->cb.fpr[0].f[1]; | ||
630 | #endif | ||
627 | lj_cconv_ct_tv(cts, ctr, dp, o, 0); | 631 | lj_cconv_ct_tv(cts, ctr, dp, o, 0); |
628 | #ifdef CALLBACK_HANDLE_RET | 632 | #ifdef CALLBACK_HANDLE_RET |
629 | CALLBACK_HANDLE_RET | 633 | CALLBACK_HANDLE_RET |
@@ -637,7 +641,7 @@ static void callback_conv_result(CTState *cts, lua_State *L, TValue *o) | |||
637 | *(int32_t *)dp = ctr->size == 1 ? (int32_t)*(int8_t *)dp : | 641 | *(int32_t *)dp = ctr->size == 1 ? (int32_t)*(int8_t *)dp : |
638 | (int32_t)*(int16_t *)dp; | 642 | (int32_t)*(int16_t *)dp; |
639 | } | 643 | } |
640 | #if LJ_TARGET_MIPS64 | 644 | #if LJ_TARGET_MIPS64 || (LJ_TARGET_ARM64 && LJ_BE) |
641 | /* Always sign-extend results to 64 bits. Even a soft-fp 'float'. */ | 645 | /* Always sign-extend results to 64 bits. Even a soft-fp 'float'. */ |
642 | if (ctr->size <= 4 && | 646 | if (ctr->size <= 4 && |
643 | (LJ_ABI_SOFTFP || ctype_isinteger_or_bool(ctr->info))) | 647 | (LJ_ABI_SOFTFP || ctype_isinteger_or_bool(ctr->info))) |