Преглед на файлове

aros: implemented pascal sysinit, will be shared across all cpus. also refactored the RTL build

git-svn-id: trunk@35237 -
Károly Balogh преди 8 години
родител
ревизия
d084bd0d3b
променени са 7 файла, в които са добавени 391 реда и са изтрити 408 реда
  1. 2 0
      .gitattributes
  2. 255 253
      rtl/aros/Makefile
  3. 27 152
      rtl/aros/Makefile.fpc
  4. 18 0
      rtl/aros/buildrtl.pp
  5. 3 3
      rtl/aros/i386/execd.inc
  6. 3 0
      rtl/aros/i386/execf.inc
  7. 83 0
      rtl/aros/si_prc.pp

+ 2 - 0
.gitattributes

@@ -8396,6 +8396,7 @@ rtl/arm/thumb2.inc svneol=native#text/plain
 rtl/aros/Makefile svneol=native#text/plain
 rtl/aros/Makefile.fpc 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/i386/doslibf.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/utild2.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/timerd.inc svneol=native#text/plain
 rtl/aros/x86_64/prt0.as svneol=native#text/plain

Файловите разлики са ограничени, защото са твърде много
+ 255 - 253
rtl/aros/Makefile


+ 27 - 152
rtl/aros/Makefile.fpc

@@ -6,29 +6,24 @@
 main=rtl
 
 [target]
-loaders=prt0
-units=$(SYSTEMUNIT) uuchar objpas macpas iso7185 extpas strings \
-      fpintres dos heaptrc lineinfo ctypes \
-      sysutils fgl classes math typinfo \
-      charset cpall getopts \
-      types rtlconsts sysconst character \
-      athreads
-implicitunits=exeinfo cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
+loaders=$(LOADERS)
+units=$(SYSTEMUNIT) heaptrc uuchar objpas macpas iso7185 extpas lineinfo buildrtl cpall
+implicitunits=$(SYSINITUNITS) athreads dos sysutils \
+      ctypes strings rtlconsts sysconst math types \
+      typinfo fgl classes charset character getopts \
+      fpintres exeinfo \
+      cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
       cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 \
       unicodedata unicodenumtable
-# \
-#      exec timer doslib utility hardware inputevent graphics layers \
-#      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
+
+rsts=math rtlconsts typinfo classes sysconst
 
 [require]
 nortl=y
 
 [install]
 fpcpackage=y
+buildunit=buildrtl
 
 [default]
 fpcdir=../..
@@ -45,9 +40,10 @@ INC=$(RTL)/inc
 COMMON=$(RTL)/common
 PROCINC=$(RTL)/$(CPU_TARGET)
 AMIINC=$(RTL)/amicommon
-
 UNITPREFIX=rtl
+LOADERS=prt0
 SYSTEMUNIT=system
+SYSINITUNITS=si_prc
 
 # Use new feature from 1.0.5 version
 # that generates release PPU files
@@ -91,149 +87,28 @@ prt0$(OEXT) : $(CPU_TARGET)/prt0.as
 $(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
         $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
 
-uuchar$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(INC)/uuchar.pp
-
-objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
-        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
-
-strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
-                   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
-                   $(SYSTEMUNIT)$(PPUEXT)
-
-#
-# System Dependent Units
-#
-
-#ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
-
-#doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
-
-#
-# TP7 Compatible RTL Units
-#
-
-dos$(PPUEXT) : $(AMIINC)/dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(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
-
-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)
+uuchar$(PPUEXT): $(SYSTEMUNIT)$(PPUEXT) $(INC)/uuchar.pp heaptrc$(PPUEXT)
+        $(COMPILER) $(INC)/uuchar.pp
 
-#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)
+objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
+        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
 
-#asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
+macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) buildrtl$(PPUEXT) heaptrc$(PPUEXT)
+        $(COMPILER) $(INC)/macpas.pp
 
-#ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
+iso7185$(PPUEXT) : $(INC)/iso7185.pp buildrtl$(PPUEXT) heaptrc$(PPUEXT)
+        $(COMPILER) $(INC)/iso7185.pp
 
-#mui$(PPUEXT): mui.pas exec$(PPUEXT) utility$(PPUEXT) intuition$(PPUEXT) graphics$(PPUEXT)
+extpas$(PPUEXT) : $(INC)/extpas.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT) heaptrc$(PPUEXT)
+        $(COMPILER) $(INC)/extpas.pp
 
-#tinygl$(PPUEXT): tinygl.pp exec$(PPUEXT)
+lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
 
-#get9$(PPUEXT): get9.pas exec$(PPUEXT)
+buildrtl$(PPUEXT): buildrtl.pp system$(PPUEXT) objpas$(PPUEXT) heaptrc$(PPUEXT)
+        $(COMPILER) -Fi$(OBJPASDIR)/sysutils -Fi$(OBJPASDIR)/classes -Fu$(PROCINC) -Fu$(AMIINC) -I$(INC) -Fu$(INC) -Fu$(OBJPASDIR) buildrtl
 
-#muihelper$(PPUEXT): muihelper.pas intuition$(PPUEXT) mui$(PPUEXT) doslib$(PPUEXT) utility$(PPUEXT)
+cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) objpas$(PPUEXT) heaptrc$(PPUEXT)
+        $(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas

+ 18 - 0
rtl/aros/buildrtl.pp

@@ -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.

+ 3 - 3
rtl/aros/i386/execd.inc

@@ -882,9 +882,9 @@ type
   end;
 
 type
-  PPPCStackSwapArgs = ^TPPCStackSwapArgs;
-  TPPCStackSwapArgs = record
-    Args: Array[0..7] Of DWord; { * The C register arguments from gpr3..gpr11 * }
+  PStackSwapArgs = ^TStackSwapArgs;
+  TStackSwapArgs = record
+    Args: Array[0..7] Of Pointer;
   end;
 
 

+ 3 - 0
rtl/aros/i386/execf.inc

@@ -44,11 +44,14 @@ function AttemptSemaphore(SigSem: PSignalSemaphore): LongWord; syscall AOS_ExecB
 function CreateMsgPort: PMsgPort; syscall AOS_ExecBase 111;
 procedure DeleteMsgPort(Port: PMsgPort); syscall AOS_ExecBase 112;
 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;
 procedure DeletePool(poolHeader: Pointer); syscall LocalExecBase 117;
 function AllocPooled(poolHeader: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 118;
 function FreePooled(poolHeader: Pointer; memory: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 119;
 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;
 
 //function RawDoFmt(const formatString : pCHAR;const dataStream : POINTER; putChProc : tPROCEDURE; putChData : POINTER): pointer;

+ 83 - 0
rtl/aros/si_prc.pp

@@ -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.

Някои файлове не бяха показани, защото твърде много файлове са промени