# HG changeset patch # User nkeynes # Date 1266715199 -36000 # Node ID de9ad2c0cf5696c3c59d45a8bc0f783d1d6bc2a4 # Parent 957b76b312cc503fc6d32aee7d2002a210a2665e Update sh4r.pc before doing the syscall - mainly so that debugging etc statements come out with a useful PC value rather than the syscall id --- a/src/bios.c Sun Feb 21 11:11:30 2010 +1000 +++ b/src/bios.c Sun Feb 21 11:19:59 2010 +1000 @@ -27,6 +27,8 @@ #include "drivers/cdrom/isoread.h" #include "gdrom/gdrom.h" +gboolean bios_boot_gdrom_disc( void ); + /* Definitions from KOS */ #define COMMAND_QUEUE_LENGTH 16 @@ -368,9 +370,7 @@ { /* Initialize hardware */ /* Boot disc if present */ - if( bios_boot_gdrom_disc() ) { - sh4r.pr = sh4r.pc; /* Set the syscall return address to the bootstrap entry */ - } else { + if( !bios_boot_gdrom_disc() ) { dreamcast_stop(); } } --- a/src/sh4/sh4core.in Sun Feb 21 11:11:30 2010 +1000 +++ b/src/sh4/sh4core.in Sun Feb 21 11:19:59 2010 +1000 @@ -364,10 +364,10 @@ pc = sh4r.pc; if( pc > 0xFFFFFF00 ) { /* SYSCALL Magic */ + sh4r.in_delay_slot = 0; + sh4r.pc = sh4r.pr; + sh4r.new_pc = sh4r.pc + 2; syscall_invoke( pc ); - sh4r.in_delay_slot = 0; - pc = sh4r.pc = sh4r.pr; - sh4r.new_pc = sh4r.pc + 2; return TRUE; } CHECKRALIGN16(pc); --- a/src/sh4/sh4trans.c Sun Feb 21 11:11:30 2010 +1000 +++ b/src/sh4/sh4trans.c Sun Feb 21 11:19:59 2010 +1000 @@ -47,9 +47,10 @@ if( code == NULL ) { if( IS_SYSCALL(sh4r.pc) ) { - syscall_invoke( sh4r.pc ); + uint32_t pc = sh4r.pc; + sh4r.pc = sh4r.pr; sh4r.in_delay_slot = 0; - sh4r.pc = sh4r.pr; + syscall_invoke( pc ); } code = xlat_get_code_by_vma( sh4r.pc );