[PATCH 2/2] ntdll: tests: Test returning an exception handler on arm/arm64

Martin Storsjö wine at gitlab.winehq.org
Thu Jun 9 03:28:21 CDT 2022


From: Martin Storsjö <martin at martin.st>

Signed-off-by: Martin Storsjö <martin at martin.st>
---
 dlls/ntdll/tests/exception.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index aa24ae1704f..e3bfb99e421 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -5140,7 +5140,6 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test )
                                     &runtime_func, &context, &data, &frame, &ctx_ptr );
         if (test->results[i].handler > 0)
         {
-            /* Yet untested */
             ok( (char *)handler == (char *)code_mem + 0x200,
                 "%u/%u: wrong handler %p/%p\n", testnum, i, handler, (char *)code_mem + 0x200 );
             if (handler) ok( *(DWORD *)data == 0x08070605,
@@ -5278,7 +5277,7 @@ static void test_virtual_unwind(void)
 
     static const DWORD unwind_info_0_header =
         (sizeof(function_0)/2) | /* function length */
-        (0 << 20) | /* X */
+        (1 << 20) | /* X */
         (0 << 21) | /* E */
         (0 << 22) | /* F */
         (1 << 23) | /* epilog */
@@ -5309,6 +5308,10 @@ static void test_virtual_unwind(void)
         UWOP_ALLOC_SMALL(32),         /* add sp,  sp,  #32 */
         UWOP_SAVE_RANGE_4_7_LR(6, 1), /* pop {r4-r6,pc} */
         UWOP_END,
+
+        0, 0,                         /* align */
+        0x00, 0x02, 0x00, 0x00,       /* handler */
+        0x05, 0x06, 0x07, 0x08,       /* data */
     };
 
     static const struct results results_0[] =
@@ -5323,7 +5326,7 @@ static void test_virtual_unwind(void)
         { 0x12,  0x10,  0,     0x5c,    0x060, TRUE, { {r4,0x50}, {r5,0x54}, {r6,0x58}, {lr,0x5c}, {d8, 0x1c00000018}, {d9, 0x2400000020}, {d10, 0x2c00000028}, {d3, 0x400000000}, {d4, 0xc00000008}, {d5, 0x1400000010}, {-1,-1} }},
         { 0x16,  0x10,  0,     0x74,    0x078, TRUE, { {r4,0x68}, {r5,0x6c}, {r6,0x70}, {lr,0x74}, {d8, 0x3400000030}, {d9, 0x3c00000038}, {d10, 0x4400000040}, {d3, 0x1c00000018}, {d4, 0x2400000020}, {d5, 0x2c00000028}, {d17, 0x400000000}, {d18, 0xc00000008}, {d19, 0x1400000010}, {-1,-1} }},
         { 0x1a,  0x10,  0,     0x80,    0x084, TRUE, { {r4,0x74}, {r5,0x78}, {r6,0x7c}, {lr,0x80}, {d8, 0x400000003c}, {d9, 0x4800000044}, {d10, 0x500000004c}, {d3, 0x2800000024}, {d4, 0x300000002c}, {d5, 0x3800000034}, {d17, 0x100000000c}, {d18, 0x1800000014}, {d19, 0x200000001c}, {r8,0x00}, {r10,0x04}, {r12,0x08}, {-1,-1} }},
-        { 0x1c,  0x10,  0,     0x90,    0x094, TRUE, { {r4,0x84}, {r5,0x88}, {r6,0x8c}, {lr,0x90}, {d8, 0x500000004c}, {d9, 0x5800000054}, {d10, 0x600000005c}, {d3, 0x3800000034}, {d4, 0x400000003c}, {d5, 0x4800000044}, {d17, 0x200000001c}, {d18, 0x2800000024}, {d19, 0x300000002c}, {r8,0x10}, {r10,0x14}, {r12,0x18}, {-1,-1} }},
+        { 0x1c,  0x10,  1,     0x90,    0x094, TRUE, { {r4,0x84}, {r5,0x88}, {r6,0x8c}, {lr,0x90}, {d8, 0x500000004c}, {d9, 0x5800000054}, {d10, 0x600000005c}, {d3, 0x3800000034}, {d4, 0x400000003c}, {d5, 0x4800000044}, {d17, 0x200000001c}, {d18, 0x2800000024}, {d19, 0x300000002c}, {r8,0x10}, {r10,0x14}, {r12,0x18}, {-1,-1} }},
         { 0x1e,  0x10,  0,     0x3c,    0x040, TRUE, { {r4,0x30}, {r5,0x34}, {r6,0x38}, {lr,0x3c}, {d8, 0x400000000}, {d9, 0xc00000008}, {d10, 0x1400000010}, {-1,-1} }},
         { 0x22,  0x10,  0,     0x3c,    0x040, TRUE, { {r4,0x30}, {r5,0x34}, {r6,0x38}, {lr,0x3c}, {-1,-1} }},
         { 0x24,  0x10,  0,     0x2c,    0x030, TRUE, { {r4,0x20}, {r5,0x24}, {r6,0x28}, {lr,0x2c}, {-1,-1} }},
@@ -6818,7 +6821,6 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test )
                                     &runtime_func, &context, &data, &frame, &ctx_ptr );
         if (test->results[i].handler > 0)
         {
-            /* Yet untested */
             ok( (char *)handler == (char *)code_mem + 0x200,
                 "%u/%u: wrong handler %p/%p\n", testnum, i, handler, (char *)code_mem + 0x200 );
             if (handler) ok( *(DWORD *)data == 0x08070605,
@@ -6934,7 +6936,7 @@ static void test_virtual_unwind(void)
 
     static const DWORD unwind_info_0_header =
         (sizeof(function_0)/4) | /* function length */
-        (0 << 20) | /* X */
+        (1 << 20) | /* X */
         (0 << 21) | /* E */
         (1 << 22) | /* epilog */
         (2 << 27);  /* codes */
@@ -6954,6 +6956,9 @@ static void test_virtual_unwind(void)
         UWOP_SAVE_REGP(19, 16), /* stp x19, x20, [sp, #16] */
         UWOP_ALLOC_SMALL(32),   /* sub sp,  sp,  #32 */
         UWOP_END,
+
+        0x00, 0x02, 0x00, 0x00, /* handler */
+        0x05, 0x06, 0x07, 0x08, /* data */
     };
 
     static const struct results results_0[] =
@@ -6961,7 +6966,7 @@ static void test_virtual_unwind(void)
       /* offset  fp    handler  pc      frame offset  registers */
         { 0x00,  0x00,  0,     ORIG_LR, 0x000, TRUE, { {-1,-1} }},
         { 0x04,  0x00,  0,     ORIG_LR, 0x020, TRUE, { {-1,-1} }},
-        { 0x08,  0x00,  0,     ORIG_LR, 0x020, TRUE, { {x19,0x10}, {x20,0x18}, {-1,-1} }},
+        { 0x08,  0x00,  1,     ORIG_LR, 0x020, TRUE, { {x19,0x10}, {x20,0x18}, {-1,-1} }},
         { 0x0c,  0x00,  0,     ORIG_LR, 0x020, TRUE, { {x19,0x10}, {x20,0x18}, {-1,-1} }},
         { 0x10,  0x00,  0,     ORIG_LR, 0x020, TRUE, { {-1,-1} }},
         { 0x14,  0x00,  0,     ORIG_LR, 0x000, TRUE, { {-1,-1} }},
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/214



More information about the wine-devel mailing list