From: Ulrich Weigand Date: Wed, 26 May 2021 20:06:54 +0000 (+0200) Subject: Build support for s390x: Fix a few paltests (#53288) X-Git-Tag: submit/tizen/20210909.063632~1131 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8eb13798e8b9033c995f7ea7ba2d4527089abe91;p=platform%2Fupstream%2Fdotnet%2Fruntime.git 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 --- 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 c39a856..1ed1e1f 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 9b10c03..10be0de 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 aed4d61..b9a714b 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");