ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/main_unix.cpp
(Generate patch)

Comparing SheepShaver/src/Unix/main_unix.cpp (file contents):
Revision 1.42 by gbeauche, 2004-06-24T15:37:25Z vs.
Revision 1.43 by gbeauche, 2004-06-26T15:26:17Z

# Line 335 | Line 335 | static void *tick_func(void *arg);
335   extern void emul_ppc(uint32 start);
336   extern void init_emul_ppc(void);
337   extern void exit_emul_ppc(void);
338 + sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t);
339   #else
340   static void sigusr2_handler(int sig, siginfo_t *sip, void *scp);
341   static void sigsegv_handler(int sig, siginfo_t *sip, void *scp);
# Line 509 | Line 510 | int main(int argc, char **argv)
510          mon_init();
511   #endif
512  
513 + #if !EMULATED_PPC
514 +        // Install SIGSEGV and SIGBUS handlers
515 +        sigemptyset(&sigsegv_action.sa_mask);   // Block interrupts during SEGV handling
516 +        sigaddset(&sigsegv_action.sa_mask, SIGUSR2);
517 +        sigsegv_action.sa_sigaction = sigsegv_handler;
518 +        sigsegv_action.sa_flags = SA_ONSTACK | SA_SIGINFO;
519 + #ifdef HAVE_SIGNAL_SA_RESTORER
520 +        sigsegv_action.sa_restorer = NULL;
521 + #endif
522 +        if (sigaction(SIGSEGV, &sigsegv_action, NULL) < 0) {
523 +                sprintf(str, GetString(STR_SIGSEGV_INSTALL_ERR), strerror(errno));
524 +                ErrorAlert(str);
525 +                goto quit;
526 +        }
527 +        if (sigaction(SIGBUS, &sigsegv_action, NULL) < 0) {
528 +                sprintf(str, GetString(STR_SIGSEGV_INSTALL_ERR), strerror(errno));
529 +                ErrorAlert(str);
530 +                goto quit;
531 +        }
532 + #else
533 +        // Install SIGSEGV handler for CPU emulator
534 +        if (!sigsegv_install_handler(sigsegv_handler)) {
535 +                sprintf(str, GetString(STR_SIGSEGV_INSTALL_ERR), strerror(errno));
536 +                ErrorAlert(str);
537 +                goto quit;
538 +        }
539 + #endif
540 +
541 +        // Initialize VM system
542 +        vm_init();
543 +
544          // Get system info
545          PVR = 0x00040000;                       // Default: 604
546          CPUClockSpeed = 100000000;      // Default: 100MHz
# Line 962 | Line 994 | int main(int argc, char **argv)
994   #endif
995  
996   #if !EMULATED_PPC
965        // Install SIGSEGV and SIGBUS handlers
966        sigemptyset(&sigsegv_action.sa_mask);   // Block interrupts during SEGV handling
967        sigaddset(&sigsegv_action.sa_mask, SIGUSR2);
968        sigsegv_action.sa_sigaction = sigsegv_handler;
969        sigsegv_action.sa_flags = SA_ONSTACK | SA_SIGINFO;
970 #ifdef HAVE_SIGNAL_SA_RESTORER
971        sigsegv_action.sa_restorer = NULL;
972 #endif
973        if (sigaction(SIGSEGV, &sigsegv_action, NULL) < 0) {
974                sprintf(str, GetString(STR_SIGSEGV_INSTALL_ERR), strerror(errno));
975                ErrorAlert(str);
976                goto quit;
977        }
978        if (sigaction(SIGBUS, &sigsegv_action, NULL) < 0) {
979                sprintf(str, GetString(STR_SIGSEGV_INSTALL_ERR), strerror(errno));
980                ErrorAlert(str);
981                goto quit;
982        }
983
997          // Install SIGILL handler
998          sigemptyset(&sigill_action.sa_mask);    // Block interrupts during ILL handling
999          sigaddset(&sigill_action.sa_mask, SIGUSR2);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines