* made pic-safe (by simply not accessing global variables from

assembler code anymore, as I don't see how to easily support
    PIC access to global variables for Darwin/i386)

git-svn-id: trunk@8663 -
This commit is contained in:
Jonas Maebe 2007-09-27 15:08:09 +00:00
parent e81d4b737f
commit f51bac256d
2 changed files with 29 additions and 27 deletions

View File

@ -1216,16 +1216,24 @@ const
{$define FPC_SYSTEM_HAS_SYSRESETFPU}
Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
var
{ these locals are so we don't have to hack pic code in the assembler }
localmxcsr: dword;
localfpucw: word;
begin
localfpucw:=Default8087CW;
asm
fninit
fldcw Default8087CW
fldcw localfpucw
fwait
end;
if has_sse_support then
asm
{ setup sse exceptions }
ldmxcsr mxcsr
begin
localmxcsr:=mxcsr;
asm
{ setup sse exceptions }
ldmxcsr localmxcsr
end;
end;
softfloat_exception_flags:=0;
softfloat_exception_mask:=float_flag_underflow or float_flag_inexact or float_flag_denormal;

View File

@ -17,14 +17,15 @@
FPU Control word
****************************************************************************}
procedure Set8087CW(cw:word);assembler;
asm
{$ifndef REGCALL}
movw cw,%ax
{$endif}
movw %ax,default8087cw
fnclex
fldcw default8087cw
procedure Set8087CW(cw:word);
begin
{ pic-safe ; cw will not be a regvar because it's accessed from }
{ assembler }
default8087cw:=cw;
asm
fnclex
fldcw cw
end;
end;
@ -120,20 +121,22 @@
{$define FPC_SYSTEM_HAS_EXP}
function fpc_exp_real(d : ValReal) : ValReal;assembler;compilerproc;
var
cw1,cw2: word;
asm
// comes from DJ GPP
fldt d
fldl2e
fmulp %st,%st(1)
fstcw .LCW1
fstcw .LCW2
fstcw CW1
fstcw CW2
fwait
andw $0xf3ff,.LCW2
orw $0x0400,.LCW2
fldcw .LCW2
andw $0xf3ff,CW2
orw $0x0400,CW2
fldcw CW2
fld %st(0)
frndint
fldcw .LCW1
fldcw CW1
fxch %st(1)
fsub %st(1),%st
f2xm1
@ -142,15 +145,6 @@
fscale
fstp %st(1)
fclex
jmp .LCW3
// store some help data in the data segment
.data
.LCW1:
.word 0
.LCW2:
.word 0
.text
.LCW3:
end;