diff options
author | Mike Pall <mike> | 2023-09-11 13:33:27 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2023-09-11 13:33:27 +0200 |
commit | f63bc569fab1450def4c817f100e580dddb425c5 (patch) | |
tree | e3cabaf5b138f9affe4e004f741b48467c2f27f4 /src/lj_err.c | |
parent | 836ab4227a1b024321731fe5a5059368c9f0dff7 (diff) | |
download | luajit-f63bc569fab1450def4c817f100e580dddb425c5.tar.gz luajit-f63bc569fab1450def4c817f100e580dddb425c5.tar.bz2 luajit-f63bc569fab1450def4c817f100e580dddb425c5.zip |
Windows/ARM64: Fix exception unwinding.
Thanks to Peter Cawley. #593
Diffstat (limited to 'src/lj_err.c')
-rw-r--r-- | src/lj_err.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_err.c b/src/lj_err.c index 6e50cbee..8ef51bf2 100644 --- a/src/lj_err.c +++ b/src/lj_err.c | |||
@@ -261,6 +261,8 @@ LJ_FUNCA int lj_err_unwind_win(EXCEPTION_RECORD *rec, | |||
261 | { | 261 | { |
262 | #if LJ_TARGET_X86 | 262 | #if LJ_TARGET_X86 |
263 | void *cf = (char *)f - CFRAME_OFS_SEH; | 263 | void *cf = (char *)f - CFRAME_OFS_SEH; |
264 | #elif LJ_TARGET_ARM64 | ||
265 | void *cf = (char *)f - CFRAME_SIZE; | ||
264 | #else | 266 | #else |
265 | void *cf = f; | 267 | void *cf = f; |
266 | #endif | 268 | #endif |
@@ -297,11 +299,11 @@ LJ_FUNCA int lj_err_unwind_win(EXCEPTION_RECORD *rec, | |||
297 | #else | 299 | #else |
298 | /* Unwind the stack and call all handlers for all lower C frames | 300 | /* Unwind the stack and call all handlers for all lower C frames |
299 | ** (including ourselves) again with EH_UNWINDING set. Then set | 301 | ** (including ourselves) again with EH_UNWINDING set. Then set |
300 | ** stack pointer = cf, result = errcode and jump to the specified target. | 302 | ** stack pointer = f, result = errcode and jump to the specified target. |
301 | */ | 303 | */ |
302 | RtlUnwindEx(cf, (void *)((cframe_unwind_ff(cf2) && errcode != LUA_YIELD) ? | 304 | RtlUnwindEx(f, (void *)((cframe_unwind_ff(cf2) && errcode != LUA_YIELD) ? |
303 | lj_vm_unwind_ff_eh : | 305 | lj_vm_unwind_ff_eh : |
304 | lj_vm_unwind_c_eh), | 306 | lj_vm_unwind_c_eh), |
305 | rec, (void *)(uintptr_t)errcode, ctx, dispatch->HistoryTable); | 307 | rec, (void *)(uintptr_t)errcode, ctx, dispatch->HistoryTable); |
306 | /* RtlUnwindEx should never return. */ | 308 | /* RtlUnwindEx should never return. */ |
307 | #endif | 309 | #endif |