diff backend.h @ 653:a18e3923481e

Remove some of the hard coded assumptions about the memory map from the CPU cores
author Michael Pavone <pavone@retrodev.com>
date Thu, 01 Jan 2015 14:36:55 -0800
parents 9d6fed6501ba
children 30ccf56842d6
line wrap: on
line diff
--- a/backend.h	Tue Dec 30 19:11:34 2014 -0800
+++ b/backend.h	Thu Jan 01 14:36:55 2015 -0800
@@ -46,33 +46,6 @@
 	WRITE_8
 } ftype;
 
-typedef struct {
-	uint32_t flags;
-	native_map_slot *native_code_map;
-	deferred_addr   *deferred;
-	code_info       code;
-	uint8_t         **ram_inst_sizes;
-	code_ptr        save_context;
-	code_ptr        load_context;
-	code_ptr        handle_cycle_limit;
-	code_ptr        handle_cycle_limit_int;
-	code_ptr        handle_code_write;
-	uint32_t        address_mask;
-	uint32_t        max_address;
-	uint32_t        bus_cycles;
-	int32_t         mem_ptr_off;
-	int32_t         ram_flags_off;
-	uint8_t         ram_flags_shift;
-	uint8_t         address_size;
-	uint8_t         byte_swap;
-	uint8_t         context_reg;
-	uint8_t         cycles;
-	uint8_t         limit;
-	uint8_t			scratch1;
-	uint8_t			scratch2;
-} cpu_options;
-
-
 #define MMAP_READ      0x01
 #define MMAP_WRITE     0x02
 #define MMAP_CODE      0x04
@@ -100,6 +73,34 @@
 	write_8_fun  write_8;
 } memmap_chunk;
 
+typedef struct {
+	uint32_t flags;
+	native_map_slot    *native_code_map;
+	deferred_addr      *deferred;
+	code_info          code;
+	uint8_t            **ram_inst_sizes;
+	memmap_chunk const *memmap;
+	code_ptr           save_context;
+	code_ptr           load_context;
+	code_ptr           handle_cycle_limit;
+	code_ptr           handle_cycle_limit_int;
+	code_ptr           handle_code_write;
+	uint32_t           memmap_chunks;
+	uint32_t           address_mask;
+	uint32_t           max_address;
+	uint32_t           bus_cycles;
+	int32_t            mem_ptr_off;
+	int32_t            ram_flags_off;
+	uint8_t            ram_flags_shift;
+	uint8_t            address_size;
+	uint8_t            byte_swap;
+	uint8_t            context_reg;
+	uint8_t            cycles;
+	uint8_t            limit;
+	uint8_t			   scratch1;
+	uint8_t			   scratch2;
+} cpu_options;
+
 typedef uint8_t * (*native_addr_func)(void * context, uint32_t address);
 
 deferred_addr * defer_address(deferred_addr * old_head, uint32_t address, uint8_t *dest);
@@ -112,6 +113,7 @@
 void check_code_prologue(code_info *code);
 
 code_ptr gen_mem_fun(cpu_options * opts, memmap_chunk const * memmap, uint32_t num_chunks, ftype fun_type, code_ptr *after_inc);
+void * get_native_pointer(uint32_t address, void ** mem_pointers, cpu_options * opts);
 
 #endif //BACKEND_H_