* register calling updates

This commit is contained in:
peter 2003-12-04 21:42:07 +00:00
parent e7c99a0e41
commit 0d3948fc5f
7 changed files with 114 additions and 50 deletions

View File

@ -1100,7 +1100,7 @@ End;
mov es:[di], al
end;
{$else fpc}
assembler;
assembler;stdcall;
asm
push edi
push ebx
@ -1152,7 +1152,7 @@ End;
mov @Result,ax
end;
{$else fpc}
assembler;
assembler;stdcall;
asm
push edi
push ebx
@ -1190,7 +1190,7 @@ End;
end;
{$else asmgraph}
{ note: still needs or/and/notput support !!!!! (JM) }
assembler;
assembler;stdcall;
asm
{$ifndef fpc}
mov es, [SegA000]
@ -1394,7 +1394,7 @@ const CrtAddress: word = 0;
procedure SetVisualX(page: word); {$ifndef fpc}far;{$endif fpc}
{ 4 page supPort... }
Procedure SetVisibleStart(AOffset: word); Assembler;
Procedure SetVisibleStart(AOffset: word); Assembler;stdcall;
(* Select where the left corner of the screen will be *)
{ By Matt Pritchard }
asm
@ -1545,7 +1545,7 @@ const CrtAddress: word = 0;
end;
{$else asmgraph}
{ note: still needs or/and/notput support !!!!! (JM) }
Assembler;
Assembler;stdcall;
asm
mov di,[Y] ; (* DI = Y coordinate *)
(* Multiply by 80 start *)
@ -2746,7 +2746,10 @@ begin
end.
{
$Log$
Revision 1.10 2003-10-03 21:46:25 peter
Revision 1.11 2003-12-04 21:42:07 peter
* register calling updates
Revision 1.10 2003/10/03 21:46:25 peter
* stdcall fixes
Revision 1.9 2002/09/07 16:01:18 peter

View File

@ -20,6 +20,7 @@ unit ports;
{ this unit uses classes so
ObjFpc mode is required PM }
{$Mode ObjFpc}
{$Calling StdCall}
interface
@ -103,7 +104,10 @@ end.
{
$Log$
Revision 1.3 2002-09-07 16:01:18 peter
Revision 1.4 2003-12-04 21:42:07 peter
* register calling updates
Revision 1.3 2002/09/07 16:01:18 peter
* old logs removed and tabs fixed
}

View File

@ -589,29 +589,78 @@ end;
function strcopy(dest,source : pchar) : pchar;assembler;
var
saveeax,saveesi,saveedi : longint;
asm
pushl %esi
pushl %edi
cld
movl 12(%ebp),%edi
movl $0xffffffff,%ecx
xorb %al,%al
repne
scasb
not %ecx
movl 8(%ebp),%edi
movl 12(%ebp),%esi
movl %ecx,%eax
shrl $2,%ecx
rep
movsl
movl %eax,%ecx
andl $3,%ecx
rep
movsb
movl 8(%ebp),%eax
popl %edi
popl %esi
movl %edi,saveedi
movl %esi,saveesi
{$ifdef REGCALL}
movl %eax,saveeax
movl %edx,%edi
{$else}
movl source,%edi
{$endif}
testl %edi,%edi
jz .LStrCopyDone
leal 3(%edi),%ecx
andl $-4,%ecx
movl %edi,%esi
subl %edi,%ecx
{$ifdef REGCALL}
movl %eax,%edi
{$else}
movl dest,%edi
{$endif}
jz .LStrCopyAligned
.LStrCopyAlignLoop:
movb (%esi),%al
incl %edi
incl %esi
testb %al,%al
movb %al,-1(%edi)
jz .LStrCopyDone
decl %ecx
jnz .LStrCopyAlignLoop
.balign 16
.LStrCopyAligned:
movl (%esi),%eax
movl %eax,%edx
leal 0x0fefefeff(%eax),%ecx
notl %edx
addl $4,%esi
andl %edx,%ecx
andl $0x080808080,%ecx
jnz .LStrCopyEndFound
movl %eax,(%edi)
addl $4,%edi
jmp .LStrCopyAligned
.LStrCopyEndFound:
testl $0x0ff,%eax
jz .LStrCopyByte
testl $0x0ff00,%eax
jz .LStrCopyWord
testl $0x0ff0000,%eax
jz .LStrCopy3Bytes
movl %eax,(%edi)
jmp .LStrCopyDone
.LStrCopy3Bytes:
xorb %dl,%dl
movw %ax,(%edi)
movb %dl,2(%edi)
jmp .LStrCopyDone
.LStrCopyWord:
movw %ax,(%edi)
jmp .LStrCopyDone
.LStrCopyByte:
movb %al,(%edi)
.LStrCopyDone:
{$ifdef REGCALL}
movl saveeax,%eax
{$else}
movl dest,%eax
{$endif}
movl saveedi,%edi
movl saveesi,%esi
end;
@ -1513,7 +1562,10 @@ Begin
End.
{
$Log$
Revision 1.28 2003-11-03 09:42:27 marco
Revision 1.29 2003-12-04 21:42:07 peter
* register calling updates
Revision 1.28 2003/11/03 09:42:27 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.27 2003/10/16 15:43:13 peter

View File

@ -25,9 +25,7 @@ var
asm
movl %edi,saveedi
movl __RESULT,%edi
{$ifndef REGCALL}
movl l,%eax
{$endif}
stosl
xorl %eax,%eax
movl $7,%ecx
@ -77,16 +75,10 @@ var
asm
movl %edi,saveedi
movl %esi,saveesi
movl $8,%ecx
{$ifdef REGCALL}
movl %eax,%edi
movl %edx,%esi
movzbl %cl,%edx
{$else}
movl source,%esi
movzbl b,%edx
movl __RESULT,%edi
{$endif}
movzbl b,%edx
movl $8,%ecx
rep
movsl
leal -32(%edi),%eax
@ -692,7 +684,10 @@ end;
{
$Log$
Revision 1.15 2003-12-03 23:06:35 peter
Revision 1.16 2003-12-04 21:42:07 peter
* register calling updates
Revision 1.15 2003/12/03 23:06:35 peter
* more fixes
Revision 1.14 2003/12/03 22:46:54 peter

View File

@ -26,7 +26,11 @@ asm
movl %edi,20(%eax)
movl (%ebp),%edi
movl %edi,12(%eax)
{$ifdef REGCALL}
leal 8(%ebp),%edi
{$else}
leal 12(%ebp),%edi
{$endif}
movl %edi,16(%eax)
movl 8(%eax),%edi
xorl %eax,%eax
@ -54,7 +58,10 @@ end;
{
$Log$
Revision 1.4 2003-11-11 21:08:17 peter
Revision 1.5 2003-12-04 21:42:07 peter
* register calling updates
Revision 1.4 2003/11/11 21:08:17 peter
* REGCALL define added
Revision 1.3 2002/09/07 16:01:19 peter

View File

@ -244,7 +244,7 @@ begin
{$ifdef VER1_0}
Raise E at longint(Address){$ifdef ENHANCEDRAISE},longint(Frame){$endif};
{$else VER1_0}
Raise E at Address{$ifdef ENHANCEDRAISE},Frame){$endif};
Raise E at Address,Frame;
{$endif VER1_0}
end;
@ -384,7 +384,7 @@ end;
{ ---------------------------------------------------------------------
Initialization/Finalization/exit code
---------------------------------------------------------------------}
Type
PPRecord = ^TPRecord;
TPRecord = Record
@ -397,7 +397,7 @@ Const
procedure AddTerminateProc(TermProc: TTerminateProc);
Var
Var
TPR : PPRecord;
begin
@ -406,8 +406,8 @@ begin
begin
NextFunc:=TPList;
Func:=TermProc;
end;
TPList:=TPR;
end;
TPList:=TPR;
end;
function CallTerminateProcs: Boolean;
@ -422,7 +422,7 @@ begin
begin
Result:=TPR^.Func();
TPR:=TPR^.NextFunc;
end;
end;
end;
{

View File

@ -17,7 +17,7 @@ begin{asm}
// !!!!!!! depends on ABI !!!!!!!!
end;
{$define FPC_SYSTEM_HAS_SPTR}
function Sptr:Longint;{assembler;}
function Sptr:Pointer;{assembler;}
begin{asm}
{$warning FIX ME!}
end;
@ -31,7 +31,10 @@ begin{asm}
end;
{
$Log$
Revision 1.3 2003-03-17 14:30:11 peter
Revision 1.4 2003-12-04 21:42:07 peter
* register calling updates
Revision 1.3 2003/03/17 14:30:11 peter
* changed address parameter/return values to pointer instead
of longint