Mercurial > repos > blastem
comparison m68k_core_x86.c @ 2420:1fba97414ba6
Properly handle stack alignment in m68k breakpoint implementation
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 19 Jan 2024 22:30:25 -0800 |
parents | bf4f1a8d1d48 |
children | 4aef84fbe2e2 |
comparison
equal
deleted
inserted
replaced
2419:0871f555eff6 | 2420:1fba97414ba6 |
---|---|
2579 native.stack_off = 0; | 2579 native.stack_off = 0; |
2580 code_ptr start_native = native.cur; | 2580 code_ptr start_native = native.cur; |
2581 mov_ir(&native, address, opts->gen.scratch1, SZ_D); | 2581 mov_ir(&native, address, opts->gen.scratch1, SZ_D); |
2582 | 2582 |
2583 | 2583 |
2584 call(&native, opts->bp_stub); | 2584 call_noalign(&native, opts->bp_stub); |
2585 } | 2585 } |
2586 | 2586 |
2587 void init_m68k_opts(m68k_options * opts, memmap_chunk * memmap, uint32_t num_chunks, uint32_t clock_divider, sync_fun sync_components, int_ack_fun int_ack) | 2587 void init_m68k_opts(m68k_options * opts, memmap_chunk * memmap, uint32_t num_chunks, uint32_t clock_divider, sync_fun sync_components, int_ack_fun int_ack) |
2588 { | 2588 { |
2589 memset(opts, 0, sizeof(*opts)); | 2589 memset(opts, 0, sizeof(*opts)); |
3275 code->cur = opts->bp_stub; | 3275 code->cur = opts->bp_stub; |
3276 code->stack_off = tmp_stack_off; | 3276 code->stack_off = tmp_stack_off; |
3277 opts->prologue_start = *opts->bp_stub; | 3277 opts->prologue_start = *opts->bp_stub; |
3278 //Calculate length of patch | 3278 //Calculate length of patch |
3279 mov_ir(code, 0x1234, opts->gen.scratch1, SZ_D); | 3279 mov_ir(code, 0x1234, opts->gen.scratch1, SZ_D); |
3280 call(code, opts->bp_stub); | 3280 call_noalign(code, opts->bp_stub); |
3281 int patch_size = code->cur - opts->bp_stub; | 3281 int patch_size = code->cur - opts->bp_stub; |
3282 code->cur = opts->bp_stub; | 3282 code->cur = opts->bp_stub; |
3283 code->stack_off = tmp_stack_off; | 3283 code->stack_off = tmp_stack_off + sizeof(void*); |
3284 | 3284 |
3285 //Save context and call breakpoint handler | 3285 //Save context and call breakpoint handler |
3286 call(code, opts->gen.save_context); | 3286 call(code, opts->gen.save_context); |
3287 push_r(code, opts->gen.scratch1); | 3287 push_r(code, opts->gen.scratch1); |
3288 call_args_abi(code, (code_ptr)m68k_bp_dispatcher, 2, opts->gen.context_reg, opts->gen.scratch1); | 3288 call_args_abi(code, (code_ptr)m68k_bp_dispatcher, 2, opts->gen.context_reg, opts->gen.scratch1); |