From c5faa84f92a922f26e7972bea79b5d3c6e24b228 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 5 Aug 1999 23:45:09 +0000 Subject: [PATCH] * saveregister is now working and used for assert and iocheck (which has been moved to system.inc because it's now system independent) --- compiler/cgai386.pas | 19 ++++++++++++++++++- compiler/options.pas | 7 ++++++- rtl/i386/i386.inc | 10 ++++++++-- rtl/inc/system.inc | 29 +++++++++++++++++++++-------- 4 files changed, 53 insertions(+), 12 deletions(-) diff --git a/compiler/cgai386.pas b/compiler/cgai386.pas index 55421d83cf..4a1a7c45af 100644 --- a/compiler/cgai386.pas +++ b/compiler/cgai386.pas @@ -2693,6 +2693,12 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister); exprasmlist^.insert(new(pai386,op_reg(A_PUSH,S_L,R_EDI))); end; + { for the save all registers we can simply use a pusha,popa which + push edi,esi,ebp,esp(ignored),ebx,edx,ecx,eax } + if (po_saveregisters in aktprocsym^.definition^.procoptions) then + begin + exprasmlist^.insert(new(pai386,op_none(A_PUSHA,S_L))); + end; { omit stack frame ? } if not inlined then @@ -3067,6 +3073,13 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister); } end; + { for the save all registers we can simply use a pusha,popa which + push edi,esi,ebp,esp(ignored),ebx,edx,ecx,eax } + if (po_saveregisters in aktprocsym^.definition^.procoptions) then + begin + exprasmlist^.concat(new(pai386,op_none(A_POPA,S_L))); + end; + if not(nostackframe) and not inlined then exprasmlist^.concat(new(pai386,op_none(A_LEAVE,S_NO))); { parameters are limited to 65535 bytes because } @@ -3163,7 +3176,11 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister); end. { $Log$ - Revision 1.26 1999-08-05 14:58:04 florian + Revision 1.27 1999-08-05 23:45:09 peter + * saveregister is now working and used for assert and iocheck (which has + been moved to system.inc because it's now system independent) + + Revision 1.26 1999/08/05 14:58:04 florian * some fixes for the floating point registers * more things for the new code generator diff --git a/compiler/options.pas b/compiler/options.pas index 10993c8ffb..6e87677000 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -991,6 +991,7 @@ begin { Temporary defines, until things settle down } def_symbol('INT64'); def_symbol('HASRESOURCESTRINGS'); + def_symbol('HASSAVEREGISTERS'); { some stuff for TP compatibility } {$ifdef i386} @@ -1160,7 +1161,11 @@ end; end. { $Log$ - Revision 1.9 1999-08-04 13:02:46 jonas + Revision 1.10 1999-08-05 23:45:10 peter + * saveregister is now working and used for assert and iocheck (which has + been moved to system.inc because it's now system independent) + + Revision 1.9 1999/08/04 13:02:46 jonas * all tokens now start with an underscore * PowerPC compiles!! diff --git a/rtl/i386/i386.inc b/rtl/i386/i386.inc index 7d09fe316c..68e804381f 100644 --- a/rtl/i386/i386.inc +++ b/rtl/i386/i386.inc @@ -795,6 +795,8 @@ end; {$endif def SYSTEMDEBUG} +{$ifndef HASSAVEREGISTERS} + {**************************************************************************** IoCheck ****************************************************************************} @@ -818,11 +820,15 @@ begin end; end; - +{$endif not HASSAVEREGISTERS} { $Log$ - Revision 1.49 1999-07-06 10:53:52 peter + Revision 1.50 1999-08-05 23:45:12 peter + * saveregister is now working and used for assert and iocheck (which has + been moved to system.inc because it's now system independent) + + Revision 1.49 1999/07/06 10:53:52 peter * removed temp defines Revision 1.48 1999/07/03 09:03:47 florian diff --git a/rtl/inc/system.inc b/rtl/inc/system.inc index 633cf0b454..0191562195 100644 --- a/rtl/inc/system.inc +++ b/rtl/inc/system.inc @@ -311,6 +311,21 @@ begin end; +{$ifdef HASSAVEREGISTERS} +procedure int_iocheck(addr : longint);[saveregisters,public,alias:'FPC_IOCHECK']; +var + l : longint; +begin + if InOutRes<>0 then + begin + l:=InOutRes; + InOutRes:=0; + HandleErrorFrame(l,get_frame); + end; +end; +{$endif} + + Function IOResult:Word; Begin IOResult:=InOutRes; @@ -531,20 +546,14 @@ begin end; -Procedure int_assert(Const Msg,FName:string;LineNo,ErrorAddr:Longint); [Public,Alias : 'FPC_ASSERT']; +Procedure int_assert(Const Msg,FName:string;LineNo,ErrorAddr:Longint); [{$ifdef HASSAVEREGISTERS}SaveRegisters,{$endif}Public,Alias : 'FPC_ASSERT']; type TAssertErrorProc=procedure(const msg,fname:string;lineno,erroraddr:longint); begin - asm - pushal - end; if AssertErrorProc<>nil then TAssertErrorProc(AssertErrorProc)(Msg,FName,LineNo,ErrorAddr) else HandleError(227); - asm - popal - end; end; @@ -573,7 +582,11 @@ end; { $Log$ - Revision 1.65 1999-07-28 12:58:22 peter + Revision 1.66 1999-08-05 23:45:14 peter + * saveregister is now working and used for assert and iocheck (which has + been moved to system.inc because it's now system independent) + + Revision 1.65 1999/07/28 12:58:22 peter * fixed assert() to push/pop registers Revision 1.64 1999/07/05 20:04:27 peter