Module: wine Branch: master Commit: 2601a8a2f1d42f0d181fa228a93952553ba9cb7f URL: https://gitlab.winehq.org/wine/wine/-/commit/2601a8a2f1d42f0d181fa228a939525...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Feb 15 17:59:04 2024 +0100
ntdll: Don't count custom stack frames as part of the prolog on ARM64.
---
dlls/ntdll/tests/exception.c | 13 ++++--------- dlls/ntdll/unwind.c | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 518b15f7821..5a9b77c157c 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8401,20 +8401,16 @@ static void test_virtual_unwind(void) };
/* Partial prologues with the custom frame opcodes (machine frame, - * context) behave like there's an off-by-one bug; unwinding from - * offset 0, which normally does nothing, executes one opcode if - * there's a machine frame or context in the prologue, and for other - * offsets, it behaves like unwinding from one instruction further - * ahead. So only test the full prologue case. */ + * context) behave like there's one less instruction to skip, because the + * custom frame is set up externally without an explicit instruction. */ static const struct results results_2[] = { /* offset fp handler pc frame offset registers */ -#if 0 { 0x00, 0x00, 0, ORIG_LR, 0x010, TRUE, { {-1,-1} }}, { 0x04, 0x00, 0, 0x0008, 0x010, FALSE, { {-1,-1} }}, { 0x08, 0x00, 0, 0x0018, 0x020, FALSE, { {-1,-1} }}, -#endif { 0x0c, 0x00, 0, 0x0018, 0x020, FALSE, { {-1,-1} }}, + { 0x10, 0x00, 0, 0x0018, 0x020, FALSE, { {-1,-1} }}, };
static const BYTE function_3[] = @@ -8446,12 +8442,11 @@ static void test_virtual_unwind(void) static const struct results results_3[] = { /* offset fp handler pc frame offset registers */ -#if 0 { 0x00, 0x00, 0, ORIG_LR, 0x010, TRUE, { {-1,-1} }}, { 0x04, 0x00, 0 , 0x0108, 0x110, FALSE, { {x0, 0x08}, {x1, 0x10}, {x2, 0x18}, {x3, 0x20}, {x4, 0x28}, {x5, 0x30}, {x6, 0x38}, {x7, 0x40}, {x8, 0x48}, {x9, 0x50}, {x10, 0x58}, {x11, 0x60}, {x12, 0x68}, {x13, 0x70}, {x14, 0x78}, {x15, 0x80}, {x16, 0x88}, {x17, 0x90}, {x18, 0x98}, {x19, 0xA0}, {x20, 0xA8}, {x21, 0xB0}, {x22, 0xB8}, {x23, 0xC0}, {x24, 0xC8}, {x25, 0xD0}, {x26, 0xD8}, {x27, 0xE0}, {x28, 0xE8}, {x29, 0xF0}, {lr, 0xF8}, {d0, 0x110}, {d1, 0x120}, {d2, 0x130}, {d3, 0x140}, {d4, 0x150}, {d5, 0x160}, {d6, 0x170}, {d7, 0x180}, {d8, 0x190}, {d9, 0x1a0}, {d10, 0x1b0}, {d11, 0x1c0}, {d12, 0x1d0}, {d13, 0x1e0}, {d14, 0x1f0}, {d15, 0x200}, {-1,-1} }}, { 0x08, 0x00, 0 , 0x0118, 0x120, FALSE, { {x0, 0x18}, {x1, 0x20}, {x2, 0x28}, {x3, 0x30}, {x4, 0x38}, {x5, 0x40}, {x6, 0x48}, {x7, 0x50}, {x8, 0x58}, {x9, 0x60}, {x10, 0x68}, {x11, 0x70}, {x12, 0x78}, {x13, 0x80}, {x14, 0x88}, {x15, 0x90}, {x16, 0x98}, {x17, 0xA0}, {x18, 0xA8}, {x19, 0xB0}, {x20, 0xB8}, {x21, 0xC0}, {x22, 0xC8}, {x23, 0xD0}, {x24, 0xD8}, {x25, 0xE0}, {x26, 0xE8}, {x27, 0xF0}, {x28, 0xF8}, {x29, 0x100}, {lr, 0x108}, {d0, 0x120}, {d1, 0x130}, {d2, 0x140}, {d3, 0x150}, {d4, 0x160}, {d5, 0x170}, {d6, 0x180}, {d7, 0x190}, {d8, 0x1a0}, {d9, 0x1b0}, {d10, 0x1c0}, {d11, 0x1d0}, {d12, 0x1e0}, {d13, 0x1f0}, {d14, 0x200}, {d15, 0x210}, {-1,-1} }}, -#endif { 0x0c, 0x00, 0 , 0x0118, 0x120, FALSE, { {x0, 0x18}, {x1, 0x20}, {x2, 0x28}, {x3, 0x30}, {x4, 0x38}, {x5, 0x40}, {x6, 0x48}, {x7, 0x50}, {x8, 0x58}, {x9, 0x60}, {x10, 0x68}, {x11, 0x70}, {x12, 0x78}, {x13, 0x80}, {x14, 0x88}, {x15, 0x90}, {x16, 0x98}, {x17, 0xA0}, {x18, 0xA8}, {x19, 0xB0}, {x20, 0xB8}, {x21, 0xC0}, {x22, 0xC8}, {x23, 0xD0}, {x24, 0xD8}, {x25, 0xE0}, {x26, 0xE8}, {x27, 0xF0}, {x28, 0xF8}, {x29, 0x100}, {lr, 0x108}, {d0, 0x120}, {d1, 0x130}, {d2, 0x140}, {d3, 0x150}, {d4, 0x160}, {d5, 0x170}, {d6, 0x180}, {d7, 0x190}, {d8, 0x1a0}, {d9, 0x1b0}, {d10, 0x1c0}, {d11, 0x1d0}, {d12, 0x1e0}, {d13, 0x1f0}, {d14, 0x200}, {d15, 0x210}, {-1,-1} }}, + { 0x10, 0x00, 0 , 0x0118, 0x120, FALSE, { {x0, 0x18}, {x1, 0x20}, {x2, 0x28}, {x3, 0x30}, {x4, 0x38}, {x5, 0x40}, {x6, 0x48}, {x7, 0x50}, {x8, 0x58}, {x9, 0x60}, {x10, 0x68}, {x11, 0x70}, {x12, 0x78}, {x13, 0x80}, {x14, 0x88}, {x15, 0x90}, {x16, 0x98}, {x17, 0xA0}, {x18, 0xA8}, {x19, 0xB0}, {x20, 0xB8}, {x21, 0xC0}, {x22, 0xC8}, {x23, 0xD0}, {x24, 0xD8}, {x25, 0xE0}, {x26, 0xE8}, {x27, 0xF0}, {x28, 0xF8}, {x29, 0x100}, {lr, 0x108}, {d0, 0x120}, {d1, 0x130}, {d2, 0x140}, {d3, 0x150}, {d4, 0x160}, {d5, 0x170}, {d6, 0x180}, {d7, 0x190}, {d8, 0x1a0}, {d9, 0x1b0}, {d10, 0x1c0}, {d11, 0x1d0}, {d12, 0x1e0}, {d13, 0x1f0}, {d14, 0x200}, {d15, 0x210}, {-1,-1} }}, };
static const BYTE function_4[] = diff --git a/dlls/ntdll/unwind.c b/dlls/ntdll/unwind.c index 270410adf82..7ca744bc4f8 100644 --- a/dlls/ntdll/unwind.c +++ b/dlls/ntdll/unwind.c @@ -306,8 +306,8 @@ static unsigned int get_sequence_len( BYTE *ptr, BYTE *end ) while (ptr < end) { if (*ptr == 0xe4 || *ptr == 0xe5) break; + if ((*ptr & 0xf8) != 0xe8) ret++; /* custom stack frames don't count */ ptr += unwind_code_len[*ptr]; - ret++; } return ret; }