comparison z80_to_x86.c @ 664:bca748422bf0

Use SZ_PTR instead of SZ_Q in Z80 core for 32-bit compat
author Michael Pavone <pavone@retrodev.com>
date Fri, 02 Jan 2015 12:04:58 -0800
parents 7a5461001242
children d0943769353b
comparison
equal deleted inserted replaced
663:7a5461001242 664:bca748422bf0
1669 check_cycles_int(&opts->gen, address); 1669 check_cycles_int(&opts->gen, address);
1670 call(code, opts->gen.save_context); 1670 call(code, opts->gen.save_context);
1671 mov_irdisp(code, address, opts->gen.context_reg, offsetof(z80_context, pc), SZ_W); 1671 mov_irdisp(code, address, opts->gen.context_reg, offsetof(z80_context, pc), SZ_W);
1672 push_r(code, opts->gen.context_reg); 1672 push_r(code, opts->gen.context_reg);
1673 call_args(code, (code_ptr)z80_interp_handler, 2, opts->gen.scratch1, opts->gen.scratch2); 1673 call_args(code, (code_ptr)z80_interp_handler, 2, opts->gen.scratch1, opts->gen.scratch2);
1674 mov_rr(code, RAX, opts->gen.scratch1, SZ_Q); 1674 mov_rr(code, RAX, opts->gen.scratch1, SZ_PTR);
1675 pop_r(code, opts->gen.context_reg); 1675 pop_r(code, opts->gen.context_reg);
1676 call(code, opts->gen.load_context); 1676 call(code, opts->gen.load_context);
1677 jmp_r(code, opts->gen.scratch1); 1677 jmp_r(code, opts->gen.scratch1);
1678 stub.last = code->cur; 1678 stub.last = code->cur;
1679 return stub; 1679 return stub;
2274 2274
2275 //Save context and call breakpoint handler 2275 //Save context and call breakpoint handler
2276 call(code, opts->gen.save_context); 2276 call(code, opts->gen.save_context);
2277 push_r(code, opts->gen.scratch1); 2277 push_r(code, opts->gen.scratch1);
2278 call_args_abi(code, context->bp_handler, 2, opts->gen.context_reg, opts->gen.scratch1); 2278 call_args_abi(code, context->bp_handler, 2, opts->gen.context_reg, opts->gen.scratch1);
2279 mov_rr(code, RAX, opts->gen.context_reg, SZ_Q); 2279 mov_rr(code, RAX, opts->gen.context_reg, SZ_PTR);
2280 //Restore context 2280 //Restore context
2281 call(code, opts->gen.load_context); 2281 call(code, opts->gen.load_context);
2282 pop_r(code, opts->gen.scratch1); 2282 pop_r(code, opts->gen.scratch1);
2283 //do prologue stuff 2283 //do prologue stuff
2284 cmp_rr(code, opts->gen.cycles, opts->gen.limit, SZ_D); 2284 cmp_rr(code, opts->gen.cycles, opts->gen.limit, SZ_D);
2285 uint8_t * jmp_off = code->cur+1; 2285 uint8_t * jmp_off = code->cur+1;
2286 jcc(code, CC_NC, code->cur + 7); 2286 jcc(code, CC_NC, code->cur + 7);
2287 pop_r(code, opts->gen.scratch1); 2287 pop_r(code, opts->gen.scratch1);
2288 add_ir(code, check_int_size - patch_size, opts->gen.scratch1, SZ_Q); 2288 add_ir(code, check_int_size - patch_size, opts->gen.scratch1, SZ_PTR);
2289 push_r(code, opts->gen.scratch1); 2289 push_r(code, opts->gen.scratch1);
2290 jmp(code, opts->gen.handle_cycle_limit_int); 2290 jmp(code, opts->gen.handle_cycle_limit_int);
2291 *jmp_off = code->cur - (jmp_off+1); 2291 *jmp_off = code->cur - (jmp_off+1);
2292 //jump back to body of translated instruction 2292 //jump back to body of translated instruction
2293 pop_r(code, opts->gen.scratch1); 2293 pop_r(code, opts->gen.scratch1);
2294 add_ir(code, check_int_size - patch_size, opts->gen.scratch1, SZ_Q); 2294 add_ir(code, check_int_size - patch_size, opts->gen.scratch1, SZ_PTR);
2295 jmp_r(code, opts->gen.scratch1); 2295 jmp_r(code, opts->gen.scratch1);
2296 } 2296 }
2297 2297
2298 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler) 2298 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler)
2299 { 2299 {