+ fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit

initialises
  + fpu exceptions for invalid operations and division by zero enabled for
    ppc
This commit is contained in:
Jonas Maebe 2004-01-02 17:21:50 +00:00
parent 2af569745c
commit 6bd3eccdac
5 changed files with 103 additions and 5 deletions

View File

@ -21,6 +21,10 @@
Primitives
****************************************************************************}
procedure fpc_cpuinit;
begin
end;
function geteipasebx : pointer;assembler;[public,alias:'FPC_GETEIPINEBX'];
asm
movl (%esp),%ebx
@ -1414,7 +1418,13 @@ end;
{
$Log$
Revision 1.56 2003-12-24 23:07:28 peter
Revision 1.57 2004-01-02 17:22:14 jonas
+ fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit
initialises
+ fpu exceptions for invalid operations and division by zero enabled for
ppc
Revision 1.56 2003/12/24 23:07:28 peter
* fixed indexbyte for regcall
Revision 1.55 2003/12/04 21:44:39 peter

View File

@ -598,6 +598,8 @@ procedure fpc_InitializeUnits;[public,alias:'FPC_INITIALIZEUNITS']; {$ifdef hasc
var
i : longint;
begin
{ call cpu/fpu initialisation routine }
fpc_cpuinit;
with InitFinalTable do
begin
for i:=1to TableCount do
@ -857,7 +859,13 @@ end;
{
$Log$
Revision 1.48 2004-01-01 17:58:16 jonas
Revision 1.49 2004-01-02 17:21:50 jonas
+ fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit
initialises
+ fpu exceptions for invalid operations and division by zero enabled for
ppc
Revision 1.48 2004/01/01 17:58:16 jonas
+ integer division-by-zero detection support for ppc
+ compilerproc FPC_DIVBYZERO

View File

@ -30,6 +30,10 @@
{****************************************************************************}
procedure fpc_cpuinit;
begin
end;
{ Don't call the following routines directly. }
Procedure Hlt;[public,alias: 'FPC_HALT_ERROR'];
{ called by code generator on run-time errors. }
@ -688,7 +692,13 @@ end;
{
$Log$
Revision 1.3 2002-09-07 16:01:20 peter
Revision 1.4 2004-01-02 17:22:14 jonas
+ fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit
initialises
+ fpu exceptions for invalid operations and division by zero enabled for
ppc
Revision 1.3 2002/09/07 16:01:20 peter
* old logs removed and tabs fixed
}

View File

@ -22,6 +22,58 @@
{****************************************************************************
PowerPC specific stuff
****************************************************************************}
{
const
ppc_fpu_overflow = (1 shl (32-3));
ppc_fpu_underflow = (1 shl (32-4));
ppc_fpu_divbyzero = (1 shl (32-5));
ppc_fpu_inexact = (1 shl (32-6));
ppc_fpu_invalid_snan = (1 shl (32-7));
}
procedure fpc_enable_ppc_fpu_exceptions;
assembler;
asm
{ clear all "exception happened" flags we care about}
mtfsfi 0,0
mtfsfi 1,0
{ enable invalid operations and division by zero exceptions. }
{ No overflow/underflow, since those give some spurious }
{ exceptions }
mtfsfi 6,9
end;
procedure fpc_cpuinit;
begin
fpc_enable_ppc_fpu_exceptions;
end;
{
doesn't work, at least not on linux, because there after an exception
fpscr is set to 0 (JM)
}
(*
function fpc_get_ppc_fpscr: cardinal;
assembler;
var
temp: record a,b:longint; end;
asm
mffs f0
stfd f0,temp
lwz r3,temp.b
{ clear all exception flags }
{
rlwinm r4,r3,0,16,31
stw r4,temp.b
lfd f0,temp
a_mtfsf f0
}
end;
*)
{ This function is never called directly, it's a dummy to hold the register save/
load subroutines
@ -584,6 +636,7 @@ asm
{ r3 still contains -1 here }
bne .LIndexWordDone
sub r3,r10,r0
srawi r3,r3,1
.LIndexWordDone:
end;
@ -609,6 +662,7 @@ asm
{ r3 still contains -1 here }
bne .LIndexDWordDone
sub r3,r10,r0
srawi r3,r3,2
.LIndexDWordDone:
end;
@ -1006,7 +1060,13 @@ end;
{
$Log$
Revision 1.61 2003-12-28 21:06:56 jonas
Revision 1.62 2004-01-02 17:21:50 jonas
+ fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit
initialises
+ fpu exceptions for invalid operations and division by zero enabled for
ppc
Revision 1.61 2003/12/28 21:06:56 jonas
* fixed fillchar for SYSV abi
Revision 1.60 2003/12/21 21:23:09 florian

View File

@ -1,3 +1,7 @@
procedure fpc_cpuinit;
begin
end;
{$define FPC_SYSTEM_HAS_GET_FRAME}
function get_frame:pointer;{assembler;}
begin{asm}
@ -31,7 +35,13 @@ begin{asm}
end;
{
$Log$
Revision 1.4 2003-12-04 21:42:07 peter
Revision 1.5 2004-01-02 17:22:14 jonas
+ fpc_cpuinit procedure to allow cpu/fpu initialisation before any unit
initialises
+ fpu exceptions for invalid operations and division by zero enabled for
ppc
Revision 1.4 2003/12/04 21:42:07 peter
* register calling updates
Revision 1.3 2003/03/17 14:30:11 peter