comparison m68k_core.h @ 1329:85a90964b557

Fix interaction between 68K debugger and instruction retranslation due to self modifying code or bank switching
author Michael Pavone <pavone@retrodev.com>
date Mon, 24 Apr 2017 20:49:31 -0700
parents 208803173ebc
children df6af7187b36
comparison
equal deleted inserted replaced
1328:70faad89d491 1329:85a90964b557
54 code_ptr native_addr; 54 code_ptr native_addr;
55 code_ptr native_addr_and_sync; 55 code_ptr native_addr_and_sync;
56 code_ptr get_sr; 56 code_ptr get_sr;
57 code_ptr set_sr; 57 code_ptr set_sr;
58 code_ptr set_ccr; 58 code_ptr set_ccr;
59 code_ptr bp_stub;
59 code_info extra_code; 60 code_info extra_code;
60 movem_fun *big_movem; 61 movem_fun *big_movem;
61 uint32_t num_movem; 62 uint32_t num_movem;
62 uint32_t movem_storage; 63 uint32_t movem_storage;
64 code_word prologue_start;
63 } m68k_options; 65 } m68k_options;
64 66
65 typedef struct m68k_context { 67 typedef struct m68k_context m68k_context;
68 typedef void (*m68k_debug_handler)(m68k_context *context, uint32_t pc);
69
70 typedef struct {
71 m68k_debug_handler handler;
72 uint32_t address;
73 } m68k_breakpoint;
74
75 struct m68k_context {
66 uint8_t flags[5]; 76 uint8_t flags[5];
67 uint8_t status; 77 uint8_t status;
68 uint16_t int_ack; 78 uint16_t int_ack;
69 uint32_t dregs[8]; 79 uint32_t dregs[8];
70 uint32_t aregs[9]; 80 uint32_t aregs[9];
77 uint16_t *mem_pointers[NUM_MEM_AREAS]; 87 uint16_t *mem_pointers[NUM_MEM_AREAS];
78 code_ptr resume_pc; 88 code_ptr resume_pc;
79 code_ptr reset_handler; 89 code_ptr reset_handler;
80 m68k_options *options; 90 m68k_options *options;
81 void *system; 91 void *system;
92 m68k_breakpoint *breakpoints;
93 uint32_t num_breakpoints;
94 uint32_t bp_storage;
82 uint8_t int_pending; 95 uint8_t int_pending;
83 uint8_t trace_pending; 96 uint8_t trace_pending;
84 uint8_t should_return; 97 uint8_t should_return;
85 uint8_t ram_code_flags[]; 98 uint8_t ram_code_flags[];
86 } m68k_context; 99 };
87 100
88 typedef m68k_context *(*m68k_reset_handler)(m68k_context *context); 101 typedef m68k_context *(*m68k_reset_handler)(m68k_context *context);
89 typedef m68k_context *(*m68k_debug_handler)(m68k_context *context, uint32_t pc); 102
90 103
91 void translate_m68k_stream(uint32_t address, m68k_context * context); 104 void translate_m68k_stream(uint32_t address, m68k_context * context);
92 void start_68k_context(m68k_context * context, uint32_t address); 105 void start_68k_context(m68k_context * context, uint32_t address);
93 void resume_68k(m68k_context *context); 106 void resume_68k(m68k_context *context);
94 void init_m68k_opts(m68k_options * opts, memmap_chunk * memmap, uint32_t num_chunks, uint32_t clock_divider); 107 void init_m68k_opts(m68k_options * opts, memmap_chunk * memmap, uint32_t num_chunks, uint32_t clock_divider);