* fixed i386/linux rtl compilation and functionality when compiled

without regcall

git-svn-id: trunk@11024 -
This commit is contained in:
Jonas Maebe 2008-05-21 15:20:13 +00:00
parent 53d11b9a06
commit f00beea41c
5 changed files with 36 additions and 12 deletions

View File

@ -94,7 +94,7 @@ function mmx_support : boolean;
mmx_support:=false;
end;
{$ifndef FPC_SYSTEM_HAS_MOVE}
{$if not defined(FPC_SYSTEM_HAS_MOVE) and defined(REGCALL) }
{$define USE_FASTMOVE}
{$i fastmove.inc}
{$endif FPC_SYSTEM_HAS_MOVE}
@ -200,6 +200,10 @@ end;
{$ifndef FPC_SYSTEM_HAS_FILLCHAR}
{$define FPC_SYSTEM_HAS_FILLCHAR}
Procedure FillChar(var x;count:SizeInt;value:byte);assembler;
{$ifndef regcall}
var
saveedi: longint;
{$endif}
asm
{A push is prefered over a local variable because a local
variable causes the compiler to generate a stackframe.}
@ -210,6 +214,7 @@ asm
movzbl %cl,%eax
movl %edx,%ecx
{$else}
movl %edi, saveedi
movl x,%edi
movl count,%ecx
movzbl value,%eax
@ -232,6 +237,8 @@ asm
.LFillEnd:
{$ifdef REGCALL}
pop %edi
{$else}
movl saveedi,%edi
{$endif}
end;
{$endif FPC_SYSTEM_HAS_FILLCHAR}
@ -665,9 +672,13 @@ procedure fpc_shortstr_to_shortstr(out res:shortstring; const sstr: shortstring)
movl %edi,saveedi
movl %esi,saveesi
cld
movl %eax,%edi
movl %ecx,%esi
movl res,%edi
movl sstr,%esi
{$ifdef regcall}
movl %edx,%ecx
{$else regcall}
movl res+4,%ecx
{$endif regcall}
xorl %eax,%eax
lodsb
cmpl %ecx,%eax
@ -999,7 +1010,7 @@ asm
{$ifdef REGCALL}
movl saveres,%edi
{$else}
movl __RESULT,%edi
movl res,%edi
{$endif}
addb $255,%cl
movb %cl,(%edi)
@ -1080,7 +1091,7 @@ end;
Str()
****************************************************************************}
{$ifdef disabled}
{$if defined(disabled) and defined(regcall) }
{$define FPC_SYSTEM_HAS_INT_STR_LONGWORD}
{$define FPC_SYSTEM_HAS_INT_STR_LONGINT}
@ -1301,7 +1312,7 @@ asm
{$else}
movl Target,%ecx
movl NewValue,%edx
movl Comparand,%eax
movl Comperand,%eax
{$endif}
lock
cmpxchgl %edx, (%ecx)
@ -1420,7 +1431,7 @@ procedure fpc_cpucodeinit;
end;
{$ifndef darwin}
{$if not defined(darwin) and defined(regcall) }
{ darwin requires that the stack is aligned to 16 bytes when calling another function }
{$define FPC_SYSTEM_HAS_ANSISTR_DECR_REF}
@ -1496,7 +1507,7 @@ asm
// [442] end;
end;
{$endif darwin}
{$endif ndef darwin and defined(regcall) }
{$ifndef FPC_SYSTEM_HAS_MEM_BARRIER}
{$define FPC_SYSTEM_HAS_MEM_BARRIER}

View File

@ -28,6 +28,10 @@ procedure sincos(theta : float;out sinus,cosinus : float);assembler;
asm
fldt theta
fsincos
{$ifndef regcall}
movl sinus, %eax
movl cosinus, %edx
{$endif}
fstpt (%edx)
fstpt (%eax)
fwait

View File

@ -524,10 +524,15 @@ end;
{$define FPC_UNIT_HAS_STRRSCAN}
function strrscan(p : pchar;c : char) : pchar;assembler;
var
saveeax,saveedi : longint;
{$ifdef regcall}
saveeax,
{$endif}
saveedi : longint;
asm
movl %edi,saveedi
{$ifdef regcall}
movl %eax,saveeax
{$endif regcall}
movl p,%edi
xorl %eax,%eax
orl %edi,%edi
@ -539,7 +544,11 @@ asm
scasb
not %ecx
movb c,%al
{$ifdef regcall}
movl saveeax,%edi
{$else}
movl p,%edi
{$endif}
addl %ecx,%edi
decl %edi
std

View File

@ -666,7 +666,7 @@ begin
end;
function fpc_safecallcheck(res : hresult) : hresult;[public,alias:'FPC_SAFECALLCHECK']; compilerproc;
function fpc_safecallcheck(res : hresult) : hresult;[public,alias:'FPC_SAFECALLCHECK']; compilerproc; register;
begin
if res<0 then
begin
@ -884,7 +884,7 @@ begin
end;
Procedure HandleErrorAddrFrame (Errno : longint;addr,frame : Pointer);[public,alias:'FPC_BREAK_ERROR'];
Procedure HandleErrorAddrFrame (Errno : longint;addr,frame : Pointer);[public,alias:'FPC_BREAK_ERROR']; register;
begin
If pointer(ErrorProc)<>Nil then
ErrorProc(Errno,addr,frame);

View File

@ -30,7 +30,7 @@ begin
geterrno:=geterrnolocation^;
end;
procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO'];
procedure seterrno(err:libcint); [public, alias: 'FPC_SYS_SETERRNO']; register;
begin
geterrnolocation^:=err;
end;