273 |
|
static const char *crash_reason = NULL; // Reason of the crash (SIGSEGV, SIGBUS, SIGILL) |
274 |
|
#endif |
275 |
|
|
276 |
+ |
uint32 SheepMem::page_size; // Size of a native page |
277 |
|
uintptr SheepMem::zero_page = 0; // Address of ro page filled in with zeros |
278 |
|
uintptr SheepMem::base = 0x60000000; // Address of SheepShaver data |
279 |
|
uintptr SheepMem::top = 0; // Top of SheepShaver data (stack like storage) |
1660 |
|
#endif |
1661 |
|
} |
1662 |
|
|
1663 |
< |
// Ignore ROM writes |
1664 |
< |
if (transfer_type == TYPE_STORE && addr >= ROM_BASE && addr < ROM_BASE + ROM_SIZE) { |
1663 |
> |
// Ignore ROM writes (including to the zero page, which is read-only) |
1664 |
> |
if (transfer_type == TYPE_STORE && |
1665 |
> |
((addr >= ROM_BASE && addr < ROM_BASE + ROM_SIZE) || |
1666 |
> |
(addr >= SheepMem::ZeroPage() && addr < SheepMem::ZeroPage() + SheepMem::PageSize()))) { |
1667 |
|
// D(bug("WARNING: %s write access to ROM at %08lx, pc %08lx\n", transfer_size == SIZE_BYTE ? "Byte" : transfer_size == SIZE_HALFWORD ? "Halfword" : "Word", addr, r->pc())); |
1668 |
|
if (addr_mode == MODE_U || addr_mode == MODE_UX) |
1669 |
|
r->gpr(ra) = addr; |
1907 |
|
|
1908 |
|
bool SheepMem::Init(void) |
1909 |
|
{ |
1910 |
< |
const int page_size = getpagesize(); |
1910 |
> |
// Size of a native page |
1911 |
> |
page_size = getpagesize(); |
1912 |
|
|
1913 |
|
// Allocate SheepShaver globals |
1914 |
|
if (vm_acquire_fixed((char *)base, size) < 0) |
1936 |
|
void SheepMem::Exit(void) |
1937 |
|
{ |
1938 |
|
if (top) { |
1935 |
– |
const int page_size = getpagesize(); |
1936 |
– |
|
1939 |
|
// Delete SheepShaver globals |
1940 |
|
vm_release((void *)base, size); |
1941 |
|
|