Mercurial > repos > blastem
comparison m68k_core_x86.c @ 2232:0c42982dd4d8
Make sure 68K interrupt is executed immediately when resuming core if it has a target cycle <= current. Fixes IRQ tests in mcd-verificator
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 08 Sep 2022 20:50:18 -0700 |
parents | d15c68157288 |
children | 8e8db9141209 |
comparison
equal
deleted
inserted
replaced
2231:8e6fb2c06024 | 2232:0c42982dd4d8 |
---|---|
2989 jmp_r(code, opts->gen.scratch1); | 2989 jmp_r(code, opts->gen.scratch1); |
2990 | 2990 |
2991 *code = tmp_code; | 2991 *code = tmp_code; |
2992 | 2992 |
2993 opts->gen.handle_cycle_limit_int = code->cur; | 2993 opts->gen.handle_cycle_limit_int = code->cur; |
2994 //calculate stack adjust size | 2994 //calculate address adjust for sync return |
2995 add_ir(code, 16-sizeof(void*), RSP, SZ_PTR); | 2995 check_cycles_int(&opts->gen, 0); |
2996 uint32_t adjust_size = code->cur - opts->gen.handle_cycle_limit_int; | 2996 uint32_t adjust_size = code->cur - opts->gen.handle_cycle_limit_int; |
2997 code->cur = opts->gen.handle_cycle_limit_int; | |
2998 add_ir(code, 16-sizeof(void *), RSP, SZ_PTR); | |
2999 adjust_size -= code->cur - opts->gen.handle_cycle_limit_int; | |
2997 code->cur = opts->gen.handle_cycle_limit_int; | 3000 code->cur = opts->gen.handle_cycle_limit_int; |
2998 //handle trace mode | 3001 //handle trace mode |
2999 cmp_irdisp(code, 0, opts->gen.context_reg, offsetof(m68k_context, trace_pending), SZ_B); | 3002 cmp_irdisp(code, 0, opts->gen.context_reg, offsetof(m68k_context, trace_pending), SZ_B); |
3000 code_ptr do_trace = code->cur + 1; | 3003 code_ptr do_trace = code->cur + 1; |
3001 jcc(code, CC_NZ, do_trace); | 3004 jcc(code, CC_NZ, do_trace); |
3024 *do_ret = code->cur - (do_ret+1); | 3027 *do_ret = code->cur - (do_ret+1); |
3025 uint32_t tmp_stack_off = code->stack_off; | 3028 uint32_t tmp_stack_off = code->stack_off; |
3026 //fetch return address and adjust RSP | 3029 //fetch return address and adjust RSP |
3027 pop_r(code, opts->gen.scratch1); | 3030 pop_r(code, opts->gen.scratch1); |
3028 add_ir(code, 16-sizeof(void *), RSP, SZ_PTR); | 3031 add_ir(code, 16-sizeof(void *), RSP, SZ_PTR); |
3029 add_ir(code, adjust_size, opts->gen.scratch1, SZ_PTR); | 3032 sub_ir(code, adjust_size, opts->gen.scratch1, SZ_PTR); |
3030 //save return address for restoring later | 3033 //save return address for restoring later |
3031 mov_rrdisp(code, opts->gen.scratch1, opts->gen.context_reg, offsetof(m68k_context, resume_pc), SZ_PTR); | 3034 mov_rrdisp(code, opts->gen.scratch1, opts->gen.context_reg, offsetof(m68k_context, resume_pc), SZ_PTR); |
3032 retn(code); | 3035 retn(code); |
3033 code->stack_off = tmp_stack_off; | 3036 code->stack_off = tmp_stack_off; |
3034 *do_trace = code->cur - (do_trace + 1); | 3037 *do_trace = code->cur - (do_trace + 1); |