Always allocate RAM and ROM areas at the same time. This avoids having ROM

suddenly allocated below RAM and thus not working. Besides, this may fix a
latent deallocation bug in real addressing mode (i.e. release the whole
block allocated at once, not separately).

Side effect: this makes Basilisk II work in direct addressing mode with JIT
on Darwin 8.0.1 for x86.
This commit is contained in:
gbeauche 2005-06-13 20:19:15 +00:00
parent 334f9ce018
commit 957bee00cf

View File

@ -567,12 +567,13 @@ int main(int argc, char **argv)
// Speculatively enables 33-bit addressing
ThirtyThreeBitAddressing = true;
#endif
RAMBaseHost = (uint8 *)vm_acquire_mac(RAMSize);
ROMBaseHost = (uint8 *)vm_acquire_mac(0x100000);
if (RAMBaseHost == VM_MAP_FAILED || ROMBaseHost == VM_MAP_FAILED) {
uint8 *ram_rom_area = (uint8 *)vm_acquire_mac(RAMSize + 0x100000);
if (ram_rom_area == VM_MAP_FAILED) {
ErrorAlert(STR_NO_MEM_ERR);
QuitEmulator();
}
RAMBaseHost = ram_rom_area;
ROMBaseHost = RAMBaseHost + RAMSize;
}
#if USE_SCRATCHMEM_SUBTERFUGE
@ -850,11 +851,8 @@ void QuitEmulator(void)
// Free ROM/RAM areas
if (RAMBaseHost != VM_MAP_FAILED) {
vm_release(RAMBaseHost, RAMSize);
vm_release(RAMBaseHost, RAMSize + 0x100000);
RAMBaseHost = NULL;
}
if (ROMBaseHost != VM_MAP_FAILED) {
vm_release(ROMBaseHost, 0x100000);
ROMBaseHost = NULL;
}