From 0665ab113912327dc9df4b7d377c698d7f15da88 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sun, 18 Jan 2004 22:22:28 +0000 Subject: [PATCH] No need to map ROM executable on emulated/ppc. Make sure to detect unaligned EA for lmw/stmw with real addr instead of relying on the signal number. --- SheepShaver/src/Unix/main_unix.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SheepShaver/src/Unix/main_unix.cpp b/SheepShaver/src/Unix/main_unix.cpp index 832d0357..8e69e3b4 100644 --- a/SheepShaver/src/Unix/main_unix.cpp +++ b/SheepShaver/src/Unix/main_unix.cpp @@ -561,7 +561,7 @@ int main(int argc, char **argv) ErrorAlert(str); goto quit; } -#if !EMULATED_PPC || defined(__powerpc__) +#if !EMULATED_PPC if (vm_protect((char *)ROM_BASE, ROM_AREA_SIZE, VM_PAGE_READ | VM_PAGE_WRITE | VM_PAGE_EXECUTE) < 0) { sprintf(str, GetString(STR_ROM_MMAP_ERR), strerror(errno)); ErrorAlert(str); @@ -1627,8 +1627,8 @@ static void sigsegv_handler(int sig, siginfo_t *sip, void *scp) transfer_type = TYPE_STORE; transfer_size = SIZE_HALFWORD; addr_mode = MODE_U; break; #if EMULATE_UNALIGNED_LOADSTORE_MULTIPLE case 46: // lmw - if (sig == SIGBUS) { - uint32 ea = (ra == 0 ? 0 : r->gpr(ra)) + imm; + if ((addr % 4) != 0) { + uint32 ea = addr; D(bug("WARNING: unaligned lmw to EA=%08x from IP=%08x\n", ea, r->pc())); for (int i = rd; i <= 31; i++) { r->gpr(i) = ReadMacInt32(ea); @@ -1639,8 +1639,8 @@ static void sigsegv_handler(int sig, siginfo_t *sip, void *scp) } break; case 47: // stmw - if (sig == SIGBUS) { - uint32 ea = (ra == 0 ? 0 : r->gpr(ra)) + imm; + if ((addr % 4) != 0) { + uint32 ea = addr; D(bug("WARNING: unaligned stmw to EA=%08x from IP=%08x\n", ea, r->pc())); for (int i = rd; i <= 31; i++) { WriteMacInt32(ea, r->gpr(i));