* detect sse properly on linux, fixes tmask*.pp in the testsuite with -Cfsse2

git-svn-id: trunk@6277 -
This commit is contained in:
florian 2007-01-31 21:51:47 +00:00
parent d50bc40cbe
commit bcf65051e3
4 changed files with 33 additions and 26 deletions

View File

@ -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 }

View File

@ -64,7 +64,11 @@ begin
end;
SIGBUS:
res:=214;
SIGILL,
SIGILL:
if sse_check then
res:=0
else
res:=216;
SIGSEGV :
res:=216;
end;

View File

@ -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;

View File

@ -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
****************************************************************************}