Mercurial > repos > blastem
diff m68k_core_x86.c @ 665:d0943769353b
Added functions to gen_x86 for saving and restoring callee save registers to better abstract over ABI differences between x86 and x86-64
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 02 Jan 2015 13:14:09 -0800 |
parents | 92ce5ea5ffc9 |
children | 30ccf56842d6 |
line wrap: on
line diff
--- a/m68k_core_x86.c Fri Jan 02 12:04:58 2015 -0800 +++ b/m68k_core_x86.c Fri Jan 02 13:14:09 2015 -0800 @@ -2281,42 +2281,19 @@ retn(code); opts->start_context = (start_fun)code->cur; + save_callee_save_regs(code); #ifdef X86_64 if (opts->gen.scratch2 != RDI) { mov_rr(code, RDI, opts->gen.scratch2, SZ_PTR); } - //save callee save registers - push_r(code, RBP); - push_r(code, R12); - push_r(code, R13); - push_r(code, R14); - push_r(code, R15); #else - //save callee save registers - push_r(code, RBP); - push_r(code, RBX); - push_r(code, RSI); - push_r(code, RDI); - mov_rdispr(code, RSP, 20, opts->gen.scratch2, SZ_D); mov_rdispr(code, RSP, 24, opts->gen.context_reg, SZ_D); #endif call(code, opts->gen.load_context); call_r(code, opts->gen.scratch2); call(code, opts->gen.save_context); -#ifdef X86_64 - //restore callee save registers - pop_r(code, R15); - pop_r(code, R14); - pop_r(code, R13); - pop_r(code, R12); - pop_r(code, RBP); -#else - pop_r(code, RDI); - pop_r(code, RSI); - pop_r(code, RBX); - pop_r(code, RBP); -#endif + restore_callee_save_regs(code); retn(code); opts->native_addr = code->cur;