comparison backend_x86.c @ 567:8e395210f50f

Refactor gen_x86 to use an interface more like gen_arm and to remove the need for the caller to decide whether an 8-bit or 32-bit displacement is needed in the rdisp functions. Update m68k_to_x86 to use the new version of the gen_x86 functions and do some minor refactoring there in the process
author Michael Pavone <pavone@retrodev.com>
date Sun, 02 Mar 2014 14:45:36 -0800
parents
children 2dde38c1744f
comparison
equal deleted inserted replaced
566:624dd5106060 567:8e395210f50f
1 #include "backend.h"
2 #include "gen_x86.h"
3
4 void cycles(cpu_options *opts, uint32_t num)
5 {
6 add_ir(&opts->code, num, opts->cycles, SZ_D);
7 }
8
9 void check_cycles_int(cpu_options *opts, uint32_t address)
10 {
11 code_info *code = &opts->code;
12 cmp_rr(code, opts->cycles, opts->limit, SZ_D);
13 code_ptr jmp_off = code->cur+1;
14 jcc(code, CC_NC, jmp_off+1);
15 mov_ir(code, address, opts->scratch1, SZ_D);
16 call(code, opts->handle_cycle_limit_int);
17 *jmp_off = code->cur - (jmp_off+1);
18 }
19
20 void check_cycles(cpu_options * opts)
21 {
22 code_info *code = &opts->code;
23 cmp_rr(code, opts->cycles, opts->limit, SZ_D);
24 check_alloc_code(code, MAX_INST_LEN*2);
25 code_ptr jmp_off = code->cur+1;
26 jcc(code, CC_NC, jmp_off+1);
27 call(code, opts->handle_cycle_limit);
28 *jmp_off = code->cur - (jmp_off+1);
29 }