diff --git a/rtl/riscv32/riscv32.inc b/rtl/riscv32/riscv32.inc index 2841ec1089..f5b5242383 100644 --- a/rtl/riscv32/riscv32.inc +++ b/rtl/riscv32/riscv32.inc @@ -90,7 +90,7 @@ begin softfloat_exception_mask:=[exPrecision,exUnderflow]; {$ifdef FPUFD} cw:=GetNativeFPUControlWord; - { riscv does not support triggering exceptoins when FPU exceptions happen; + { riscv does not support triggering exceptions when FPU exceptions happen; it merely records which exceptions have happened until now -> clear } cw.cw:=0; { round to nearest } diff --git a/rtl/x86_64/x86_64.inc b/rtl/x86_64/x86_64.inc index b99765cf5e..5dca324201 100644 --- a/rtl/x86_64/x86_64.inc +++ b/rtl/x86_64/x86_64.inc @@ -1621,20 +1621,19 @@ 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; - localmxcsr:=DefaultMXCSR; - asm - fninit - fwait - fldcw localfpucw - ldmxcsr localmxcsr - end; +Procedure SysResetFPU;assembler;nostackframe; + asm + fninit + fwait +{$ifdef FPC_PIC} + movq Default8087CW@GOTPCREL(%rip),%rax + fldcw (%rax) + movq DefaultMXCSR@GOTPCREL(%rip),%rax + ldmxcsr (%rax) +{$else FPC_PIC} + fldcw Default8087CW(%rip) + ldmxcsr DefaultMXCSR(%rip) +{$endif FPC_PIC} end;