diff options
author | Michael Pavone <pavone@retrodev.com> | 2014-03-02 14:45:36 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2014-03-02 14:45:36 -0800 |
commit | 16e7b59467ba17034f63834962e5d326a8facce4 (patch) | |
tree | 34c188d6f088c7985905fc69a29b4cddff88f332 /backend_x86.c | |
parent | 21c7f3bc1537b360433c3149488c3077c7639b9b (diff) |
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
Diffstat (limited to 'backend_x86.c')
-rw-r--r-- | backend_x86.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/backend_x86.c b/backend_x86.c new file mode 100644 index 0000000..366ab4d --- /dev/null +++ b/backend_x86.c @@ -0,0 +1,29 @@ +#include "backend.h" +#include "gen_x86.h" + +void cycles(cpu_options *opts, uint32_t num) +{ + add_ir(&opts->code, num, opts->cycles, SZ_D); +} + +void check_cycles_int(cpu_options *opts, uint32_t address) +{ + code_info *code = &opts->code; + cmp_rr(code, opts->cycles, opts->limit, SZ_D); + code_ptr jmp_off = code->cur+1; + jcc(code, CC_NC, jmp_off+1); + mov_ir(code, address, opts->scratch1, SZ_D); + call(code, opts->handle_cycle_limit_int); + *jmp_off = code->cur - (jmp_off+1); +} + +void check_cycles(cpu_options * opts) +{ + code_info *code = &opts->code; + cmp_rr(code, opts->cycles, opts->limit, SZ_D); + check_alloc_code(code, MAX_INST_LEN*2); + code_ptr jmp_off = code->cur+1; + jcc(code, CC_NC, jmp_off+1); + call(code, opts->handle_cycle_limit); + *jmp_off = code->cur - (jmp_off+1); +} |