mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-08 07:26:15 +02:00
+ added 8087 initialization to the msdos rtl (8087 presence detection is still a TODO)
git-svn-id: branches/i8086@24140 -
This commit is contained in:
parent
889e8650f1
commit
74cd67b85c
@ -107,3 +107,56 @@ begin
|
||||
runerror(304);
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
FPU
|
||||
****************************************************************************}
|
||||
|
||||
const
|
||||
{ Internal constants for use in system unit }
|
||||
FPU_Invalid = 1;
|
||||
FPU_Denormal = 2;
|
||||
FPU_DivisionByZero = 4;
|
||||
FPU_Overflow = 8;
|
||||
FPU_Underflow = $10;
|
||||
FPU_StackUnderflow = $20;
|
||||
FPU_StackOverflow = $40;
|
||||
FPU_ExceptionMask = $ff;
|
||||
|
||||
{ use Default8087CW instead
|
||||
fpucw : word = $1300 or FPU_StackUnderflow or FPU_Underflow or FPU_Denormal;
|
||||
}
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_SYSINITFPU}
|
||||
Procedure SysInitFPU;
|
||||
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 localfpucw
|
||||
fwait
|
||||
end;
|
||||
softfloat_exception_mask:=float_flag_underflow or float_flag_inexact or float_flag_denormal;
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_SYSTEM_HAS_SYSRESETFPU}
|
||||
Procedure SysResetFPU;
|
||||
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
|
||||
fwait
|
||||
fldcw localfpucw
|
||||
end;
|
||||
softfloat_exception_flags:=0;
|
||||
end;
|
||||
|
||||
|
@ -15,6 +15,34 @@
|
||||
**********************************************************************}
|
||||
|
||||
{$asmmode intel}
|
||||
|
||||
{****************************************************************************
|
||||
FPU Control word
|
||||
****************************************************************************}
|
||||
|
||||
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;
|
||||
|
||||
|
||||
function Get8087CW:word;assembler;
|
||||
asm
|
||||
push bp
|
||||
mov bp, sp
|
||||
push ax
|
||||
fnstcw [bp - 2]
|
||||
pop ax
|
||||
mov sp, bp
|
||||
pop bp
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
EXTENDED data type routines
|
||||
****************************************************************************}
|
||||
|
@ -14,14 +14,16 @@
|
||||
|
||||
{ i386 FPU Controlword }
|
||||
|
||||
{$if defined(cpui386) or defined(cpux86_64)}
|
||||
{$if defined(cpui8086) or defined(cpui386) or defined(cpux86_64)}
|
||||
const
|
||||
Default8087CW : word = $1332;
|
||||
|
||||
procedure Set8087CW(cw:word);
|
||||
function Get8087CW:word;
|
||||
{$ifndef cpui8086}
|
||||
procedure SetSSECSR(w : dword);
|
||||
function GetSSECSR : dword;
|
||||
{$endif not cpui8086}
|
||||
{$endif}
|
||||
|
||||
const
|
||||
|
@ -214,6 +214,7 @@ end;
|
||||
begin
|
||||
StackLength := CheckInitialStkLen(InitialStkLen);
|
||||
StackBottom := __stkbottom;
|
||||
SysInitFPU;
|
||||
{ To be set if this is a GUI or console application }
|
||||
IsConsole := TRUE;
|
||||
{ To be set if this is a library and not a program }
|
||||
|
Loading…
Reference in New Issue
Block a user