mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-05 23:50:23 +02:00
* detect sse properly on linux, fixes tmask*.pp in the testsuite with -Cfsse2
git-svn-id: trunk@6277 -
This commit is contained in:
parent
d50bc40cbe
commit
bcf65051e3
@ -19,6 +19,8 @@
|
||||
****************************************************************************}
|
||||
var
|
||||
os_supports_sse : boolean;
|
||||
{ this variable is set to true, if currently an sse check is executed and no sig ill should be generated }
|
||||
sse_check : boolean;
|
||||
|
||||
{$asmmode intel}
|
||||
|
||||
@ -1218,6 +1220,25 @@ Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
end;
|
||||
|
||||
|
||||
{ because of the brain dead sse detection on x86, this test is post poned }
|
||||
procedure fpc_cpucodeinit;
|
||||
begin
|
||||
os_supports_sse:=true;
|
||||
sse_check:=true;
|
||||
asm
|
||||
{ force an sse exception if no sse is supported, the exception handler sets
|
||||
os_supports_sse to false then }
|
||||
{ don't change this instruction, the code above depends on its size }
|
||||
movq %xmm0,%xmm0
|
||||
end;
|
||||
sse_check:=false;
|
||||
has_sse_support:=sse_support;
|
||||
has_mmx_support:=mmx_support;
|
||||
SysResetFPU;
|
||||
setup_fastmove;
|
||||
end;
|
||||
|
||||
|
||||
{$ifndef darwin}
|
||||
{ darwin requires that the stack is aligned to 16 bytes when calling another function }
|
||||
|
||||
|
@ -64,7 +64,11 @@ begin
|
||||
end;
|
||||
SIGBUS:
|
||||
res:=214;
|
||||
SIGILL,
|
||||
SIGILL:
|
||||
if sse_check then
|
||||
res:=0
|
||||
else
|
||||
res:=216;
|
||||
SIGSEGV :
|
||||
res:=216;
|
||||
end;
|
||||
|
@ -300,16 +300,21 @@ var
|
||||
initialstkptr : Pointer;external name '__stkptr';
|
||||
begin
|
||||
SysResetFPU;
|
||||
{$if defined(cpupowerpc)}
|
||||
{$if defined(cpupowerpc)}
|
||||
// some PPC kernels set the exception bits FE0/FE1 in the MSR to zero,
|
||||
// disabling all FPU exceptions. Enable them again.
|
||||
fpprctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE);
|
||||
{$endif}
|
||||
{$endif}
|
||||
IsConsole := TRUE;
|
||||
StackLength := CheckInitialStkLen(initialStkLen);
|
||||
StackBottom := initialstkptr - StackLength;
|
||||
{ Set up signals handlers }
|
||||
InstallSignals;
|
||||
|
||||
{$if defined(cpui386)}
|
||||
fpc_cpucodeinit;
|
||||
{$endif cpui386}
|
||||
|
||||
{ Setup heap }
|
||||
InitHeap;
|
||||
SysInitExceptions;
|
||||
|
@ -744,10 +744,6 @@ procedure JumpToHandleErrorFrame;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
{ this variable is set to true, if currently an sse check is executed and no sig ill should be generated }
|
||||
sse_check : boolean;
|
||||
|
||||
function syswin32_i386_exception_handler(excep : PExceptionPointers) : Longint;stdcall;
|
||||
var
|
||||
res: longint;
|
||||
@ -897,25 +893,6 @@ end;
|
||||
|
||||
{$endif Set_i386_Exception_handler}
|
||||
|
||||
{ because of the brain dead sse detection on x86, this test is post poned }
|
||||
procedure fpc_cpucodeinit;
|
||||
begin
|
||||
os_supports_sse:=true;
|
||||
sse_check:=true;
|
||||
asm
|
||||
{ force an sse exception if no sse is supported, the exception handler sets
|
||||
os_supports_sse to false then }
|
||||
{ don't change this instruction, the code above depends on its size }
|
||||
movq %xmm0,%xmm0
|
||||
end;
|
||||
sse_check:=false;
|
||||
has_sse_support:=sse_support;
|
||||
has_mmx_support:=mmx_support;
|
||||
SysResetFPU;
|
||||
setup_fastmove;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
OS dependend widestrings
|
||||
****************************************************************************}
|
||||
|
Loading…
Reference in New Issue
Block a user