未验证 提交 8eb13798 编写于 作者: U Ulrich Weigand 提交者: GitHub

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
上级 c95aa3f4
......@@ -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
......
......@@ -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
......
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册