From 8eb13798e8b9033c995f7ea7ba2d4527089abe91 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 26 May 2021 22:06:54 +0200 Subject: [PATCH] Build support for s390x: Fix a few paltests (#53288) * Accommodate platforms (like s390x) where the SIGSEGV fault address is only provided on a page granularity by the HW/OS * All paltests now pass on s390x --- .../exception_handling/pal_sxs/test1/dlltest1.cpp | 8 ++++---- .../exception_handling/pal_sxs/test1/dlltest2.cpp | 8 ++++---- .../exception_handling/pal_sxs/test1/exceptionsxs.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp index c39a8564612..1ed1e1f88d1 100644 --- a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp +++ b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest1.cpp @@ -45,7 +45,7 @@ DllTest1() PAL_TRY(VOID*, unused, NULL) { - volatile int* p = (volatile int *)0x11; // Invalid pointer + volatile int* p = (volatile int *)0x11000; // Invalid pointer bTry = TRUE; // Indicate we hit the PAL_TRY block FailingFunction(p); // Throw in function to fool C++ runtime into handling @@ -60,10 +60,10 @@ DllTest1() Fail("ERROR: PAL_EXCEPT was hit without PAL_TRY being hit.\n"); } - // Validate that the faulting address is correct; the contents of "p" (0x11). - if (ex.GetExceptionRecord()->ExceptionInformation[1] != 0x11) + // Validate that the faulting address is correct; the contents of "p" (0x11000). + if (ex.GetExceptionRecord()->ExceptionInformation[1] != 0x11000) { - Fail("ERROR: PAL_EXCEPT ExceptionInformation[1] != 0x11\n"); + Fail("ERROR: PAL_EXCEPT ExceptionInformation[1] != 0x11000\n"); } bExcept = TRUE; // Indicate we hit the PAL_EXCEPT block diff --git a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp index 9b10c03d30c..10be0de5598 100644 --- a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp +++ b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/dlltest2.cpp @@ -45,7 +45,7 @@ DllTest2() PAL_TRY(VOID*, unused, NULL) { - volatile int* p = (volatile int *)0x22; // Invalid pointer + volatile int* p = (volatile int *)0x22000; // Invalid pointer bTry = TRUE; // Indicate we hit the PAL_TRY block FailingFunction(p); // Throw in function to fool C++ runtime into handling @@ -60,10 +60,10 @@ DllTest2() Fail("ERROR: PAL_EXCEPT was hit without PAL_TRY being hit.\n"); } - // Validate that the faulting address is correct; the contents of "p" (0x22). - if (ex.GetExceptionRecord()->ExceptionInformation[1] != 0x22) + // Validate that the faulting address is correct; the contents of "p" (0x22000). + if (ex.GetExceptionRecord()->ExceptionInformation[1] != 0x22000) { - Fail("ERROR: PAL_EXCEPT ExceptionInformation[1] != 0x22\n"); + Fail("ERROR: PAL_EXCEPT ExceptionInformation[1] != 0x22000\n"); } bExcept = TRUE; // Indicate we hit the PAL_EXCEPT block diff --git a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp index aed4d6184a5..b9a714ba2ab 100644 --- a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp +++ b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/exceptionsxs.cpp @@ -45,10 +45,10 @@ void sigsegv_handler(int code, siginfo_t *siginfo, void *context) _exit(FAIL); } - // Validate that the faulting address is correct; the contents of "p" (0x22). - if (siginfo->si_addr != (void *)0x33) + // Validate that the faulting address is correct; the contents of "p" (0x33000). + if (siginfo->si_addr != (void *)0x33000) { - printf("ERROR: signal handler faulting address != 0x33\n"); + printf("ERROR: signal handler faulting address != 0x33000\n"); _exit(FAIL); } @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) bSignal = true; - volatile int* p = (volatile int *)0x33; // Invalid pointer + volatile int* p = (volatile int *)0x33000; // Invalid pointer *p = 3; // Causes an access violation exception printf("ERROR: code was executed after the access violation.\n"); -- GitLab