43 |
|
#include <stdio.h> |
44 |
|
#include <stdlib.h> |
45 |
|
|
46 |
+ |
#ifdef USE_SDL_VIDEO |
47 |
+ |
#include <SDL_events.h> |
48 |
+ |
#endif |
49 |
+ |
|
50 |
|
#if ENABLE_MON |
51 |
|
#include "mon.h" |
52 |
|
#include "mon_disass.h" |
112 |
|
static KernelData * const kernel_data = (KernelData *)KERNEL_DATA_BASE; |
113 |
|
|
114 |
|
// SIGSEGV handler |
115 |
< |
static sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t); |
115 |
> |
sigsegv_return_t sigsegv_handler(sigsegv_address_t, sigsegv_address_t); |
116 |
|
|
117 |
|
#if PPC_ENABLE_JIT && PPC_REENTRANT_JIT |
118 |
|
// Special trampolines for EmulOp and NativeOp |
450 |
|
status = COMPILE_CODE_OK; |
451 |
|
break; |
452 |
|
#endif |
449 |
– |
case NATIVE_DISABLE_INTERRUPT: |
450 |
– |
dg.gen_invoke(DisableInterrupt); |
451 |
– |
status = COMPILE_CODE_OK; |
452 |
– |
break; |
453 |
– |
case NATIVE_ENABLE_INTERRUPT: |
454 |
– |
dg.gen_invoke(EnableInterrupt); |
455 |
– |
status = COMPILE_CODE_OK; |
456 |
– |
break; |
453 |
|
case NATIVE_BITBLT: |
454 |
|
dg.gen_load_T0_GPR(3); |
455 |
|
dg.gen_invoke_T0((void (*)(uint32))NQD_bitblt); |
880 |
|
* Initialize CPU emulation |
881 |
|
*/ |
882 |
|
|
883 |
< |
static sigsegv_return_t sigsegv_handler(sigsegv_address_t fault_address, sigsegv_address_t fault_instruction) |
883 |
> |
sigsegv_return_t sigsegv_handler(sigsegv_address_t fault_address, sigsegv_address_t fault_instruction) |
884 |
|
{ |
885 |
|
#if ENABLE_VOSF |
886 |
|
// Handle screen fault |
958 |
|
ppc_cpu->set_register(powerpc_registers::GPR(4), any_register(KernelDataAddr + 0x1000)); |
959 |
|
WriteMacInt32(XLM_RUN_MODE, MODE_68K); |
960 |
|
|
965 |
– |
// Install the handler for SIGSEGV |
966 |
– |
sigsegv_install_handler(sigsegv_handler); |
967 |
– |
|
961 |
|
#if ENABLE_MON |
962 |
|
// Install "regs" command in cxmon |
963 |
|
mon_add_command("regs", dump_registers, "regs Dump PowerPC registers\n"); |
1060 |
|
|
1061 |
|
void sheepshaver_cpu::handle_interrupt(void) |
1062 |
|
{ |
1063 |
< |
// Do nothing if interrupts are disabled |
1064 |
< |
if (*(int32 *)XLM_IRQ_NEST > 0) |
1065 |
< |
return; |
1063 |
> |
#ifdef USE_SDL_VIDEO |
1064 |
> |
// We must fill in the events queue in the same thread that did call SDL_SetVideoMode() |
1065 |
> |
SDL_PumpEvents(); |
1066 |
> |
#endif |
1067 |
|
|
1068 |
< |
// Do nothing if there is no interrupt pending |
1069 |
< |
if (InterruptFlags == 0) |
1068 |
> |
// Do nothing if interrupts are disabled |
1069 |
> |
if (int32(ReadMacInt32(XLM_IRQ_NEST)) > 0) |
1070 |
|
return; |
1071 |
|
|
1072 |
|
// Current interrupt nest level |
1264 |
|
get_resource_callbacks[selector - NATIVE_GET_RESOURCE](); |
1265 |
|
break; |
1266 |
|
} |
1273 |
– |
case NATIVE_DISABLE_INTERRUPT: |
1274 |
– |
DisableInterrupt(); |
1275 |
– |
break; |
1276 |
– |
case NATIVE_ENABLE_INTERRUPT: |
1277 |
– |
EnableInterrupt(); |
1278 |
– |
break; |
1267 |
|
case NATIVE_MAKE_EXECUTABLE: |
1268 |
|
MakeExecutable(0, (void *)gpr(4), gpr(5)); |
1269 |
|
break; |