* make strpas assembler function

This commit is contained in:
peter 2003-11-19 16:58:44 +00:00
parent ff7b561fc9
commit 5e5462edd1
3 changed files with 40 additions and 17 deletions

View File

@ -1151,7 +1151,7 @@ end;
{$define FPC_SYSTEM_HAS_FPC_PCHAR_TO_SHORTSTR}
function fpc_pchar_to_shortstr(p:pchar):shortstring;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
function fpc_pchar_to_shortstr(p:pchar):shortstring;assembler;[public,alias:'FPC_PCHAR_TO_SHORTSTR']; {$ifdef hascompilerproc} compilerproc; {$endif}
{$include strpas.inc}
{$define FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
@ -1426,7 +1426,10 @@ end;
{
$Log$
Revision 1.53 2003-11-11 21:08:17 peter
Revision 1.54 2003-11-19 16:58:44 peter
* make strpas assembler function
Revision 1.53 2003/11/11 21:08:17 peter
* REGCALL define added
Revision 1.52 2003/11/03 09:42:27 marco

View File

@ -17,7 +17,7 @@
{$define FPC_UNIT_HAS_STRPAS}
function strpas(p : pchar) : string;
function strpas(p : pchar) : string; assembler;
{$i strpas.inc}
{$define FPC_UNIT_HAS_STRPCOPY}
@ -25,31 +25,34 @@ function strpcopy(d : pchar;const s : string) : pchar;assembler;
var
saveesi,saveedi : longint;
asm
movl %edi,saveedi
movl %esi,saveesi
movl %edi,saveedi
movl %esi,saveesi
cld
{$ifdef REGCALL}
{$ifdef REGCALL}
movl %eax,%edi // load destination address
movl %edx,%esi // Load Source adress
{$else}
{$else}
movl s,%esi // Load Source adress
movl d,%edi // load destination address
{$endif}
{$endif}
movzbl (%esi),%ecx // load length in ECX
incl %esi
rep
movsb
movb $0,(%edi)
{$ifndef REGCALL}
{$ifndef REGCALL}
movl d,%eax // return value to EAX
{$endif}
movl saveedi,%edi
movl saveesi,%esi
{$endif}
movl saveedi,%edi
movl saveesi,%esi
end;
{
$Log$
Revision 1.10 2003-11-11 21:08:17 peter
Revision 1.11 2003-11-19 16:58:44 peter
* make strpas assembler function
Revision 1.10 2003/11/11 21:08:17 peter
* REGCALL define added
Revision 1.9 2003/09/08 18:21:37 peter

View File

@ -13,10 +13,16 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
begin
var
saveres,saveebx,saveesi,saveedi : longint;
asm
movl %ebx,saveebx
movl %esi,saveesi
movl %edi,saveedi
{$ifdef regcall}
movl %eax,%esi
movl p,%esi
movl __RESULT,%edi
movl __RESULT,saveres
{$else}
movl p,%esi
{$endif}
@ -24,7 +30,9 @@ asm
testl %esi,%esi
movl %esi,%eax
jz .LStrPasDone
{$ifndef REGCALL}
movl __RESULT,%edi
{$endif}
leal 3(%esi),%edx
andl $-4,%edx
// skip length byte
@ -87,16 +95,25 @@ asm
incb %cl
jnz .LStrPasEndLoop
.LStrPasDone:
{$ifdef REGCALL}
movl saveres,%edi
{$else}
movl __RESULT,%edi
{$endif}
addb $255,%cl
movb %cl,(%edi)
end ['EAX','EBX','ECX','EDX','ESI','EDI'];
movl %esi,saveesi
movl %edi,saveedi
movl %ebx,saveebx
end;
{
$Log$
Revision 1.3 2003-11-11 21:08:17 peter
Revision 1.4 2003-11-19 16:58:44 peter
* make strpas assembler function
Revision 1.3 2003/11/11 21:08:17 peter
* REGCALL define added
Revision 1.2 2002/09/07 16:01:19 peter