From 73f8c956e051f6b7d45ec6eea175e05c9a28ccee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Mon, 10 Mar 2014 13:39:51 +0000 Subject: [PATCH] don't save the FP explicitly on a syscall, as they preserve all regs anyway except scratch regs git-svn-id: trunk@27078 - --- compiler/m68k/n68kcal.pas | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/compiler/m68k/n68kcal.pas b/compiler/m68k/n68kcal.pas index d9763acd9a..bc4e42b356 100644 --- a/compiler/m68k/n68kcal.pas +++ b/compiler/m68k/n68kcal.pas @@ -50,27 +50,19 @@ implementation procedure tm68kcallnode.do_syscall; var tmpref: treference; - tmpref2: treference; begin case target_info.system of system_m68k_amiga: begin if po_syscall_legacy in tprocdef(procdefinition).procoptions then begin - { save base pointer on syscalls } - { FIXME: probably this will need to be extended to save all regs (KB) } - reference_reset_base(tmpref2, NR_STACK_POINTER_REG, 0, 4); - tmpref2.direction := dir_dec; - current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_MOVE,S_L,NR_FRAME_POINTER_REG,tmpref2)); - - { the actuall call } + { according to Amiga Developer CD 2.1, system functions destroy the + scratch regs D0-D1 and A0-A1, but preserve all other regs. A6 is + not used as FP on Amiga any more (we use A5), so we don't need to + save it. (KB) + http://amigadev.elowar.com/read/ADCD_2.1/Libraries_Manual_guide/node0290.html } reference_reset_base(tmpref,NR_A6,-tprocdef(procdefinition).extnumber,4); current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_JSR,S_NO,tmpref)); - - { restore frame pointer } - reference_reset_base(tmpref2, NR_STACK_POINTER_REG, 0, 4); - tmpref2.direction := dir_inc; - current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_MOVE,S_L,tmpref2,NR_FRAME_POINTER_REG)); end else internalerror(2005010403);