From fe6ad83317be01ce236c3da3986235b880c292f0 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Tue, 5 Jun 2001 12:16:34 +0000 Subject: [PATCH] - use "volatile" to prevent from optimization for writes to page --- BasiliskII/src/Unix/sigsegv.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BasiliskII/src/Unix/sigsegv.cpp b/BasiliskII/src/Unix/sigsegv.cpp index 4c9a2412..03f09ae2 100644 --- a/BasiliskII/src/Unix/sigsegv.cpp +++ b/BasiliskII/src/Unix/sigsegv.cpp @@ -250,16 +250,16 @@ void sigsegv_deinstall_handler(void) #include #include -static caddr_t page = 0; static int page_size; -static int handler_called = 0; +static volatile char * page = 0; +static volatile int handler_called = 0; static bool sigsegv_test_handler(sigsegv_address_t fault_address, sigsegv_address_t instruction_address) { handler_called++; if ((fault_address - 123) != page) exit(1); - if (mprotect((caddr_t)((unsigned long)fault_address & -page_size), page_size, PROT_READ | PROT_WRITE) != 0) + if (mprotect((char *)((unsigned long)fault_address & -page_size), page_size, PROT_READ | PROT_WRITE) != 0) exit(1); return true; } @@ -271,7 +271,7 @@ int main(void) return 1; page_size = getpagesize(); - page = (caddr_t)mmap(0, page_size, PROT_READ, MAP_PRIVATE, zero_fd, 0); + page = (char *)mmap(0, page_size, PROT_READ, MAP_PRIVATE, zero_fd, 0); if (page == MAP_FAILED) return 1;