* Fixed warnings about EBP based access.

* Improved SetJmp and longJmp by not using stack frame.

git-svn-id: trunk@9112 -
This commit is contained in:
yury 2007-11-03 18:05:12 +00:00
parent 7230661978
commit c4ed91b9ff

View File

@ -13,46 +13,45 @@
**********************************************************************} **********************************************************************}
Function SetJmp (Var S : Jmp_buf) : longint;assembler;[Public, alias : 'FPC_SETJMP']; Function SetJmp (Var S : Jmp_buf) : longint;assembler;nostackframe;[Public, alias : 'FPC_SETJMP'];
asm asm
{$ifndef REGCALL} {$ifndef REGCALL}
movl 8(%ebp),%eax movl 4(%esp),%eax
{$endif} {$endif}
movl %ebx,(%eax) movl %ebx,Jmp_buf.ebx(%eax)
movl %esi,4(%eax) movl %esi,Jmp_buf.esi(%eax)
movl %edi,8(%eax) movl %edi,Jmp_buf.edi(%eax)
movl 4(%ebp),%edi movl %ebp,Jmp_buf.bp(%eax)
movl %edi,20(%eax)
movl (%ebp),%edi
movl %edi,12(%eax)
{$ifdef REGCALL} {$ifdef REGCALL}
leal 8(%ebp),%edi leal 4(%esp),%edi
{$else} {$else}
leal 12(%ebp),%edi leal 8(%esp),%edi
{$endif} {$endif}
movl %edi,16(%eax) movl %edi,Jmp_buf.sp(%eax)
movl 8(%eax),%edi movl (%esp),%edi
movl %edi,Jmp_buf.pc(%eax)
movl Jmp_buf.edi(%eax),%edi
xorl %eax,%eax xorl %eax,%eax
end['EAX']; end;
Procedure longJmp (Var S : Jmp_buf; value : longint); assembler;[Public, alias : 'FPC_LONGJMP']; Procedure longJmp (Var S : Jmp_buf; value : longint); assembler;nostackframe;[Public, alias : 'FPC_LONGJMP'];
asm asm
{$ifdef REGCALL} {$ifdef REGCALL}
xchgl %edx,%eax xchgl %edx,%eax
{$else} {$else}
movl 8(%ebp),%edx movl 4(%esp),%edx
movl 12(%ebp),%eax movl 8(%esp),%eax
{$endif} {$endif}
movl (%edx),%ebx movl Jmp_buf.ebx(%edx),%ebx
movl 4(%edx),%esi movl Jmp_buf.esi(%edx),%esi
movl 8(%edx),%edi movl Jmp_buf.edi(%edx),%edi
movl 12(%edx),%ebp movl Jmp_buf.bp(%edx),%ebp
movl 16(%edx),%esp movl Jmp_buf.sp(%edx),%esp
// we should also clear the fpu // we should also clear the fpu
// fninit no must be done elsewhere PM // fninit no must be done elsewhere PM
// or we should reset the control word also // or we should reset the control word also
jmp 20(%edx) jmp Jmp_buf.pc(%edx)
end; end;