/[cebix]/SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp
ViewVC logotype

Diff of /SheepShaver/src/kpx_cpu/sheepshaver_glue.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by gbeauche, Mon Nov 10 15:11:44 2003 UTC revision 1.17 by gbeauche, Mon Nov 10 16:23:58 2003 UTC
# Line 89  static void enter_mon(void) Line 89  static void enter_mon(void)
89  // Pointer to Kernel Data  // Pointer to Kernel Data
90  static KernelData * const kernel_data = (KernelData *)KERNEL_DATA_BASE;  static KernelData * const kernel_data = (KernelData *)KERNEL_DATA_BASE;
91    
92    // SIGSEGV handler
93    static sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t);
94    
95    
96  /**  /**
97   *              PowerPC emulator glue with special 'sheep' opcodes   *              PowerPC emulator glue with special 'sheep' opcodes
# Line 136  public: Line 139  public:
139          // FIXME: really make surre array allocation fail at link time?          // FIXME: really make surre array allocation fail at link time?
140          void *operator new[](size_t);          void *operator new[](size_t);
141          void operator delete[](void *p);          void operator delete[](void *p);
142    
143            // Make sure the SIGSEGV handler can access CPU registers
144            friend sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t);
145  };  };
146    
147  lazy_allocator< sheepshaver_cpu > allocator_helper< sheepshaver_cpu, lazy_allocator >::allocator;  lazy_allocator< sheepshaver_cpu > allocator_helper< sheepshaver_cpu, lazy_allocator >::allocator;
# Line 554  static sigsegv_return_t sigsegv_handler( Line 560  static sigsegv_return_t sigsegv_handler(
560          if ((addr - ROM_BASE) < ROM_SIZE)          if ((addr - ROM_BASE) < ROM_SIZE)
561                  return SIGSEGV_RETURN_SKIP_INSTRUCTION;                  return SIGSEGV_RETURN_SKIP_INSTRUCTION;
562    
563            // Get program counter of target CPU
564            sheepshaver_cpu * const cpu = current_cpu;
565            const uint32 pc = cpu->pc();
566    
567            // Fault in Mac ROM or RAM?
568            bool mac_fault = (pc >= ROM_BASE) && (pc < (ROM_BASE + ROM_AREA_SIZE)) || (pc >= RAMBase) && (pc < (RAMBase + RAMSize));
569            if (mac_fault) {
570    
571                    // "VM settings" during MacOS 8 installation
572                    if (pc == ROM_BASE + 0x488160 && cpu->gpr(20) == 0xf8000000)
573                            return SIGSEGV_RETURN_SKIP_INSTRUCTION;
574    
575                    // MacOS 8.5 installation
576                    else if (pc == ROM_BASE + 0x488140 && cpu->gpr(16) == 0xf8000000)
577                            return SIGSEGV_RETURN_SKIP_INSTRUCTION;
578    
579                    // MacOS 8 serial drivers on startup
580                    else if (pc == ROM_BASE + 0x48e080 && (cpu->gpr(8) == 0xf3012002 || cpu->gpr(8) == 0xf3012000))
581                            return SIGSEGV_RETURN_SKIP_INSTRUCTION;
582    
583                    // MacOS 8.1 serial drivers on startup
584                    else if (pc == ROM_BASE + 0x48c5e0 && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000))
585                            return SIGSEGV_RETURN_SKIP_INSTRUCTION;
586                    else if (pc == ROM_BASE + 0x4a10a0 && (cpu->gpr(20) == 0xf3012002 || cpu->gpr(20) == 0xf3012000))
587                            return SIGSEGV_RETURN_SKIP_INSTRUCTION;
588    
589          // Ignore all other faults, if requested          // Ignore all other faults, if requested
590          if (PrefsFindBool("ignoresegv"))          if (PrefsFindBool("ignoresegv"))
591                  return SIGSEGV_RETURN_FAILURE;                          return SIGSEGV_RETURN_SKIP_INSTRUCTION;
592            }
593  #else  #else
594  #error "FIXME: You don't have the capability to skip instruction within signal handlers"  #error "FIXME: You don't have the capability to skip instruction within signal handlers"
595  #endif  #endif

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15