mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 22:49:23 +02:00
aros: implemented pascal sysinit, will be shared across all cpus. also refactored the RTL build
git-svn-id: trunk@35237 -
This commit is contained in:
parent
789fb552d5
commit
d084bd0d3b
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -8396,6 +8396,7 @@ rtl/arm/thumb2.inc svneol=native#text/plain
|
|||||||
rtl/aros/Makefile svneol=native#text/plain
|
rtl/aros/Makefile svneol=native#text/plain
|
||||||
rtl/aros/Makefile.fpc svneol=native#text/plain
|
rtl/aros/Makefile.fpc svneol=native#text/plain
|
||||||
rtl/aros/arm/prt0.as svneol=native#text/plain
|
rtl/aros/arm/prt0.as svneol=native#text/plain
|
||||||
|
rtl/aros/buildrtl.pp svneol=native#text/plain
|
||||||
rtl/aros/doslibd.inc svneol=native#text/plain
|
rtl/aros/doslibd.inc svneol=native#text/plain
|
||||||
rtl/aros/i386/doslibf.inc svneol=native#text/plain
|
rtl/aros/i386/doslibf.inc svneol=native#text/plain
|
||||||
rtl/aros/i386/execd.inc svneol=native#text/plain
|
rtl/aros/i386/execd.inc svneol=native#text/plain
|
||||||
@ -8404,6 +8405,7 @@ rtl/aros/i386/prt0.as svneol=native#text/plain
|
|||||||
rtl/aros/i386/utild1.inc svneol=native#text/plain
|
rtl/aros/i386/utild1.inc svneol=native#text/plain
|
||||||
rtl/aros/i386/utild2.inc svneol=native#text/plain
|
rtl/aros/i386/utild2.inc svneol=native#text/plain
|
||||||
rtl/aros/i386/utilf.inc svneol=native#text/plain
|
rtl/aros/i386/utilf.inc svneol=native#text/plain
|
||||||
|
rtl/aros/si_prc.pp svneol=native#text/plain
|
||||||
rtl/aros/system.pp svneol=native#text/plain
|
rtl/aros/system.pp svneol=native#text/plain
|
||||||
rtl/aros/timerd.inc svneol=native#text/plain
|
rtl/aros/timerd.inc svneol=native#text/plain
|
||||||
rtl/aros/x86_64/prt0.as svneol=native#text/plain
|
rtl/aros/x86_64/prt0.as svneol=native#text/plain
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,29 +6,24 @@
|
|||||||
main=rtl
|
main=rtl
|
||||||
|
|
||||||
[target]
|
[target]
|
||||||
loaders=prt0
|
loaders=$(LOADERS)
|
||||||
units=$(SYSTEMUNIT) uuchar objpas macpas iso7185 extpas strings \
|
units=$(SYSTEMUNIT) heaptrc uuchar objpas macpas iso7185 extpas lineinfo buildrtl cpall
|
||||||
fpintres dos heaptrc lineinfo ctypes \
|
implicitunits=$(SYSINITUNITS) athreads dos sysutils \
|
||||||
sysutils fgl classes math typinfo \
|
ctypes strings rtlconsts sysconst math types \
|
||||||
charset cpall getopts \
|
typinfo fgl classes charset character getopts \
|
||||||
types rtlconsts sysconst character \
|
fpintres exeinfo \
|
||||||
athreads
|
cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
|
||||||
implicitunits=exeinfo cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
|
|
||||||
cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 \
|
cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 \
|
||||||
unicodedata unicodenumtable
|
unicodedata unicodenumtable
|
||||||
# \
|
|
||||||
# exec timer doslib utility hardware inputevent graphics layers \
|
rsts=math rtlconsts typinfo classes sysconst
|
||||||
# intuition aboxlib mui \
|
|
||||||
# these can be moved to packages later
|
|
||||||
# clipboard datatypes asl ahi tinygl get9 muihelper \
|
|
||||||
rsts=math rtlconsts typinfo classes sysconst
|
|
||||||
#implicitunits=exeinfo
|
|
||||||
|
|
||||||
[require]
|
[require]
|
||||||
nortl=y
|
nortl=y
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
fpcpackage=y
|
fpcpackage=y
|
||||||
|
buildunit=buildrtl
|
||||||
|
|
||||||
[default]
|
[default]
|
||||||
fpcdir=../..
|
fpcdir=../..
|
||||||
@ -45,9 +40,10 @@ INC=$(RTL)/inc
|
|||||||
COMMON=$(RTL)/common
|
COMMON=$(RTL)/common
|
||||||
PROCINC=$(RTL)/$(CPU_TARGET)
|
PROCINC=$(RTL)/$(CPU_TARGET)
|
||||||
AMIINC=$(RTL)/amicommon
|
AMIINC=$(RTL)/amicommon
|
||||||
|
|
||||||
UNITPREFIX=rtl
|
UNITPREFIX=rtl
|
||||||
|
LOADERS=prt0
|
||||||
SYSTEMUNIT=system
|
SYSTEMUNIT=system
|
||||||
|
SYSINITUNITS=si_prc
|
||||||
|
|
||||||
# Use new feature from 1.0.5 version
|
# Use new feature from 1.0.5 version
|
||||||
# that generates release PPU files
|
# that generates release PPU files
|
||||||
@ -91,149 +87,28 @@ prt0$(OEXT) : $(CPU_TARGET)/prt0.as
|
|||||||
$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
|
$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
|
||||||
$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
|
$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
|
||||||
|
|
||||||
uuchar$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(INC)/uuchar.pp
|
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||||
|
$(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
|
||||||
|
|
||||||
|
uuchar$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(INC)/uuchar.pp heaptrc$(PPUEXT)
|
||||||
|
$(COMPILER) $(INC)/uuchar.pp
|
||||||
|
|
||||||
objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
|
objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
|
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
|
||||||
|
|
||||||
strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
|
macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) buildrtl$(PPUEXT) heaptrc$(PPUEXT)
|
||||||
$(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
|
$(COMPILER) $(INC)/macpas.pp
|
||||||
$(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
#
|
iso7185$(PPUEXT) : $(INC)/iso7185.pp buildrtl$(PPUEXT) heaptrc$(PPUEXT)
|
||||||
# System Dependent Units
|
$(COMPILER) $(INC)/iso7185.pp
|
||||||
#
|
|
||||||
|
|
||||||
#ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
extpas$(PPUEXT) : $(INC)/extpas.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) heaptrc$(PPUEXT)
|
||||||
|
$(COMPILER) $(INC)/extpas.pp
|
||||||
|
|
||||||
#doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||||
|
|
||||||
#
|
buildrtl$(PPUEXT): buildrtl.pp system$(PPUEXT) objpas$(PPUEXT) heaptrc$(PPUEXT)
|
||||||
# TP7 Compatible RTL Units
|
$(COMPILER) -Fi$(OBJPASDIR)/sysutils -Fi$(OBJPASDIR)/classes -Fu$(PROCINC) -Fu$(AMIINC) -I$(INC) -Fu$(INC) -Fu$(OBJPASDIR) buildrtl
|
||||||
#
|
|
||||||
|
|
||||||
dos$(PPUEXT) : $(AMIINC)/dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
|
cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) objpas$(PPUEXT) heaptrc$(PPUEXT)
|
||||||
$(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
#crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
#objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
|
|
||||||
#graph$(PPUEXT) : graph.pp
|
|
||||||
|
|
||||||
#
|
|
||||||
# Delphi Compatible Units
|
|
||||||
#
|
|
||||||
|
|
||||||
sysutils$(PPUEXT) : $(AMIINC)/sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
|
|
||||||
objpas$(PPUEXT) dos$(PPUEXT) sysconst$(PPUEXT)
|
|
||||||
$(COMPILER) -Fi$(OBJPASDIR)/sysutils $(AMIINC)/sysutils.pp
|
|
||||||
|
|
||||||
classes$(PPUEXT) : $(AMIINC)/classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
|
|
||||||
sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT) fgl$(PPUEXT)
|
|
||||||
$(COMPILER) -Fi$(OBJPASDIR)/classes $(AMIINC)/classes.pp
|
|
||||||
|
|
||||||
typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
|
|
||||||
$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
|
|
||||||
|
|
||||||
math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
|
||||||
$(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
|
|
||||||
|
|
||||||
#varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
|
|
||||||
# $(OBJPASDIR)/varutilh.inc varutils.pp
|
|
||||||
# $(COMPILER) -I$(OBJPASDIR) varutils.pp $(REDIR)
|
|
||||||
|
|
||||||
#fmtbcd$(PPUEXT) : $(OBJPASDIR)/fmtbcd.pp objpas$(PPUEXT) sysutils$(PPUEXT) variants$(PPUEXT) classes$(PPUEXT) system$(PPUEXT)
|
|
||||||
# $(COMPILER) $(OBJPASDIR)/fmtbcd.pp
|
|
||||||
|
|
||||||
character$(PPUEXT): sysutils$(PPUEXT) $(OBJPASDIR)/character.pas objpas$(PPUEXT) rtlconsts$(PPUEXT)
|
|
||||||
$(COMPILER) $(OBJPASDIR)/character.pas
|
|
||||||
|
|
||||||
fgl$(PPUEXT) : $(OBJPASDIR)/fgl.pp objpas$(PPUEXT) types$(PPUEXT) system$(PPUEXT) sysutils$(PPUEXT)
|
|
||||||
$(COMPILER) $(OBJPASDIR)/fgl.pp
|
|
||||||
|
|
||||||
types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
$(COMPILER) $(OBJPASDIR)/types.pp
|
|
||||||
|
|
||||||
rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp
|
|
||||||
$(COMPILER) $(OBJPASDIR)/rtlconsts.pp
|
|
||||||
|
|
||||||
sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
$(COMPILER) $(OBJPASDIR)/sysconst.pp
|
|
||||||
|
|
||||||
dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp
|
|
||||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutil.pp
|
|
||||||
|
|
||||||
#
|
|
||||||
# Mac Pascal Model
|
|
||||||
#
|
|
||||||
|
|
||||||
macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT)
|
|
||||||
$(COMPILER) $(INC)/macpas.pp $(REDIR)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Other system-independent RTL Units
|
|
||||||
#
|
|
||||||
|
|
||||||
ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
$(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
|
|
||||||
|
|
||||||
#lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
|
|
||||||
cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) charset$(PPUEXT)
|
|
||||||
$(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
|
$(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
|
||||||
|
|
||||||
fpintres$(PPUEXT) : $(INC)/fpintres.pp $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
$(COMPILER) $(INC)/fpintres.pp
|
|
||||||
|
|
||||||
#
|
|
||||||
# Other system-dependent RTL Units
|
|
||||||
#
|
|
||||||
|
|
||||||
athreads$(PPUEXT) : athreads.pp $(SYSTEMUNIT)$(PPUEXT)
|
|
||||||
$(COMPILER) $(AMIINC)/athreads.pp
|
|
||||||
|
|
||||||
#exec$(PPUEXT) : exec.pp execf.inc execd.inc
|
|
||||||
|
|
||||||
#timer$(PPUEXT) : timer.pp timerd.inc timerf.inc
|
|
||||||
|
|
||||||
#utility$(PPUEXT) : utility.pp exec$(PPUEXT) utilf.inc utild1.inc utild2.inc
|
|
||||||
|
|
||||||
#doslib$(PPUEXT) : doslib.pp exec$(PPUEXT) timer$(PPUEXT) doslibd.inc doslibf.inc
|
|
||||||
|
|
||||||
#hardware$(PPUEXT): hardware.pas exec$(PPUEXT)
|
|
||||||
|
|
||||||
#inputevent$(PPUEXT): inputevent.pas exec$(PPUEXT) timer$(PPUEXT) utility$(PPUEXT)
|
|
||||||
|
|
||||||
#graphics$(PPUEXT): graphics.pas exec$(PPUEXT) utility$(PPUEXT) hardware$(PPUEXT)
|
|
||||||
|
|
||||||
#layers$(PPUEXT) : layers.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
|
|
||||||
|
|
||||||
#intuition$(PPUEXT): intuition.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT) \
|
|
||||||
# inputevent$(PPUEXT) timer$(PPUEXT) layers$(PPUEXT)
|
|
||||||
|
|
||||||
#aboxlib$(PPUEXT): aboxlib.pas
|
|
||||||
|
|
||||||
#clipboard$(PPUEXT): clipboard.pas exec$(PPUEXT)
|
|
||||||
|
|
||||||
#datatype$(PPUEXT): datatypes.pas exec$(PPUEXT) doslib$(PPUEXT) intuition$(PPUEXT) \
|
|
||||||
# utility$(PPUEXT) graphics$(PPUEXT)
|
|
||||||
|
|
||||||
#asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
|
|
||||||
|
|
||||||
#ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
|
|
||||||
|
|
||||||
#mui$(PPUEXT): mui.pas exec$(PPUEXT) utility$(PPUEXT) intuition$(PPUEXT) graphics$(PPUEXT)
|
|
||||||
|
|
||||||
#tinygl$(PPUEXT): tinygl.pp exec$(PPUEXT)
|
|
||||||
|
|
||||||
#get9$(PPUEXT): get9.pas exec$(PPUEXT)
|
|
||||||
|
|
||||||
#muihelper$(PPUEXT): muihelper.pas intuition$(PPUEXT) mui$(PPUEXT) doslib$(PPUEXT) utility$(PPUEXT)
|
|
||||||
|
18
rtl/aros/buildrtl.pp
Normal file
18
rtl/aros/buildrtl.pp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
unit buildrtl;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
si_prc,
|
||||||
|
athreads, dos, sysutils,
|
||||||
|
|
||||||
|
ctypes, strings,
|
||||||
|
rtlconsts, sysconst, math, types,
|
||||||
|
lineinfo,
|
||||||
|
typinfo, fgl, classes,
|
||||||
|
charset, character, getopts,
|
||||||
|
fpintres;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
@ -882,9 +882,9 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
PPPCStackSwapArgs = ^TPPCStackSwapArgs;
|
PStackSwapArgs = ^TStackSwapArgs;
|
||||||
TPPCStackSwapArgs = record
|
TStackSwapArgs = record
|
||||||
Args: Array[0..7] Of DWord; { * The C register arguments from gpr3..gpr11 * }
|
Args: Array[0..7] Of Pointer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,11 +44,14 @@ function AttemptSemaphore(SigSem: PSignalSemaphore): LongWord; syscall AOS_ExecB
|
|||||||
function CreateMsgPort: PMsgPort; syscall AOS_ExecBase 111;
|
function CreateMsgPort: PMsgPort; syscall AOS_ExecBase 111;
|
||||||
procedure DeleteMsgPort(Port: PMsgPort); syscall AOS_ExecBase 112;
|
procedure DeleteMsgPort(Port: PMsgPort); syscall AOS_ExecBase 112;
|
||||||
procedure ObtainSemaphoreShared(SigSem: PSignalSemaphore); syscall AOS_ExecBase 113;
|
procedure ObtainSemaphoreShared(SigSem: PSignalSemaphore); syscall AOS_ExecBase 113;
|
||||||
|
function AllocVec(ByteSize: DWord; Requirements: DWord): Pointer; syscall AOS_ExecBase 114;
|
||||||
|
procedure FreeVec(MemoryBlock: Pointer); syscall AOS_ExecBase 115;
|
||||||
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;
|
||||||
function FreePooled(poolHeader: Pointer; memory: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 119;
|
function FreePooled(poolHeader: Pointer; memory: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 119;
|
||||||
procedure StackSwap(NewStack: PStackSwapStruct); syscall AOS_ExecBase 122;
|
procedure StackSwap(NewStack: PStackSwapStruct); syscall AOS_ExecBase 122;
|
||||||
|
function NewStackSwap(NewStack: PStackSwapStruct; Function_: Pointer; Args: PStackSwapArgs): Pointer; syscall AOS_ExecBase 134;
|
||||||
procedure RawPutChar(c: Char); syscall AOS_ExecBase 86;
|
procedure RawPutChar(c: Char); syscall AOS_ExecBase 86;
|
||||||
|
|
||||||
//function RawDoFmt(const formatString : pCHAR;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER): pointer;
|
//function RawDoFmt(const formatString : pCHAR;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER): pointer;
|
||||||
|
83
rtl/aros/si_prc.pp
Normal file
83
rtl/aros/si_prc.pp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Pascal run time library.
|
||||||
|
Copyright (c) 2017 by the Free Pascal development team
|
||||||
|
|
||||||
|
System Entry point for AROS, Pascal only programs
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
unit si_prc;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
AOS_ExecBase: Pointer; public name '_ExecBase';
|
||||||
|
StkLen: LongInt; external name '__stklen';
|
||||||
|
sysinit_jmpbuf: jmp_buf;
|
||||||
|
ExitCode: LongInt;
|
||||||
|
|
||||||
|
{$include execd.inc}
|
||||||
|
{$include execf.inc}
|
||||||
|
|
||||||
|
procedure PascalMainEntry; cdecl; forward;
|
||||||
|
|
||||||
|
{ this function must be the first in this unit which contains code }
|
||||||
|
function _FPC_proc_start(argv: pointer; argc: ptrint; argExecBase: Pointer): longint; cdecl; public name '_start';
|
||||||
|
var
|
||||||
|
sst: TStackSwapStruct;
|
||||||
|
ssp: TStackSwapArgs;
|
||||||
|
newStack: Pointer;
|
||||||
|
newStackAligned: Pointer;
|
||||||
|
task: PTask;
|
||||||
|
begin
|
||||||
|
AOS_ExecBase:=argExecBase;
|
||||||
|
newStack:=nil;
|
||||||
|
newStackAligned:=nil;
|
||||||
|
|
||||||
|
task:=FindTask(nil);
|
||||||
|
if (task^.tc_SPUpper-task^.tc_SPLower < StkLen) then
|
||||||
|
begin
|
||||||
|
newStack:=AllocVec(StkLen+16, MEMF_ANY);
|
||||||
|
newStackAligned:=align(newStack,16);
|
||||||
|
|
||||||
|
sst.stk_Lower:=newStackAligned;
|
||||||
|
sst.stk_Upper:=newStackAligned+StkLen;
|
||||||
|
sst.stk_Pointer:=newStackAligned+StkLen;
|
||||||
|
|
||||||
|
FillChar(ssp,sizeof(ssp),0);
|
||||||
|
NewStackSwap(@sst,@PascalMainEntry,@ssp);
|
||||||
|
|
||||||
|
FreeVec(newStack);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
PascalMainEntry;
|
||||||
|
|
||||||
|
_FPC_proc_start:=ExitCode;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure _FPC_proc_halt(_ExitCode: longint); cdecl; public name '_haltproc';
|
||||||
|
begin
|
||||||
|
ExitCode:=_ExitCode;
|
||||||
|
longjmp(sysinit_jmpbuf,1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure PascalMain; external name 'PASCALMAIN';
|
||||||
|
|
||||||
|
procedure PascalMainEntry; cdecl;
|
||||||
|
begin
|
||||||
|
if setjmp(sysinit_jmpbuf) = 0 then
|
||||||
|
PascalMain;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user