Amiga-likes: preparations for inclusion of AThreads into the RTL buildprocess

git-svn-id: trunk@30923 -
This commit is contained in:
Károly Balogh 2015-05-28 00:47:35 +00:00
parent 21a9b96e7e
commit 6afcca7cd3
8 changed files with 19 additions and 10 deletions

View File

@ -31,6 +31,11 @@ type
TRTLCriticalSection = record TRTLCriticalSection = record
{ This must actually be bigger or equal to sizeof(TSignalSemaphore) { This must actually be bigger or equal to sizeof(TSignalSemaphore)
which seems to be 46 bytes on MorphOS and Amiga/m68k. } which seems to be 46 bytes on MorphOS and Amiga/m68k. }
semaphore: array[0..63] of byte; semaphore: array[0..63] of byte;
end; end;
{$ENDIF} {$ENDIF}
{ BeginThread flags we support in AThreads }
const
CREATE_SUSPENDED = 1;
STACK_SIZE_PARAM_IS_A_RESERVATION = 2;

View File

@ -63,7 +63,7 @@ uses
{$i sysutils.inc} {$i sysutils.inc}
{ * Include sytem specific includes * } { * Include system specific includes * }
{$include execd.inc} {$include execd.inc}
{$include execf.inc} {$include execf.inc}
{$include timerd.inc} {$include timerd.inc}
@ -900,7 +900,7 @@ end;
procedure Sleep(Milliseconds: cardinal); procedure Sleep(Milliseconds: cardinal);
begin begin
// Amiga dos.library Delay() has precision of 1/50 seconds // Amiga dos.library Delay() has precision of 1/50 seconds
Delay(Milliseconds div 20); DOSDelay(Milliseconds div 20);
end; end;

View File

