filename | src/mem.h |
changeset | 931:430048ea8b71 |
prev | 929:fd8cb0c82f5f |
next | 934:3acd3b3ee6d1 |
author | nkeynes |
date | Tue Dec 23 05:48:05 2008 +0000 (13 years ago) |
branch | lxdream-mem |
permissions | -rw-r--r-- |
last change | More refactoring and general cleanup. Most things should be working again now. Split off cache and start real implementation, breaking save states in the process |
file | annotate | diff | log | raw |
1.1 --- a/src/mem.h Sat Dec 20 03:01:40 2008 +00001.2 +++ b/src/mem.h Tue Dec 23 05:48:05 2008 +00001.3 @@ -22,11 +22,16 @@1.5 #include <stdint.h>1.6 #include "lxdream.h"1.7 +#include "hook.h"1.9 #ifdef __cplusplus1.10 extern "C" {1.11 #endif1.13 +/**1.14 + * Basic memory region vtable - read/write at byte, word, long, and burst1.15 + * (32-byte) sizes.1.16 + */1.17 typedef struct mem_region_fn {1.18 FASTCALL int32_t (*read_long)(sh4addr_t addr);1.19 FASTCALL void (*write_long)(sh4addr_t addr, uint32_t val);1.20 @@ -37,7 +42,13 @@1.21 FASTCALL void (*read_burst)(unsigned char *dest, sh4addr_t addr);1.22 FASTCALL void (*write_burst)(sh4addr_t addr, unsigned char *src);1.23 } *mem_region_fn_t;1.24 -1.25 +1.26 +int32_t FASTCALL unmapped_read_long( sh4addr_t addr );1.27 +void FASTCALL unmapped_write_long( sh4addr_t addr, uint32_t val );1.28 +void FASTCALL unmapped_read_burst( unsigned char *dest, sh4addr_t addr );1.29 +void FASTCALL unmapped_write_burst( sh4addr_t addr, unsigned char *src );1.30 +extern struct mem_region_fn mem_region_unmapped;1.31 +1.32 typedef struct mem_region {1.33 uint32_t base;1.34 uint32_t size;1.35 @@ -48,18 +59,24 @@1.36 } *mem_region_t;1.38 #define MAX_IO_REGIONS 241.39 -#define MAX_MEM_REGIONS 81.40 +#define MAX_MEM_REGIONS 161.42 #define MEM_REGION_BIOS "Bios ROM"1.43 #define MEM_REGION_MAIN "System RAM"1.44 #define MEM_REGION_VIDEO "Video RAM"1.45 +#define MEM_REGION_VIDEO64 "Video RAM 64-bit"1.46 #define MEM_REGION_AUDIO "Audio RAM"1.47 #define MEM_REGION_AUDIO_SCRATCH "Audio Scratch RAM"1.48 #define MEM_REGION_FLASH "System Flash"1.50 +typedef gboolean (*mem_page_remapped_hook_t)(sh4addr_t page, mem_region_fn_t newfn, void *user_data);1.51 +DECLARE_HOOK( mem_page_remapped_hook, mem_page_remapped_hook_t );1.52 +1.53 void *mem_create_ram_region( uint32_t base, uint32_t size, const char *name, mem_region_fn_t fn );1.54 void *mem_create_repeating_ram_region( uint32_t base, uint32_t size, const char *name, mem_region_fn_t fn,1.55 uint32_t repeat_offset, uint32_t last_repeat );1.56 +void register_misc_region( uint32_t base, uint32_t size, const char *name, mem_region_fn_t fn );1.57 +1.58 /**1.59 * Load a ROM image from the specified filename. If the memory region has not1.60 * been allocated, it is created now, otherwise the existing region is reused.1.61 @@ -114,6 +131,15 @@1.62 watch_point_t mem_is_watched( uint32_t addr, int size, int op );1.64 extern sh4ptr_t *page_map;1.65 +extern mem_region_fn_t *ext_address_space;1.66 +1.67 +#define SIGNEXT4(n) ((((int32_t)(n))<<28)>>28)1.68 +#define SIGNEXT8(n) ((int32_t)((int8_t)(n)))1.69 +#define SIGNEXT12(n) ((((int32_t)(n))<<20)>>20)1.70 +#define SIGNEXT16(n) ((int32_t)((int16_t)(n)))1.71 +#define SIGNEXT32(n) ((int64_t)((int32_t)(n)))1.72 +#define SIGNEXT48(n) ((((int64_t)(n))<<16)>>16)1.73 +#define ZEROEXT32(n) ((int64_t)((uint64_t)((uint32_t)(n))))1.75 #ifdef __cplusplus1.76 }
.