1 |
|
/* |
2 |
|
* cpu_emulation.h - Definitions for CPU emulation and Mac memory access |
3 |
|
* |
4 |
< |
* SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig |
4 |
> |
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
54 |
|
// RAM and ROM pointers (allocated and set by main_*.cpp) |
55 |
|
extern uint32 RAMBase; // Base address of Mac RAM |
56 |
|
extern uint32 RAMSize; // Size address of Mac RAM |
57 |
+ |
extern uint8 *RAMBaseHost; // Base address of Mac RAM (host address space) |
58 |
+ |
extern uint8 *ROMBaseHost; // Base address of Mac ROM (host address space) |
59 |
|
|
60 |
|
// Mac memory access functions |
61 |
|
#if EMULATED_PPC |
68 |
|
static inline void WriteMacInt32(uint32 addr, uint32 v) {vm_write_memory_4(addr, v);} |
69 |
|
static inline uint64 ReadMacInt64(uint32 addr) {return vm_read_memory_8(addr);} |
70 |
|
static inline void WriteMacInt64(uint32 addr, uint64 v) {vm_write_memory_8(addr, v);} |
71 |
+ |
static inline uint32 Host2MacAddr(uint8 *addr) {return vm_do_get_virtual_address(addr);} |
72 |
|
static inline uint8 *Mac2HostAddr(uint32 addr) {return vm_do_get_real_address(addr);} |
73 |
|
static inline void *Mac_memset(uint32 addr, int c, size_t n) {return vm_memset(addr, c, n);} |
74 |
|
static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return vm_memcpy(dest, src, n);} |
83 |
|
static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = w;} |
84 |
|
static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = l;} |
85 |
|
static inline void WriteMacInt64(uint32 addr, uint64 ll) {*(uint64 *)addr = ll;} |
86 |
+ |
static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} |
87 |
|
static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} |
88 |
|
static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} |
89 |
|
static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);} |