summaryrefslogtreecommitdiff
path: root/cpu.c
diff options
context:
space:
mode:
authorDavid Guillen Fandos2021-03-23 19:05:35 +0100
committerDavid Guillen Fandos2021-03-23 19:09:56 +0100
commit11ec213c99d5d22905ff82cf3fb26ba6a8adf290 (patch)
tree0af3ed99246d3bdb2d2b22f1420bddf2fafba507 /cpu.c
parent7e27010a3c08811e4ed04097e1961009c3fef8d7 (diff)
downloadpicogpsp-11ec213c99d5d22905ff82cf3fb26ba6a8adf290.tar.gz
picogpsp-11ec213c99d5d22905ff82cf3fb26ba6a8adf290.tar.bz2
picogpsp-11ec213c99d5d22905ff82cf3fb26ba6a8adf290.zip
Make ewram memory lineal
This saves a few cycles in MIPS and simplifies a bit the core. Removed the write map, only affects interpreter performance very minimally. Rewired ARM and x86 handlers to support direct access to I/EWRAM (and VRAM on ARM) to compensate. Overall performance is slightly better but code is cleaner and allows for further improvements in the dynarecs.
Diffstat (limited to 'cpu.c')
-rw-r--r--cpu.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/cpu.c b/cpu.c
index 11c947f..ea0d69e 100644
--- a/cpu.c
+++ b/cpu.c
@@ -1003,7 +1003,6 @@ const u32 psr_masks[16] =
#define fast_write_memory(size, type, address, value) \
{ \
- u8 *map; \
u32 _address = (address) & ~(aligned_address_mask##size & 0x03); \
if(_address < 0x10000000) \
{ \
@@ -1011,17 +1010,9 @@ const u32 psr_masks[16] =
memory_writes_##type++; \
} \
\
- if(((_address & aligned_address_mask##size) == 0) && \
- (map = memory_map_write[_address >> 15])) \
- { \
- *((type *)((u8 *)map + (_address & 0x7FFF))) = value; \
- } \
- else \
- { \
- cpu_alert = write_memory##size(_address, value); \
- if(cpu_alert) \
- goto alert; \
- } \
+ cpu_alert = write_memory##size(_address, value); \
+ if(cpu_alert) \
+ goto alert; \
} \
#define load_aligned32(address, dest) \
@@ -1046,22 +1037,14 @@ const u32 psr_masks[16] =
#define store_aligned32(address, value) \
{ \
u32 _address = address; \
- u8 *map = memory_map_write[_address >> 15]; \
if(_address < 0x10000000) \
{ \
memory_region_access_write_u32[_address >> 24]++; \
memory_writes_u32++; \
} \
- if(map) \
- { \
- address32(map, _address & 0x7FFF) = value; \
- } \
- else \
- { \
- cpu_alert = write_memory32(_address, value); \
- if(cpu_alert) \
- goto alert; \
- } \
+ cpu_alert = write_memory32(_address, value); \
+ if(cpu_alert) \
+ goto alert; \
} \
#define load_memory_u8(address, dest) \
@@ -1647,7 +1630,6 @@ void raise_interrupt(irq_type irq_raised)
#ifndef HAVE_DYNAREC
u8 *memory_map_read [8 * 1024];
-u8 *memory_map_write[8 * 1024];
u16 palette_ram[512];
u16 palette_ram_converted[512];
#endif