comparison m68k_to_x86.c @ 321:146c87616b05

Don't update interrupt mask on non-interrupt exceptions
author Mike Pavone <pavone@retrodev.com>
date Sat, 11 May 2013 21:19:31 -0700
parents 0bcab0475a7f
children 4f2711899866
comparison
equal deleted inserted replaced
320:67b6d351df0e 321:146c87616b05
44 void get_sr(); 44 void get_sr();
45 void do_sync(); 45 void do_sync();
46 void bcd_add(); 46 void bcd_add();
47 void bcd_sub(); 47 void bcd_sub();
48 void m68k_start_context(uint8_t * addr, m68k_context * context); 48 void m68k_start_context(uint8_t * addr, m68k_context * context);
49 void debug_print_sr();
49 50
50 uint8_t * cycles(uint8_t * dst, uint32_t num) 51 uint8_t * cycles(uint8_t * dst, uint32_t num)
51 { 52 {
52 dst = add_ir(dst, num, CYCLES, SZ_D); 53 dst = add_ir(dst, num, CYCLES, SZ_D);
53 return dst; 54 return dst;
2925 //leave supervisor mode 2926 //leave supervisor mode
2926 dst = mov_rr(dst, opts->aregs[7], SCRATCH1, SZ_B); 2927 dst = mov_rr(dst, opts->aregs[7], SCRATCH1, SZ_B);
2927 dst = mov_rdisp8r(dst, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, opts->aregs[7], SZ_B); 2928 dst = mov_rdisp8r(dst, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, opts->aregs[7], SZ_B);
2928 dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, SZ_B); 2929 dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, SZ_B);
2929 } 2930 }
2931 //dst = call(dst, (uint8_t *)debug_print_sr);
2930 if (inst->src.params.immed & 0x700) { 2932 if (inst->src.params.immed & 0x700) {
2931 dst = call(dst, (uint8_t *)do_sync); 2933 dst = call(dst, (uint8_t *)do_sync);
2932 } 2934 }
2933 } 2935 }
2934 break; 2936 break;
3222 if (inst->src.params.immed & 0x10) { 3224 if (inst->src.params.immed & 0x10) {
3223 dst = xor_irdisp8(dst, 1, CONTEXT, 0, SZ_B); 3225 dst = xor_irdisp8(dst, 1, CONTEXT, 0, SZ_B);
3224 } 3226 }
3225 if (inst->op == M68K_ORI_SR) { 3227 if (inst->op == M68K_ORI_SR) {
3226 dst = xor_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B); 3228 dst = xor_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B);
3229 //dst = call(dst, (uint8_t *)debug_print_sr);
3227 if (inst->src.params.immed & 0x700) { 3230 if (inst->src.params.immed & 0x700) {
3228 dst = call(dst, (uint8_t *)do_sync); 3231 dst = call(dst, (uint8_t *)do_sync);
3229 } 3232 }
3230 } 3233 }
3231 break; 3234 break;
3282 //leave supervisor mode 3285 //leave supervisor mode
3283 dst = mov_rr(dst, opts->aregs[7], SCRATCH1, SZ_D); 3286 dst = mov_rr(dst, opts->aregs[7], SCRATCH1, SZ_D);
3284 dst = mov_rdisp8r(dst, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, opts->aregs[7], SZ_D); 3287 dst = mov_rdisp8r(dst, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, opts->aregs[7], SZ_D);
3285 dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, SZ_D); 3288 dst = mov_rrdisp8(dst, SCRATCH1, CONTEXT, offsetof(m68k_context, aregs) + sizeof(uint32_t) * 8, SZ_D);
3286 } 3289 }
3290 //dst = call(dst, (uint8_t *)debug_print_sr);
3287 dst = call(dst, (uint8_t *)do_sync); 3291 dst = call(dst, (uint8_t *)do_sync);
3288 } 3292 }
3289 dst = cycles(dst, 12); 3293 dst = cycles(dst, 12);
3290 } else { 3294 } else {
3291 if (src_op.base != SCRATCH1) { 3295 if (src_op.base != SCRATCH1) {
3470 if (inst->src.params.immed & 0x10) { 3474 if (inst->src.params.immed & 0x10) {
3471 dst = mov_irind(dst, 1, CONTEXT, SZ_B); 3475 dst = mov_irind(dst, 1, CONTEXT, SZ_B);
3472 } 3476 }
3473 if (inst->op == M68K_ORI_SR) { 3477 if (inst->op == M68K_ORI_SR) {
3474 dst = or_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B); 3478 dst = or_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B);
3479 //dst = call(dst, (uint8_t *)debug_print_sr);
3475 if (inst->src.params.immed & 0x700) { 3480 if (inst->src.params.immed & 0x700) {
3476 dst = call(dst, (uint8_t *)do_sync); 3481 dst = call(dst, (uint8_t *)do_sync);
3477 } 3482 }
3478 } 3483 }
3479 break; 3484 break;