--- SheepShaver/src/include/cpu_emulation.h 2004/01/24 11:28:05 1.11 +++ SheepShaver/src/include/cpu_emulation.h 2008/01/01 09:47:39 1.16 @@ -1,7 +1,7 @@ /* * cpu_emulation.h - Definitions for CPU emulation and Mac memory access * - * SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig + * SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,8 @@ const uintptr ROM_BASE = 0x40800000; / const uint32 ROM_SIZE = 0x400000; // Size of ROM file const uint32 ROM_AREA_SIZE = 0x500000; // Size of ROM area const uintptr ROM_END = ROM_BASE + ROM_SIZE; // End of ROM +const uintptr DR_EMULATOR_BASE = 0x68070000; // Address of DR emulator code +const uint32 DR_EMULATOR_SIZE = 0x10000; // Size of DR emulator code const uintptr DR_CACHE_BASE = 0x69000000; // Address of DR cache const uint32 DR_CACHE_SIZE = 0x80000; // Size of DR Cache @@ -52,6 +54,8 @@ struct KernelData { // RAM and ROM pointers (allocated and set by main_*.cpp) extern uint32 RAMBase; // Base address of Mac RAM extern uint32 RAMSize; // Size address of Mac RAM +extern uint8 *RAMBaseHost; // Base address of Mac RAM (host address space) +extern uint8 *ROMBaseHost; // Base address of Mac ROM (host address space) // Mac memory access functions #if EMULATED_PPC @@ -64,6 +68,7 @@ static inline uint32 ReadMacInt32(uint32 static inline void WriteMacInt32(uint32 addr, uint32 v) {vm_write_memory_4(addr, v);} static inline uint64 ReadMacInt64(uint32 addr) {return vm_read_memory_8(addr);} static inline void WriteMacInt64(uint32 addr, uint64 v) {vm_write_memory_8(addr, v);} +static inline uint32 Host2MacAddr(uint8 *addr) {return vm_do_get_virtual_address(addr);} static inline uint8 *Mac2HostAddr(uint32 addr) {return vm_do_get_real_address(addr);} static inline void *Mac_memset(uint32 addr, int c, size_t n) {return vm_memset(addr, c, n);} static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return vm_memcpy(dest, src, n);} @@ -78,6 +83,7 @@ static inline uint64 ReadMacInt64(uint32 static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = w;} static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = l;} static inline void WriteMacInt64(uint32 addr, uint64 ll) {*(uint64 *)addr = ll;} +static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);}