From: Jaime C. <jca...@gm...> - 2008-01-10 19:15:19
|
Hi! I'd like to know what are the MMU requirements to run Sheepshaver (in order to port it to other PPC OSes like AmigaOS4, MorphOS or AROS-PPC). Unfortunately I'm not used to work with MMU so I may be wrong in some parts. The idea is running SheepShaver like Shapeshifter/BasiliskII/Fusion/iFusion did on AmigaOS, reserving a part of the memory for the emulated Mac and using the cpu and memory directly. As far as I understand: 1.-The PPC ROM is patched so it doesn't seek some bits of real mac hardware. IIRC it can be placed in any part of the emulated mac memory area so you don't have to use the MMU to remap it. The PPC ROM was usually placed in a fixed address in real Macs until "newworld" macs were released. Newworld macs load the "rom" in memory so it has to be patched less. So I think you may want to use the MMU to mark it as read-only but that's nearly all. 2.-The first (32?) kilobytes of memory are used by MacOS Classic to store program variables or global settings, I can't remember. This part can't be patched by our emulator as apps or MacOS are hardcoded to write in that memory area. In AmigaOS3.x a special command was used to keep those kilobytes of memory free for the emulator. Unfortunately that would not be longer possible with AmigaOS4 and MorphOS (and it isn't likely to change in future versions) and when an app tried to write in that memory area I guess that an exception would be launched. Unfortunately I don't know if reading would work... I hope it doesn't but I doubt that memory area is read-protected since some parts of the kernel and OS may read it. If that memory area can be read directly it will probably rule out MorphOS as it doesn't provide a way to access the MMU or advanced memory functions to user apps. That would leave two options: 2.1.- When an exception/memory hit is launched because the host OS marks that memory area as not readable/writable, try to catch it some way (I wouldn't have very clear how to do it) and reproduce the operation in a "safe" allocated memory area for the emulator. I don't know if this could work. 2.2- Try to create an special "MMU context" for the emulator so it remaps the first kilobytes of memory into another area we have reserved. When the illegal instruction that turns back control of the cpu to the host OS is executed, the original MMU context should be restored so host OS functions aren't affected by this. I don't know if the AmigaOS4 API allows this (amigaos3 mmu.library provided functionality to do this). I guess this could be the right way to do it. 2.3.- I think AmigaOS4 provides at least functions to mark the first kilobytes of memory as not readable/writable so at least we may notice when the data is being accessed. I still don't understand clearly how could I "catch" this access and reproduce the changes in another memory area. So... is MMU used somewhere else in SheepShaver? -- Saludos/Best Regards Jaime Cagigal |