Mercurial > repos > blastem
diff m68k_core_x86.c @ 690:fc04781f4d28
Removed hardcoded assumptions in M68K core about which parts of the memory map are RAM
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 14 Jan 2015 09:38:54 -0800 |
parents | 858e31f977ae |
children | 0a86e81fa87d |
line wrap: on
line diff
--- a/m68k_core_x86.c Thu Jan 08 23:20:41 2015 -0800 +++ b/m68k_core_x86.c Wed Jan 14 09:38:54 2015 -0800 @@ -2202,8 +2202,10 @@ opts->gen.native_code_map = malloc(sizeof(native_map_slot) * NATIVE_MAP_CHUNKS); memset(opts->gen.native_code_map, 0, sizeof(native_map_slot) * NATIVE_MAP_CHUNKS); opts->gen.deferred = NULL; - opts->gen.ram_inst_sizes = malloc(sizeof(uint8_t *) * 64); - memset(opts->gen.ram_inst_sizes, 0, sizeof(uint8_t *) * 64); + + uint32_t inst_size_size = sizeof(uint8_t *) * ram_size(&opts->gen) / 1024; + opts->gen.ram_inst_sizes = malloc(inst_size_size); + memset(opts->gen.ram_inst_sizes, 0, inst_size_size); code_info *code = &opts->gen.code; init_code_info(code); @@ -2227,9 +2229,11 @@ opts->gen.load_context = code->cur; for (int i = 0; i < 5; i++) + { if (opts->flag_regs[i] >= 0) { mov_rdispr(code, opts->gen.context_reg, offsetof(m68k_context, flags) + i, opts->flag_regs[i], SZ_B); } + } for (int i = 0; i < 8; i++) { if (opts->dregs[i] >= 0) {