summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-10-04 18:30:24 -0700
committerMichael Pavone <pavone@retrodev.com>2016-10-04 18:30:24 -0700
commit1b5d64873657d3a36c1d67c8006d22715140926c (patch)
tree66bf537b3d91d8296477d71bbf0c296f8e216242
parent1c0867451c135eb31f3bbda0235f4326c3aa1043 (diff)
Add a new memory map flag to support an auxilliary buffer for translating code from MMAP_PTR_IDX chunks for which the pointer is null
-rw-r--r--backend.c3
-rw-r--r--backend.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/backend.c b/backend.c
index 1f9e718..c42a7a0 100644
--- a/backend.c
+++ b/backend.c
@@ -65,6 +65,9 @@ void * get_native_pointer(uint32_t address, void ** mem_pointers, cpu_options *
? mem_pointers[memmap[chunk].ptr_index]
: memmap[chunk].buffer;
if (!base) {
+ if (memmap[chunk].flags & MMAP_AUX_BUFF) {
+ return memmap[chunk].buffer + (address & memmap[chunk].aux_mask);
+ }
return NULL;
}
return base + (address & memmap[chunk].mask);
diff --git a/backend.h b/backend.h
index 8c2b1b2..89e5e2e 100644
--- a/backend.h
+++ b/backend.h
@@ -55,6 +55,7 @@ typedef enum {
#define MMAP_ONLY_EVEN 0x20
#define MMAP_FUNC_NULL 0x40
#define MMAP_BYTESWAP 0x80
+#define MMAP_AUX_BUFF 0x100
typedef uint16_t (*read_16_fun)(uint32_t address, void * context);
typedef uint8_t (*read_8_fun)(uint32_t address, void * context);
@@ -65,6 +66,7 @@ typedef struct {
uint32_t start;
uint32_t end;
uint32_t mask;
+ uint32_t aux_mask;
uint16_t ptr_index;
uint16_t flags;
void * buffer;