@ -111,7 +111,7 @@ SysCall AOS_DOSBase 186;
function DateStamp(date: PDateStamp location 'd1'): PDateStamp; function DateStamp(date: PDateStamp location 'd1'): PDateStamp;
SysCall AOS_DOSBase 192; SysCall AOS_DOSBase 192;
procedure Delay(timeout: LongInt location 'd1'); procedure DOSDelay(timeout: LongInt location 'd1');
SysCall AOS_DOSBase 198; SysCall AOS_DOSBase 198;
function WaitForChar(file1 : LongInt location 'd1'; function WaitForChar(file1 : LongInt location 'd1';

View File

@ -322,7 +322,7 @@ end;
procedure EmptyFunc; procedure EmptyFunc;
begin begin
Delay(1); DOSDelay(1);
ReleaseSemaphore(@AROSThreadStruct^.EmptySemaphore); ReleaseSemaphore(@AROSThreadStruct^.EmptySemaphore);
end; end;
@ -379,7 +379,7 @@ begin
NP_Entry, PtrUInt(@EmptyFunc), NP_Entry, PtrUInt(@EmptyFunc),
TAG_DONE, TAG_END]); TAG_DONE, TAG_END]);
ObtainSemaphore(@AROSThreadStruct^.EmptySemaphore); ObtainSemaphore(@AROSThreadStruct^.EmptySemaphore);
Delay(1); DOSDelay(1);
end; end;
// //
NewThread^.Task := CreateNewProcTags([ NewThread^.Task := CreateNewProcTags([

View File

@ -34,7 +34,7 @@ function IoErr: longint; syscall AOS_DOSBase 22;
procedure dosExit(ErrCode: longint); syscall AOS_DOSBase 24; procedure dosExit(ErrCode: longint); syscall AOS_DOSBase 24;
function SetProtection(const name: PChar; protect: longword): LongInt; syscall AOS_DOSBase 31; function SetProtection(const name: PChar; protect: longword): LongInt; syscall AOS_DOSBase 31;
function DateStamp(date: PDateStamp): PDateStamp; syscall AOS_DOSBase 32; function DateStamp(date: PDateStamp): PDateStamp; syscall AOS_DOSBase 32;
procedure Delay(ticks: LongWord); syscall AOS_DOSBase 33; procedure dosDelay(ticks: LongWord); syscall AOS_DOSBase 33;
function AllocDosObject(Type_: LongWord; const Tags: PTagItem): Pointer; syscall AOS_DOSBase 38; function AllocDosObject(Type_: LongWord; const Tags: PTagItem): Pointer; syscall AOS_DOSBase 38;
procedure FreeDosObject(Type_: LongWord; Ptr: Pointer); syscall AOS_DOSBase 39; procedure FreeDosObject(Type_: LongWord; Ptr: Pointer); syscall AOS_DOSBase 39;
function SetFileDate(name: PChar; date: PDateStamp): LongBool; syscall AOS_DOSBase 66; function SetFileDate(name: PChar; date: PDateStamp): LongBool; syscall AOS_DOSBase 66;

View File

@ -2,7 +2,7 @@
This file is part of the Free Pascal run time library. This file is part of the Free Pascal run time library.
Copyright (c) 2006 Karoly Balogh Copyright (c) 2006 Karoly Balogh
exec functions (V40) for Amiga/PowerPC exec functions for AROS/i386
See the file COPYING.FPC, included in this distribution, See the file COPYING.FPC, included in this distribution,
for details about the copyright. for details about the copyright.
@ -28,6 +28,7 @@ function AllocSignal(signalNum: LongInt): ShortInt; syscall LocalExecBase 55;
procedure FreeSignal(signalNum: LongInt); syscall LocalExecBase 56; procedure FreeSignal(signalNum: LongInt); syscall LocalExecBase 56;
procedure AddPort(port: PMsgPort); syscall LocalExecBase 59; procedure AddPort(port: PMsgPort); syscall LocalExecBase 59;
procedure RemPort(port: PMsgPort); syscall LocalExecBase 60; procedure RemPort(port: PMsgPort); syscall LocalExecBase 60;
procedure PutMsg(Port: PMsgPort; Message: PMessage); syscall AOS_ExecBase 61;
function GetMsg(port: PMsgPort): PMessage; syscall LocalExecBase 62; function GetMsg(port: PMsgPort): PMessage; syscall LocalExecBase 62;
procedure ReplyMsg(message : pMessage); syscall LocalExecBase 63; procedure ReplyMsg(message : pMessage); syscall LocalExecBase 63;
function WaitPort(port: PMsgPort): PMessage; syscall LocalExecBase 64; function WaitPort(port: PMsgPort): PMessage; syscall LocalExecBase 64;
@ -40,6 +41,9 @@ procedure InitSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 93;
procedure ObtainSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 94; procedure ObtainSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 94;
procedure ReleaseSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 95; procedure ReleaseSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 95;
function AttemptSemaphore(SigSem: PSignalSemaphore): LongWord; syscall AOS_ExecBase 96; function AttemptSemaphore(SigSem: PSignalSemaphore): LongWord; syscall AOS_ExecBase 96;
function CreateMsgPort: PMsgPort; syscall AOS_ExecBase 111;
procedure DeleteMsgPort(Port: PMsgPort); syscall AOS_ExecBase 112;
procedure ObtainSemaphoreShared(SigSem: PSignalSemaphore); syscall AOS_ExecBase 113;
function CreatePool(requirements: Cardinal; puddleSize: Cardinal; threshSize: Cardinal): Pointer; syscall LocalExecBase 116; function CreatePool(requirements: Cardinal; puddleSize: Cardinal; threshSize: Cardinal): Pointer; syscall LocalExecBase 116;
procedure DeletePool(poolHeader: Pointer); syscall LocalExecBase 117; procedure DeletePool(poolHeader: Pointer); syscall LocalExecBase 117;
function AllocPooled(poolHeader: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 118; function AllocPooled(poolHeader: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 118;

View File

@ -153,7 +153,7 @@ end;
procedure SysThreadSwitch; procedure SysThreadSwitch;
begin begin
Delay(0); DOSDelay(0);
end; end;
function SysSuspendThread(ThreadHandle: THandle): dword; function SysSuspendThread(ThreadHandle: THandle): dword;

View File

@ -114,7 +114,7 @@ SysCall MOS_DOSBase 186;
function DateStamp(date: PDateStamp location 'd1'): PDateStamp; function DateStamp(date: PDateStamp location 'd1'): PDateStamp;
SysCall MOS_DOSBase 192; SysCall MOS_DOSBase 192;
procedure Delay(timeout: LongInt location 'd1'); procedure DOSDelay(timeout: LongInt location 'd1');
SysCall MOS_DOSBase 198; SysCall MOS_DOSBase 198;
function WaitForChar(file1 : LongInt location 'd1'; function WaitForChar(file1 : LongInt location 'd1';