mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 00:08:12 +02:00
m68k: Test68000/Test68881 support boilerplate and special support for Amiga
git-svn-id: trunk@35194 -
This commit is contained in:
parent
568048d8ac
commit
7d2360eb0c
@ -28,12 +28,18 @@
|
||||
AmigaOS functions
|
||||
*****************************************************************************}
|
||||
|
||||
{ exec.library functions }
|
||||
|
||||
{$include execf.inc}
|
||||
{$include doslibf.inc}
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
CPU specific
|
||||
*****************************************************************************}
|
||||
|
||||
{$ifdef cpum68k}
|
||||
{$include m68kamiga.inc}
|
||||
{$endif}
|
||||
|
||||
{*****************************************************************************
|
||||
System Dependent Structures/Consts
|
||||
*****************************************************************************}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2015 by Karoly Balogh,
|
||||
Copyright (c) 2015-2016 by Karoly Balogh,
|
||||
member of the Free Pascal development team.
|
||||
|
||||
m68k/Amiga atomic operations implementation
|
||||
Amiga specific m68k functions
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
@ -20,6 +20,7 @@
|
||||
the ops themselves. It of course won't be hardware-atomic, but should
|
||||
be safe for multithreading. (KB) }
|
||||
|
||||
{$DEFINE FPC_SYSTEM_HAS_INTERLOCKEDFUNCS}
|
||||
function InterLockedDecrement (var Target: longint) : longint;
|
||||
begin
|
||||
Forbid;
|
||||
@ -64,3 +65,25 @@ function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comp
|
||||
Target := NewValue;
|
||||
Permit;
|
||||
end;
|
||||
|
||||
|
||||
{ AmigaOS tells us what CPU we run on, so just use that }
|
||||
{$DEFINE FPC_SYSTEM_HAS_TEST68K}
|
||||
procedure Test68k(var CPU: byte; var FPU: byte);
|
||||
var
|
||||
flags: DWord;
|
||||
begin
|
||||
flags:=PExecBase(AOS_ExecBase)^.AttnFlags;
|
||||
|
||||
CPU:=0;
|
||||
if (flags and AFF_68010) > 0 then CPU:=1;
|
||||
if (flags and AFF_68020) > 0 then CPU:=2;
|
||||
if (flags and AFF_68030) > 0 then CPU:=3;
|
||||
if (flags and AFF_68040) > 0 then CPU:=4;
|
||||
if (flags and AFF_68060) > 0 then CPU:=6;
|
||||
|
||||
FPU:=0;
|
||||
if (flags and AFF_68881) > 0 then FPU:=1;
|
||||
if (flags and AFF_68882) > 0 then FPU:=2;
|
||||
if (flags and AFF_FPU40) > 0 then FPU:=CPU; // 040 or 060 with FPU
|
||||
end;
|
||||
|
@ -115,9 +115,6 @@ implementation
|
||||
|
||||
{$I system.inc}
|
||||
{$I osdebug.inc}
|
||||
{$ifdef cpum68k}
|
||||
{$I m68kamiga.inc}
|
||||
{$endif}
|
||||
|
||||
{$IFDEF AMIGAOS4}
|
||||
// Required to allow opening of utility library interface...
|
||||
@ -318,6 +315,9 @@ begin
|
||||
{ Setup heap }
|
||||
InitHeap;
|
||||
SysInitExceptions;
|
||||
{$ifdef cpum68k}
|
||||
fpc_cpucodeinit;
|
||||
{$endif}
|
||||
initunicodestringmanager;
|
||||
{ Setup stdin, stdout and stderr }
|
||||
SysInitStdIO;
|
||||
|
@ -371,7 +371,7 @@ asm
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$IFNDEF HASAMIGA}
|
||||
{$IFNDEF FPC_SYSTEM_HAS_INTERLOCKEDFUNCS}
|
||||
function InterLockedDecrement (var Target: longint) : longint;
|
||||
begin
|
||||
{$warning FIX ME}
|
||||
@ -411,7 +411,16 @@ function InterlockedCompareExchange(var Target: longint; NewValue: longint; Comp
|
||||
if Target = Comperand then
|
||||
Target := NewValue;
|
||||
end;
|
||||
{$ENDIF HASAMIGA}
|
||||
{$ENDIF FPC_SYSTEM_HAS_INTERLOCKEDFUNCS}
|
||||
|
||||
{$ifndef FPC_SYSTEM_HAS_TEST68K}
|
||||
procedure Test68k(var CPU: byte; var FPU: byte);
|
||||
begin
|
||||
{$warning Implement me!}
|
||||
CPU:=0;
|
||||
FPU:=0;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
{$if defined(CPUM68K_HAS_BYTEREV) or defined(CPUM68K_HAS_ROLROR)}
|
||||
{ Disabled for now, because not all cases below were tested. (KB) }
|
||||
@ -585,3 +594,8 @@ asm
|
||||
{$endif}
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_SWAPENDIAN}
|
||||
|
||||
procedure fpc_cpucodeinit;
|
||||
begin
|
||||
Test68k(Test68000,Test68881);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user