comparison z80_to_x86.c @ 894:a7774fc2de4b

Partially working change to do proper stack alignment rather than doing a lame alignment check when calling a C compile dfunction. 68K core seems okay, but Z80 is busted.
author Michael Pavone <pavone@retrodev.com>
date Wed, 25 Nov 2015 08:40:45 -0800
parents 252dfd29831d
children 13388ab6d78a
comparison
equal deleted inserted replaced
893:4f46b4cd5035 894:a7774fc2de4b
2693 2693
2694 void zcreate_stub(z80_context * context) 2694 void zcreate_stub(z80_context * context)
2695 { 2695 {
2696 z80_options * opts = context->options; 2696 z80_options * opts = context->options;
2697 code_info *code = &opts->gen.code; 2697 code_info *code = &opts->gen.code;
2698 uint32_t start_stack_off = code->stack_off;
2698 check_code_prologue(code); 2699 check_code_prologue(code);
2699 context->bp_stub = code->cur; 2700 context->bp_stub = code->cur;
2700 2701
2701 //Calculate length of prologue 2702 //Calculate length of prologue
2702 check_cycles_int(&opts->gen, 0); 2703 check_cycles_int(&opts->gen, 0);
2725 *jmp_off = code->cur - (jmp_off+1); 2726 *jmp_off = code->cur - (jmp_off+1);
2726 //jump back to body of translated instruction 2727 //jump back to body of translated instruction
2727 pop_r(code, opts->gen.scratch1); 2728 pop_r(code, opts->gen.scratch1);
2728 add_ir(code, check_int_size - patch_size, opts->gen.scratch1, SZ_PTR); 2729 add_ir(code, check_int_size - patch_size, opts->gen.scratch1, SZ_PTR);
2729 jmp_r(code, opts->gen.scratch1); 2730 jmp_r(code, opts->gen.scratch1);
2731 code->stack_off = start_stack_off;
2730 } 2732 }
2731 2733
2732 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler) 2734 void zinsert_breakpoint(z80_context * context, uint16_t address, uint8_t * bp_handler)
2733 { 2735 {
2734 context->bp_handler = bp_handler; 2736 context->bp_handler = bp_handler;