浏览代码

Fixed linking problem with constant MathArray values defined in other modules: applied same handling as for string values.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6323 8c9fc860-2736-0410-a75d-ab315db34111
eth.tmartiel 10 年之前
当前提交
807dda4cc9
共有 100 个文件被更改,包括 1591 次插入0 次删除
  1. 61 0
      AosVM/Aos.vmx
  2. 18 0
      AosVM/AosVM.vmdk
  3. 18 0
      AosVM/AosVMDisk2.vmdk
  4. 18 0
      AosVM/AosVMDisk3.vmdk
  5. 二进制
      AosVM/GenerateVMImages.Text
  6. 20 0
      UnixAos/boot/Makefile.darwin
  7. 20 0
      UnixAos/boot/Makefile.darwin.amd64
  8. 18 0
      UnixAos/boot/Makefile.linux
  9. 18 0
      UnixAos/boot/Makefile.linux.amd64
  10. 19 0
      UnixAos/boot/Makefile.solaris
  11. 19 0
      UnixAos/boot/Makefile.solaris.amd64
  12. 245 0
      UnixAos/boot/Threads.darwin.c
  13. 43 0
      UnixAos/boot/Threads.h
  14. 292 0
      UnixAos/boot/Threads.linux.c
  15. 176 0
      UnixAos/boot/Threads.solaris.c
  16. 466 0
      UnixAos/boot/aos.c
  17. 二进制
      UnixAos/boot/aos.darwin
  18. 二进制
      UnixAos/boot/aos.linux
  19. 二进制
      UnixAos/boot/aos.solaris
  20. 二进制
      UnixAos/buildtools/Darwin.AMD64.Tool
  21. 二进制
      UnixAos/buildtools/Darwin.I386.Tool
  22. 二进制
      UnixAos/buildtools/Linux.AMD64.Tool
  23. 二进制
      UnixAos/buildtools/Linux.I386.Tool
  24. 二进制
      UnixAos/buildtools/Solaris.AMD64.Tool
  25. 二进制
      UnixAos/buildtools/Solaris.I386.Tool
  26. 二进制
      UnixAos/buildtools/UnixAosBuild.Tool
  27. 二进制
      WinAos/Aos.EXE
  28. 二进制
      WinAos/AosDebug.exe
  29. 二进制
      WinAos/PELinker/Arrow.cur
  30. 二进制
      WinAos/PELinker/ColorFill.cur
  31. 二进制
      WinAos/PELinker/Columbus.ico
  32. 二进制
      WinAos/PELinker/Columbus.small.ico
  33. 二进制
      WinAos/PELinker/CopyHand.cur
  34. 二进制
      WinAos/PELinker/Cross.cur
  35. 二进制
      WinAos/PELinker/FlatHand.cur
  36. 二进制
      WinAos/PELinker/MoveHand.cur
  37. 二进制
      WinAos/PELinker/Oberon.ico
  38. 二进制
      WinAos/PELinker/Oberon.small.ico
  39. 二进制
      WinAos/PELinker/Panel.ico
  40. 二进制
      WinAos/PELinker/Panel.small.ico
  41. 二进制
      WinAos/PELinker/Picture.ico
  42. 二进制
      WinAos/PELinker/Picture.small.ico
  43. 二进制
      WinAos/PELinker/Point.cur
  44. 二进制
      WinAos/PELinker/PointHand.cur
  45. 二进制
      WinAos/PELinker/Text.ico
  46. 二进制
      WinAos/PELinker/Text.small.ico
  47. 二进制
      WinAos/PELinker/WinAos.ico
  48. 二进制
      WinAos/PELinker/stub.exe
  49. 二进制
      WinAos/WinOberon/ColumbusObjs.Lib
  50. 二进制
      WinAos/WinOberon/CompilerObjs.Lib
  51. 二进制
      WinAos/WinOberon/CompressObjs.Lib
  52. 二进制
      WinAos/WinOberon/DLLConfiguration.Text
  53. 二进制
      WinAos/WinOberon/Distribution.Text
  54. 二进制
      WinAos/WinOberon/GadgetsIntroObjs.Lib
  55. 二进制
      WinAos/WinOberon/GadgetsOberonObjs.Lib
  56. 二进制
      WinAos/WinOberon/GadgetsProgObjs.Lib
  57. 二进制
      WinAos/WinOberon/GadgetsUseObjs.Lib
  58. 二进制
      WinAos/WinOberon/GettingStarted.Text
  59. 二进制
      WinAos/WinOberon/HTMLIcons.Lib
  60. 二进制
      WinAos/WinOberon/InternetObjs.Lib
  61. 二进制
      WinAos/WinOberon/MainObjs.Lib
  62. 二进制
      WinAos/WinOberon/Mouse.Text
  63. 二进制
      WinAos/WinOberon/MouseObjs.Lib
  64. 二进制
      WinAos/WinOberon/OP2.Errors
  65. 二进制
      WinAos/WinOberon/Oberon3TUIObjs.Lib
  66. 二进制
      WinAos/WinOberon/OberonExternal.Text
  67. 二进制
      WinAos/WinOberon/PlugInsGuide.Text
  68. 二进制
      WinAos/WinOberon/Setup.Tool
  69. 二进制
      WinAos/WinOberon/System.Log
  70. 二进制
      WinAos/WinOberon/TextPopups.Text
  71. 二进制
      WinAos/WinOberon/WatsonObjs.Lib
  72. 二进制
      WinAos/WinOberon/WinMenus.Lib
  73. 52 0
      WinAos/aos.ini
  74. 88 0
      WinAos/license.txt
  75. 二进制
      WinAos/obj/A2Sequencers.Obw
  76. 二进制
      WinAos/obj/ADVAPI32.Obw
  77. 二进制
      WinAos/obj/AFM.Obw
  78. 二进制
      WinAos/obj/AMD64Decoder.Obw
  79. 二进制
      WinAos/obj/ARMDecoder.Obw
  80. 二进制
      WinAos/obj/ASMAMD64.Obw
  81. 二进制
      WinAos/obj/ASN1.Obw
  82. 二进制
      WinAos/obj/AVI.Obw
  83. 二进制
      WinAos/obj/ActiveTimers.Obw
  84. 二进制
      WinAos/obj/AlmSmtpReceiver.Obw
  85. 二进制
      WinAos/obj/AnimationCodec.Obw
  86. 二进制
      WinAos/obj/Archives.Obw
  87. 二进制
      WinAos/obj/Array1dBytes.Obw
  88. 二进制
      WinAos/obj/Array1dCplx.Obw
  89. 二进制
      WinAos/obj/Array1dInt.Obw
  90. 二进制
      WinAos/obj/Array1dRat.Obw
  91. 二进制
      WinAos/obj/Array1dRe.Obw
  92. 二进制
      WinAos/obj/Array2dCplx.Obw
  93. 二进制
      WinAos/obj/Array2dInt.Obw
  94. 二进制
      WinAos/obj/Array2dRat.Obw
  95. 二进制
      WinAos/obj/Array2dRe.Obw
  96. 二进制
      WinAos/obj/ArrayBase.Obw
  97. 二进制
      WinAos/obj/ArrayBaseOptimized.Obw
  98. 二进制
      WinAos/obj/ArrayXdBytes.Obw
  99. 二进制
      WinAos/obj/ArrayXdCplx.Obw
  100. 二进制
      WinAos/obj/ArrayXdInt.Obw

+ 61 - 0
AosVM/Aos.vmx

@@ -0,0 +1,61 @@
+config.version = "8"
+virtualHW.version = "6"
+scsi0.present = "TRUE"
+memsize = "256"
+ide0:0.present = "TRUE"
+ide0:0.fileName = "AosVM.vmdk"
+ide1:0.present = "TRUE"
+ide1:0.fileName = "auto detect"
+ide1:0.deviceType = "cdrom-raw"
+floppy0.autodetect = "TRUE"
+sound.present = "FALSE"
+sound.fileName = "-1"
+sound.autodetect = "TRUE"
+svga.autodetect = "TRUE"
+pciBridge0.present = "TRUE"
+mks.keyboardFilter = "allow"
+displayName = "AosVM"
+guestOS = "win95"
+nvram = "Windows 95.nvram"
+deploymentPlatform = "windows"
+virtualHW.productCompatibility = "hosted"
+tools.upgrade.policy = "useGlobal"
+
+ide1:0.autodetect = "TRUE"
+floppy0.fileName = "A:"
+extendedConfigFile = "Aos.vmxf"
+
+uuid.location = "56 4d 3f b0 9e 6b 53 e0-36 37 22 e8 5a 4a 6e ba"
+uuid.bios = "56 4d 3f b0 9e 6b 53 e0-36 37 22 e8 5a 4a 6e ba"
+ide0:0.redo = ""
+pciBridge0.pciSlotNumber = "17"
+scsi0.pciSlotNumber = "16"
+sound.pciSlotNumber = "-1"
+
+tools.remindInstall = "TRUE"
+
+floppy0.present = "FALSE"
+serial0.present = "TRUE"
+serial0.fileType = "file"
+serial0.fileName = "serialport.txt"
+
+ide0:1.present = "TRUE"
+ide0:1.fileName = "AosVMDisk2.vmdk"
+ide1:1.present = "TRUE"
+ide1:1.fileName = "AosVMDisk3.vmdk"
+
+ide0:1.redo = ""
+ide1:1.redo = ""
+
+tools.syncTime = "FALSE"
+
+usb.present = "TRUE"
+usb.generic.autoconnect = "FALSE"
+ehci.present = "TRUE"
+
+ehci.pciSlotNumber = "32"
+
+checkpoint.vmState = ""
+
+usb.autoConnect.device0 = ""
+!numvcpus = "2"

+ 18 - 0
AosVM/AosVM.vmdk

@@ -0,0 +1,18 @@
+# Disk DescriptorFile
+version=1
+CID=4b99f7e9
+parentCID=ffffffff
+createType="twoGbMaxExtentFlat"
+
+# Extent description
+RW 200000 FLAT "AosVMDisk1-flat.vmdk" 0
+
+# The Disk Data Base 
+#DDB
+
+ddb.virtualHWVersion = "6"
+ddb.geometry.cylinders = "100"
+ddb.geometry.heads = "16"
+ddb.geometry.sectors = "63"
+ddb.adapterType = "ide"
+ddb.toolsVersion = "0"

+ 18 - 0
AosVM/AosVMDisk2.vmdk

@@ -0,0 +1,18 @@
+# Disk DescriptorFile
+version=1
+CID=2c4f65b8
+parentCID=ffffffff
+createType="monolithicFlat"
+
+# Extent description
+RW 100000 FLAT "AosVMDisk2-flat.vmdk" 0
+
+# The Disk Data Base 
+#DDB
+
+ddb.virtualHWVersion = "6"
+ddb.geometry.cylinders = "207"
+ddb.geometry.heads = "16"
+ddb.geometry.sectors = "63"
+ddb.adapterType = "ide"
+ddb.toolsVersion = "0"

+ 18 - 0
AosVM/AosVMDisk3.vmdk

@@ -0,0 +1,18 @@
+# Disk DescriptorFile
+version=1
+CID=4d19b3bf
+parentCID=ffffffff
+createType="monolithicFlat"
+
+# Extent description
+RW 100000 FLAT "AosVMDisk3-flat.vmdk" 0
+
+# The Disk Data Base 
+#DDB
+
+ddb.virtualHWVersion = "6"
+ddb.geometry.cylinders = "18"
+ddb.geometry.heads = "16"
+ddb.geometry.sectors = "63"
+ddb.adapterType = "ide"
+ddb.toolsVersion = "0"

二进制
AosVM/GenerateVMImages.Text


+ 20 - 0
UnixAos/boot/Makefile.darwin

@@ -0,0 +1,20 @@
+#
+
+CC      = gcc -m32
+CFLAGS  = -DDARWIN -I/usr/X11R6/include
+LDFLAGS = -lpthread -L/usr/X11R6/lib -lX11 -lXext -lm
+
+
+
+aos.darwin:	aos.o Threads.darwin.o 
+	$(CC) -o aos.darwin aos.o Threads.darwin.o  $(LDFLAGS) \
+		-arch i386 -framework CoreServices
+	rm -f *.o 
+
+aos.o:	aos.c
+	$(CC) -c $(CFLAGS) aos.c
+
+Threads.darwin.o:	Threads.h Threads.darwin.c
+	$(CC) -c $(CFLAGS) Threads.darwin.c 
+
+

+ 20 - 0
UnixAos/boot/Makefile.darwin.amd64

@@ -0,0 +1,20 @@
+#
+
+CC      = gcc -m64
+CFLAGS  = -DDARWIN -I/usr/X11R6/include
+LDFLAGS = -lpthread -L/usr/X11R6/lib -lX11 -lXext -lm
+
+
+
+aos.darwin:	aos.o Threads.darwin.o 
+	$(CC) -o aos.darwin aos.o Threads.darwin.o  $(LDFLAGS) \
+		-arch i386 -framework CoreServices
+	rm -f *.o 
+
+aos.o:	aos.c
+	$(CC) -c $(CFLAGS) aos.c
+
+Threads.darwin.o:	Threads.h Threads.darwin.c
+	$(CC) -c $(CFLAGS) Threads.darwin.c 
+
+

+ 18 - 0
UnixAos/boot/Makefile.linux

@@ -0,0 +1,18 @@
+#
+
+CC      = gcc -m32
+CFLAGS  = -DLINUX 
+LDFLAGS = -lpthread -ldl -lX11 -lrt -lm
+
+
+aos.linux:	aos.o Threads.linux.o
+	$(CC) -s -o aos.linux aos.o Threads.linux.o $(LDFLAGS)
+	rm -f *.o 
+
+aos.o:	aos.c
+	$(CC) -c $(CFLAGS) aos.c
+
+Threads.linux.o:	Threads.h Threads.linux.c
+	$(CC) -c $(CFLAGS) Threads.linux.c 
+
+

+ 18 - 0
UnixAos/boot/Makefile.linux.amd64

@@ -0,0 +1,18 @@
+#
+
+CC      = gcc -m64
+CFLAGS  = -DLINUX 
+LDFLAGS = -lpthread -ldl -lX11 -lrt -lm
+
+
+aos.linux:	aos.o Threads.linux.o
+	$(CC) -s -o aos.linux aos.o Threads.linux.o $(LDFLAGS)
+	rm -f *.o 
+
+aos.o:	aos.c
+	$(CC) -c $(CFLAGS) aos.c
+
+Threads.linux.o:	Threads.h Threads.linux.c
+	$(CC) -c $(CFLAGS) Threads.linux.c 
+
+

+ 19 - 0
UnixAos/boot/Makefile.solaris

@@ -0,0 +1,19 @@
+#
+
+CC=gcc  -m32
+CFLAGS  = -DSOLARIS
+LDFLAGS = -lthread -L/usr/openwin/lib -lX11 -ldl -lrt -lm
+
+
+
+aos.solaris:	aos.o Threads.solaris.o
+	$(CC) -s -o aos.solaris aos.o Threads.solaris.o $(LDFLAGS)
+	rm -f *.o 
+
+aos.o:	aos.c
+	$(CC) -c $(CFLAGS) aos.c
+
+Threads.solaris.o:	Threads.h Threads.solaris.c
+	$(CC) -c $(CFLAGS) Threads.solaris.c 
+
+

+ 19 - 0
UnixAos/boot/Makefile.solaris.amd64

@@ -0,0 +1,19 @@
+#
+
+CC=gcc  -m64
+CFLAGS  = -DSOLARIS
+LDFLAGS = -lthread -L/usr/openwin/lib -lX11 -ldl -lrt -lm
+
+
+
+aos.solaris:	aos.o Threads.solaris.o
+	$(CC) -s -o aos.solaris aos.o Threads.solaris.o $(LDFLAGS)
+	rm -f *.o 
+
+aos.o:	aos.c
+	$(CC) -c $(CFLAGS) aos.c
+
+Threads.solaris.o:	Threads.h Threads.solaris.c
+	$(CC) -c $(CFLAGS) Threads.solaris.c 
+
+

+ 245 - 0
UnixAos/boot/Threads.darwin.c

@@ -0,0 +1,245 @@
+
+/*--------- threads support ------------------------- g.f. -----*/
+/*--------- lower half of the Oberon Threads module             */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+#include <signal.h>
+#include <semaphore.h>
+#include <errno.h>
+#include "Threads.h"
+
+
+extern int suid_root;
+extern int debug;
+
+extern void SetSigaltstack();
+
+static o_thr_t mainthread = 0;
+
+
+
+void 
+o_thrSleep(int ms) {
+
+    struct timespec sltime, rem;
+
+    sltime.tv_sec = ms/1000;
+    sltime.tv_nsec = 1000000*(ms%1000);
+    while (nanosleep( &sltime, &rem ) < 0 && errno == EINTR)
+    	sltime = rem;
+}
+
+
+o_mtx_t 
+o_mtxInit(int dummy) {
+    o_mtx_t mtx;
+
+    mtx = (o_mtx_t)malloc( sizeof(pthread_mutex_t) );
+    pthread_mutex_init( mtx, NULL );
+    return mtx;
+}
+
+
+
+void 
+o_mtxDestroy(o_mtx_t mtx) {
+    
+    (void)pthread_mutex_destroy( mtx );
+    free( mtx );
+}
+
+
+
+void 
+o_mtxLock(o_mtx_t mtx) {
+    
+    (void)pthread_mutex_lock( mtx );
+}
+
+
+
+void 
+o_mtxUnlock(o_mtx_t mtx) {
+    
+    (void)pthread_mutex_unlock( mtx );
+}
+
+
+o_con_t 
+o_conInit(int dymmy) {
+    o_con_t	c;
+
+    c = (o_con_t)malloc( sizeof(pthread_cond_t) );
+    pthread_cond_init( c, NULL );
+    return c;
+}
+
+void 
+o_conDestroy(o_con_t c) {
+    
+    pthread_cond_destroy( c );
+    free( c );
+}
+
+void 
+o_conWait( o_con_t c, o_mtx_t m ) {
+    
+    pthread_cond_wait( c, m );
+}
+
+void 
+o_conSignal( o_con_t c ) {
+    
+    pthread_cond_signal( c );
+}
+
+
+static void *
+starter(void *p) {
+    o_thr_t me = pthread_self();
+    oberon_proc proc = (oberon_proc)p;
+    sigset_t old, new;
+    struct sched_param param;
+
+    SetSigaltstack();
+    sigfillset( &new );
+    sigdelset( &new, SIGILL );
+    sigdelset( &new, SIGTRAP );
+    sigdelset( &new, SIGFPE );
+    sigdelset( &new, SIGBUS );
+    sigdelset( &new, SIGSEGV );
+    sigdelset( &new, SIGTERM );
+    pthread_sigmask( SIG_SETMASK, &new, &old );
+
+    pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
+    pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL );
+    param.sched_priority = 0;
+    pthread_setschedparam( me, SCHED_OTHER, &param );
+
+    proc();
+
+    pthread_exit( NULL );
+    return NULL;
+}
+
+
+
+o_thr_t 
+o_thrStart( oberon_proc p, int len ) {
+    
+    o_thr_t id;
+    pthread_attr_t attr;
+     
+    if (len < PTHREAD_STACK_MIN) len = PTHREAD_STACK_MIN;
+    pthread_attr_init( &attr );
+    pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+    pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
+    pthread_attr_setstacksize( &attr, len );
+    if (pthread_create( &id, &attr, starter, p ) != 0) return 0;
+    return id;
+}
+
+
+
+o_thr_t 
+o_thrThis(int dummy) {
+
+    return pthread_self();
+}
+
+
+
+void 
+o_thrYield(int dummy) {
+
+    o_thrSleep( 1 );
+}
+
+
+
+void 
+o_thrExit(int dummy) {
+    
+    pthread_exit( 0 );
+}
+
+
+void 
+o_thrSuspend(o_thr_t thr) {
+    mach_port_t mthread;
+
+    mthread = pthread_mach_thread_np(thr);
+    thread_suspend(mthread);
+}
+
+
+
+void 
+o_thrResume(o_thr_t thr) {
+    mach_port_t mthread;
+
+    mthread = pthread_mach_thread_np(thr);
+    thread_resume(mthread);
+}
+
+
+void 
+o_thrSetprio(o_thr_t thr, int prio) {
+
+    struct sched_param param;
+    int policy;
+
+
+    pthread_getschedparam( thr, &policy, &param );
+    param.sched_priority = prio;
+    if (pthread_setschedparam( thr, SCHED_OTHER, &param ) != 0)
+    	perror("pthread_setschedparam");
+}
+
+
+
+int 
+o_thrGetprio(o_thr_t thr) {
+
+    struct sched_param param;
+    int policy;
+
+    pthread_getschedparam( thr, &policy, &param );
+    return ( param.sched_priority );
+}
+
+
+
+void 
+o_thrKill(o_thr_t thr) {
+
+    if (thr != mainthread) {
+    	pthread_detach( thr );
+    	if (thr == pthread_self())
+    	    pthread_exit( 0 );
+    	else {
+    	    pthread_cancel( thr );
+        } 
+    }
+}
+
+
+
+int 
+o_thrInitialize( int *low, int* high ) {
+    struct sched_param param;
+    
+    mainthread = pthread_self();
+    *high = sched_get_priority_max(SCHED_OTHER);
+    *low = sched_get_priority_min(SCHED_OTHER);
+    param.sched_priority = *high;
+    pthread_setschedparam( mainthread, SCHED_OTHER, &param );
+
+    return 1;
+}
+
+
+

+ 43 - 0
UnixAos/boot/Threads.h

@@ -0,0 +1,43 @@
+
+
+#ifdef SOLARIS
+# include <thread.h>
+  typedef mutex_t *	o_mtx_t;
+  typedef cond_t *	o_con_t;
+  typedef thread_t	o_thr_t;
+#else
+  /*** Linux | Darwin ***/
+# include <pthread.h>
+  typedef pthread_mutex_t *	o_mtx_t;
+  typedef pthread_cond_t *	o_con_t;
+  typedef pthread_t		o_thr_t;
+#endif
+
+typedef void (*oberon_proc)();  /* Oberon procedure to be started as a new thread */
+
+extern o_mtx_t	o_mtxInit( );
+extern void	o_mtxDestroy( o_mtx_t mtx );
+extern void	o_mtxLock(    o_mtx_t mtx );
+extern void	o_mtxUnlock(  o_mtx_t mtx );
+
+extern o_con_t	o_conInit( );
+extern void	o_conDestroy( o_con_t con );
+extern void	o_conWait(    o_con_t con, o_mtx_t mtx );
+extern void	o_conSignal(  o_con_t con );
+
+
+
+extern o_thr_t	o_thrStart( oberon_proc p, int len );
+extern o_thr_t	o_thrThis( );
+extern void	o_thrSleep( int ms );
+extern void	o_thrYield( );
+extern void	o_thrExit( );
+extern void	o_thrSuspend( o_thr_t thr );
+extern void	o_thrResume(  o_thr_t thr );
+extern void	o_thrSetprio( o_thr_t thr, int prio );
+extern int 	o_thrGetprio( o_thr_t thr );
+extern void	o_thrKill(    o_thr_t thr );
+
+extern int 	o_thrInitialize( int* low, int* high );
+
+

+ 292 - 0
UnixAos/boot/Threads.linux.c

@@ -0,0 +1,292 @@
+
+/*--------- threads support ------------------------- g.f. -----*/
+/*--------- lower half of the Oberon Threads module             */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+#include <signal.h>
+#include <semaphore.h>
+#include <errno.h>
+#include <bits/local_lim.h>
+#include "Threads.h"
+
+
+extern int suid_root;
+extern int debug;
+
+extern void SetSigaltstack();
+
+static o_thr_t mainthread = 0;
+
+static struct sched_param oldparam;
+static int oldpolicy;
+
+#define	T_SIGSUSPEND	SIGUSR1
+#define	T_SIGRESUME	SIGUSR2
+
+static struct sigaction sasuspend, saresume;
+static pthread_mutex_t suspend_mutex;
+static int suspend_done;
+static int resume_done;
+
+
+void 
+o_thrSleep(int ms) {
+
+    struct timespec sltime, rem;
+
+    sltime.tv_sec = ms/1000;
+    sltime.tv_nsec = 1000000*(ms%1000);
+    while (nanosleep( &sltime, &rem ) < 0 && errno == EINTR)
+    	sltime = rem;
+}
+
+
+o_mtx_t 
+o_mtxInit(int dummy) {
+    o_mtx_t mtx;
+
+    mtx = (o_mtx_t)malloc( sizeof(pthread_mutex_t) );
+    pthread_mutex_init( mtx, NULL );
+    return mtx;
+}
+
+
+
+void 
+o_mtxDestroy(o_mtx_t mtx) {
+    
+    (void)pthread_mutex_destroy( mtx );
+    free( mtx );
+}
+
+
+
+void 
+o_mtxLock(o_mtx_t mtx) {
+    
+    (void)pthread_mutex_lock( mtx );
+}
+
+
+
+void 
+o_mtxUnlock(o_mtx_t mtx) {
+    
+    (void)pthread_mutex_unlock( mtx );
+}
+
+
+o_con_t 
+o_conInit(int dymmy) {
+    o_con_t	c;
+
+    c = (o_con_t)malloc( sizeof(pthread_cond_t) );
+    pthread_cond_init( c, NULL );
+    return c;
+}
+
+void 
+o_conDestroy(o_con_t c) {
+    pthread_cond_destroy( c );
+    free( c );
+}
+
+void 
+o_conWait( o_con_t c, o_mtx_t m ) {
+    pthread_cond_wait( c, m );
+}
+
+void 
+o_conSignal( o_con_t c ) {
+    pthread_cond_signal( c );
+}
+
+
+static void *
+starter(void *p) {
+    o_thr_t me = pthread_self();
+    oberon_proc proc = (oberon_proc)p;
+    sigset_t old, new;
+    struct sched_param param;
+
+    SetSigaltstack();
+    sigfillset( &new );
+    sigdelset( &new, SIGILL );
+    sigdelset( &new, SIGTRAP );
+    sigdelset( &new, SIGFPE );
+    sigdelset( &new, SIGBUS );
+    sigdelset( &new, SIGSEGV );
+    sigdelset( &new, SIGTERM );
+    sigdelset( &new, T_SIGSUSPEND );
+    //sigdelset( &new, T_SIGRESUME );
+    pthread_sigmask( SIG_SETMASK, &new, &old );
+
+    pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
+    pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL );
+    param.sched_priority = 0;
+    pthread_setschedparam( me, SCHED_OTHER, &param );
+
+    proc();
+
+    pthread_exit( NULL );
+    return NULL;
+}
+
+
+
+o_thr_t 
+o_thrStart( oberon_proc p, int len ) {
+    
+    o_thr_t id;
+    pthread_attr_t attr;
+     
+    if (len < PTHREAD_STACK_MIN) len = PTHREAD_STACK_MIN;
+    pthread_attr_init( &attr );
+    pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
+    pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
+    pthread_attr_setstacksize( &attr, len );
+    if (pthread_create( &id, &attr, starter, p ) != 0) return 0;
+    return id;
+}
+
+
+
+o_thr_t 
+o_thrThis(int dummy) {
+
+    return pthread_self();
+}
+
+
+
+void 
+o_thrYield(int dummy) {
+
+    o_thrSleep( 1 );
+}
+
+
+
+void 
+o_thrExit(int dummy) {
+    
+    pthread_exit( 0 );
+}
+
+
+
+void 
+o_thrSuspend(o_thr_t thr) {
+
+    pthread_mutex_lock( &suspend_mutex );
+    suspend_done = 0;
+    pthread_kill( thr, T_SIGSUSPEND );
+    while (suspend_done != 1) o_thrSleep( 1 );
+    pthread_mutex_unlock( &suspend_mutex );
+}
+
+
+static void 
+suspend_handler(int sig) {
+    sigset_t block;
+
+    sigfillset( &block );
+    sigdelset( &block, T_SIGRESUME );
+    suspend_done = 1;
+
+    sigsuspend( &block ); /* await T_SIGRESUME */
+
+    resume_done = 1;
+}
+
+
+
+static void 
+resume_handler(int sig) {
+}
+
+void 
+o_thrResume(o_thr_t thr) {
+    int n;
+
+    pthread_mutex_lock( &suspend_mutex );
+    resume_done = 0; n = 1;
+    pthread_kill( thr, T_SIGRESUME ); 
+    while (resume_done != 1 && n < 50) { o_thrSleep( 1 ); n++; }
+    pthread_mutex_unlock( &suspend_mutex );
+}
+
+
+
+void 
+o_thrSetprio(o_thr_t thr, int prio) {
+
+    struct sched_param param;
+    int policy;
+
+
+    pthread_getschedparam( thr, &policy, &param );
+    param.sched_priority = prio;
+    if (pthread_setschedparam( thr, SCHED_OTHER, &param ) != 0)
+    	perror("pthread_setschedparam");
+}
+
+
+
+int 
+o_thrGetprio(o_thr_t thr) {
+
+    struct sched_param param;
+    int policy;
+
+    pthread_getschedparam( thr, &policy, &param );
+    return ( param.sched_priority );
+}
+
+
+
+void 
+o_thrKill(o_thr_t thr) {
+
+    if (thr != mainthread) {
+    	pthread_detach( thr );
+    	if (thr == pthread_self())
+    	    pthread_exit( 0 );
+    	else {
+    	    pthread_cancel( thr );
+        } 
+    }
+}
+
+
+
+int 
+o_thrInitialize( int *low, int* high ) {
+    struct sched_param param;
+    
+    pthread_mutex_init( &suspend_mutex, NULL );
+    mainthread = pthread_self();
+    *high = sched_get_priority_max(SCHED_OTHER);
+    *low = sched_get_priority_min(SCHED_OTHER);
+    param.sched_priority = *high;
+    pthread_setschedparam( mainthread, SCHED_OTHER, &param );
+
+    sigemptyset( &sasuspend.sa_mask );
+    sigaddset( &sasuspend.sa_mask, T_SIGRESUME );
+    sasuspend.sa_flags = 0;
+    sasuspend.sa_handler = suspend_handler;
+    sigaction( T_SIGSUSPEND, &sasuspend, NULL );
+
+    sigemptyset( &saresume.sa_mask );
+    saresume.sa_flags = 0;
+    saresume.sa_handler = resume_handler;
+    sigaction( T_SIGRESUME, &saresume, NULL );
+    
+    return 1;
+}
+
+
+

+ 176 - 0
UnixAos/boot/Threads.solaris.c

@@ -0,0 +1,176 @@
+
+/*--------- threads support ------------------------- g.f. -----*/
+/*--------- lower half of the Oberon Threads module             */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "Threads.h"
+#define __EXTENSIONS__  1
+#include <pthread.h>
+#include <synch.h>
+#include <sched.h>
+
+extern int suid_root;
+static o_thr_t mainthread = 0;
+
+extern void SetSigaltstack();
+
+o_mtx_t o_mtxInit(int dummy) {
+    o_mtx_t mtx;
+
+    mtx = (o_mtx_t)malloc( sizeof(mutex_t) );
+    mutex_init( mtx, USYNC_THREAD, NULL );
+    return mtx;
+}
+
+void o_mtxDestroy(o_mtx_t mtx) {
+    mutex_destroy( mtx );
+    free( mtx );
+}
+
+
+void o_mtxLock(o_mtx_t mtx) {
+    mutex_lock( mtx );
+}
+
+
+void o_mtxUnlock(o_mtx_t mtx) {
+    mutex_unlock( mtx );
+}
+
+o_con_t o_conInit(int dummy) {
+    o_con_t	c;
+
+    c = (o_con_t)malloc( sizeof(cond_t) );
+    cond_init( c, USYNC_THREAD, NULL );
+    return c;
+}
+
+void o_conDestroy(o_con_t c) {
+    cond_destroy( c );
+    free( c );
+}
+
+void o_conWait( o_con_t c, o_mtx_t m ) {
+    cond_wait( c, m );
+}
+
+void o_conSignal( o_con_t c ) {
+   cond_signal( c );
+}
+
+void* starter( void* p ) {
+    sigset_t orig, new;
+    oberon_proc body = (oberon_proc)p;
+
+    SetSigaltstack();
+    sigfillset( &new );
+    sigdelset( &new, SIGILL );
+    sigdelset( &new, SIGTRAP );
+    sigdelset( &new, SIGEMT );
+    sigdelset( &new, SIGFPE );
+    sigdelset( &new, SIGBUS );
+    sigdelset( &new, SIGSEGV );
+    sigdelset( &new, SIGSYS );
+    sigdelset( &new, SIGPIPE );
+    sigdelset( &new, SIGALRM );
+    thr_sigsetmask( SIG_SETMASK, &new, &orig );
+    pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NULL );
+    pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NULL );
+    body();
+    thr_exit( 0 );
+}
+
+
+o_thr_t o_thrStart( oberon_proc p, int len ) {
+    o_thr_t id;
+    int	err;
+
+    if ((len != 0) && (len < 16*1024)) {
+        len =  16*1024;
+    }
+
+    err = thr_create( NULL, len, starter, p, THR_BOUND|THR_DETACHED, &id );
+    if (err != 0)
+        return 0;
+    return id;
+}
+
+
+o_thr_t o_thrThis(int dummy) {
+    return thr_self();
+}
+
+
+void o_thrSleep(int ms) {
+    struct timespec sltime, rem;
+
+    sltime.tv_sec = ms/1000;
+    sltime.tv_nsec = 1000000*(ms%1000);
+    nanosleep( &sltime, &rem );
+}
+
+
+void o_thrYield(int dummy) {
+    thr_yield( );
+}
+
+void o_thrExit(int dummy) {
+    thr_exit( 0 );
+}
+
+
+void o_thrSuspend(o_thr_t thr) {
+    thr_suspend( thr );
+}
+
+void o_thrResume(o_thr_t thr) {
+    thr_continue( thr );
+}
+
+
+void o_thrSetprio(o_thr_t thr, int prio) {
+    thr_setprio( thr, prio );
+}
+
+int o_thrGetprio(o_thr_t thr) {
+    int prio;
+
+    thr_getprio( thr, &prio );
+    return ( prio );
+}
+
+
+void o_thrKill(o_thr_t thr) {
+    if (thr != mainthread) {
+        if (thr == thr_self())
+            thr_exit( 0 );
+        else 
+	    pthread_cancel( thr );
+    }
+}
+
+
+/* thr_initialize returns 0 (FALSE) if the program has
+   been compiled without threads suport. If the program
+   has no suid root privilleges, priorities are disabled
+   and low and high both return 0. */
+
+int o_thrInitialize( int *low, int* high ) {
+    int pl, ph, ret;
+    struct sched_param p;
+    pid_t pid;
+
+    pid = getpid();
+    sched_getparam( pid, &p );
+    ret = sched_setscheduler( pid, SCHED_OTHER, &p );
+    /*
+    pl = sched_get_priority_min( SCHED_OTHER );
+    ph = sched_get_priority_max( SCHED_OTHER );
+    */
+    mainthread = thr_self();
+    *low = 0;  *high = 100;
+    return 1;
+}
+

+ 466 - 0
UnixAos/boot/aos.c

@@ -0,0 +1,466 @@
+/*------------------------------------------------------
+ * Oberon Boot File Loader RC, JS 27.4.93/2.12.93, HP-UX 9.0 Version
+ *
+ * Oberon Boot File Loader for Linux
+ * derived from HP and Windows Boot Loader
+ * MAD, 23.05.94
+ * PR,  01.02.95  support for sockets added
+ * PR,  05.02.95  support for V24 added
+ * PR,  23.12.95  migration to shared ELF libraries
+ * g.f. 01.11.99  added InstallTrap
+ *		  added Threads support
+ *		  removed cmd line parameter evaluation
+ * g.f. 22.11.04  call to mprotect added
+ * g.f. 03.04.07  Darwin/Intel version
+ *
+ *-----------------------------------------------------------*/
+
+#ifdef DARWIN
+#  undef 	__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
+#  define	__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__	1059
+#endif
+
+#ifdef LINUX
+#  define _use_valloc /* use the obsolete valloc function instead of posix_memalign */
+#endif
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <setjmp.h>	
+#ifdef DARWIN
+#  include <sys/ucontext.h>
+#  include <sys/_types.h>
+#  include <sys/signal.h>
+#endif
+#include <signal.h>
+#include <limits.h>
+#include "Threads.h"
+#include <sys/mman.h>
+#include <X11/Xlib.h>
+
+typedef void (*OberonProc)();
+
+typedef void*	address;
+
+FILE *fd;
+char *AOSPATH;
+char path[4096];
+char *dirs[255];
+char fullname[512];
+int nofdir;
+char defaultpath[] = ".:/usr/aos/obj:/usr/aos/system:/usr/aos/fonts";
+#ifdef SOLARIS
+  char bootname[64] = "SolarisAosCore";
+#endif
+#ifdef LINUX
+  char bootname[64] = "LinuxAosCore";
+#endif
+#ifdef DARWIN
+  char bootname[64] = "DarwinAosCore";
+#endif
+
+size_t heapSize;
+size_t codeSize;
+address heapAdr;
+int Argc;
+char **Argv;
+int debug;
+
+static stack_t sigstk;
+
+#define BLSIZE	4096
+#define SIGSTACKSIZE 32*BLSIZE
+
+typedef	void(*trap_t)(long, void*, void*, int);
+
+static trap_t	AosTrap;
+
+
+static void sighandler( int sig, siginfo_t *scp, void *ucp ) {
+	
+	if (debug | (AosTrap == NULL)) {
+	    printf("\nhandler for signal %d got called, ucp = %p\n", sig, ucp);
+	    if (AosTrap == NULL) exit(1);
+	}
+	AosTrap(0, ucp, scp, sig); /* rev. order: Oberon <--> C */
+}
+
+
+static void installHandler(int sig) {
+	struct sigaction act;
+	sigset_t mask;
+	sigemptyset(&mask);
+	act.sa_mask = mask;
+	act.sa_flags =  SA_SIGINFO|SA_ONSTACK|SA_NODEFER;
+	act.sa_sigaction = sighandler;
+	if (sigaction( sig, &act, NULL ) != 0) {
+		perror("sigaction");
+	}
+}
+
+
+void InitSignalHandler() {
+	int i;
+	
+	for (i = 1; i <= 15; i++) {
+	     if (i != 9) installHandler( i );
+	}
+}
+
+
+static void InstallTrap(trap_t p) {
+	
+	if (debug)
+		printf("Installing Aos Trap\n");
+	AosTrap = p;
+}
+
+
+void SetSigaltstack() {
+
+	if (sigaltstack(&sigstk, NULL) < 0)
+		perror("sigaltstack");
+}
+
+
+static void CreateSignalstack() {
+	sigstk.ss_sp = mmap( NULL, SIGSTACKSIZE, 
+			     PROT_READ | PROT_WRITE, 
+			     MAP_PRIVATE | MAP_ANON, 
+			     -1, 0);
+        if (sigstk.ss_sp == MAP_FAILED){
+		printf("mmap for signalstack failed\n" );
+		exit( 1 );
+	}
+	sigstk.ss_size = SIGSTACKSIZE;
+	sigstk.ss_flags = 0;
+	if (debug)
+		printf( "Signalstack created [%p ... %p]\n", 
+	 	        sigstk.ss_sp, sigstk.ss_sp + SIGSTACKSIZE );
+	SetSigaltstack();
+}
+
+
+
+void* o_dlopen(char *lib, int mode) {
+    void* handle;
+
+    if (debug&1) printf("o_dlopen: %s\n", lib);
+    if ((handle = dlopen(lib, mode)) == NULL) {
+        if (debug&1)
+	    printf("o_dlopen: %s not loaded, error = %s\n", lib, dlerror());
+    }
+    if (debug&1) printf("o_dlopen: handle = %p\n", handle);
+
+    return handle;
+}
+
+void o_dlclose(void* handle)	/* not necessary */
+{
+  dlclose(handle);
+}
+
+static int o_errno() {
+
+	return errno;
+}
+
+
+int o_stat(char* name, void* buf) {
+	return stat(name, (struct stat *) buf);
+}
+
+int o_lstat(char* name, void* buf) {
+	return lstat(name, (struct stat *) buf);
+}
+
+int o_fstat(int fd, void* buf) {
+	return fstat(fd, (struct stat *) buf);
+}
+
+int o_open(char* name, int flags, int mode) {
+	return open(name, flags, mode);
+}
+
+void *o_malloc( long size ) {
+	return malloc( size );
+}
+
+int o_posix_memalign(void** buf, long alignment, long size ) {
+#ifdef _use_valloc
+	*buf = valloc( size );
+	if (*buf != NULL) return 0; else return -1;
+#else
+	return posix_memalign( buf, alignment, size );
+#endif
+}
+
+int o_mprotect( void* addr, long len, int prot ) {
+	return mprotect( addr, len, prot );
+}
+
+int o_lseek( int fd, long pos, int whence ) {
+	return lseek( fd, pos, whence );
+}
+
+int o_cout( char c ) {
+	printf( "%c", c );
+}
+
+
+static void (*oberonXErrorHandler) (long p4, long p3, long err, long displ );
+static void (*oberonXIOErrorHandler) (long p4, long p3, long p2, long displ );
+
+static int X11ErrorHandler( Display *d, XErrorEvent *err ) {
+	printf( "X11ErrorHandler called\n" );
+	oberonXErrorHandler( 0, 0, (long)err, (long)d );
+}
+
+
+static int X11IOErrorHandler( Display *d ) {
+	printf( "X11IOErrorHandler called\n" );
+	oberonXIOErrorHandler( 0, 0, 0, (long)d );
+}
+
+
+void SetupXErrHandlers( void* XE, void* XIOE ) {
+	
+	if (debug)
+		printf( "Setup X11 ErrorHandlers\n" );
+	oberonXErrorHandler = XE;
+	oberonXIOErrorHandler = XIOE;
+	
+	XSetErrorHandler(X11ErrorHandler);
+	XSetIOErrorHandler(X11IOErrorHandler);	
+}
+
+
+void o_dlsym(void* handle, char* symbol, void** adr)
+{
+  if (debug==(-1)) printf("o_dlsym: %p %s\n", handle, symbol);
+  
+  if      (strcmp("dlopen",		symbol) == 0) *adr = o_dlopen;
+  else if (strcmp("dlclose",		symbol) == 0) *adr = o_dlclose;
+  else if (strcmp("debug",		symbol) == 0) *(int*)adr = debug;
+  else if (strcmp("heapAdr",		symbol) == 0) *adr = heapAdr;
+  else if (strcmp("heapSize",		symbol) == 0) *(size_t*)adr = heapSize;
+  else if (strcmp("argc",		symbol) == 0) *adr = &Argc;
+  else if (strcmp("argv",		symbol) == 0) *adr = Argv;
+  else if (strcmp("errno",		symbol) == 0) *adr = o_errno;
+  else if (strcmp("cout",		symbol) == 0) *adr = o_cout;
+  
+  else if (strcmp("open",		symbol) == 0) *adr = o_open;
+  else if (strcmp("stat",		symbol) == 0) *adr = o_stat;
+  else if (strcmp("lstat",		symbol) == 0) *adr = o_lstat;
+  else if (strcmp("fstat",		symbol) == 0) *adr = o_fstat;
+  else if (strcmp("lseek",		symbol) == 0) *adr = o_lseek;
+
+  else if (strcmp("malloc",		symbol) == 0) *adr = o_malloc;
+  else if (strcmp("posix_memalign",	symbol) == 0) *adr = o_posix_memalign;
+  else if (strcmp("mprotect",		symbol) == 0) *adr = o_mprotect;
+
+  else if (strcmp("InstallTrap",	symbol) == 0) *adr = InstallTrap;
+  else if (strcmp("InitXErrH", 		symbol) == 0) *adr = SetupXErrHandlers;
+#ifdef LINUX
+  else if (strcmp("sigsetjmp",		symbol) == 0) *adr = __sigsetjmp;
+  else if (strcmp("setjmp",		symbol) == 0) *adr = __sigsetjmp;
+#endif
+  else if (strcmp("mtxInit",   		symbol) == 0) *adr = o_mtxInit;
+  else if (strcmp("mtxDestroy", 	symbol) == 0) *adr = o_mtxDestroy;
+  else if (strcmp("mtxLock",    	symbol) == 0) *adr = o_mtxLock;
+  else if (strcmp("mtxUnlock",  	symbol) == 0) *adr = o_mtxUnlock;
+  else if (strcmp("conInit",  		symbol) == 0) *adr = o_conInit;
+  else if (strcmp("conDestroy", 	symbol) == 0) *adr = o_conDestroy;
+  else if (strcmp("conWait",  		symbol) == 0) *adr = o_conWait;
+  else if (strcmp("conSignal",  	symbol) == 0) *adr = o_conSignal;
+  else if (strcmp("thrStart",		symbol) == 0) *adr = o_thrStart;
+  else if (strcmp("thrThis",		symbol) == 0) *adr = o_thrThis;
+  else if (strcmp("thrSleep",		symbol) == 0) *adr = o_thrSleep;
+  else if (strcmp("thrYield",		symbol) == 0) *adr = o_thrYield;
+  else if (strcmp("thrExit",		symbol) == 0) *adr = o_thrExit;
+  else if (strcmp("thrSuspend",		symbol) == 0) *adr = o_thrSuspend;
+  else if (strcmp("thrResume",		symbol) == 0) *adr = o_thrResume;
+  else if (strcmp("thrGetPriority",	symbol) == 0) *adr = o_thrGetprio;
+  else if (strcmp("thrSetPriority",	symbol) == 0) *adr = o_thrSetprio;
+  else if (strcmp("thrKill",		symbol) == 0) *adr = o_thrKill;
+  else if (strcmp("thrInitialize",	symbol) == 0) *adr = o_thrInitialize;
+  else {
+    *adr = dlsym(handle, symbol);
+    if (*adr == 0) {
+      printf("o_dlsym: symbol %s not found\n", symbol); 
+    }
+  }
+}
+
+
+/*----- Files Reading primitives -----*/
+
+
+int Rint() {
+  unsigned char b[4]; int i;
+
+  /* read little endian integer */
+  for (i=0; i<4; i++) b[i] = fgetc(fd);
+  return *((int*)b);
+}
+
+address RAddress() {
+  unsigned char b[8]; int i;
+
+  /* read little endian address */
+  for (i=0; i<8; i++) b[i] = fgetc(fd);
+  return *((address*)b);
+}
+
+int RNum() {
+  int n, shift;
+  unsigned char x;
+
+  shift = 0; n = 0; x = fgetc(fd);
+  while (x >= 128) {
+    n += (x & 0x7f) << shift;
+    shift += 7;
+    x = fgetc(fd);
+  }
+  return n + (((x & 0x3f) - ((x >> 6) << 6)) << shift);
+}
+
+void Assert( address x ) {
+  address y;
+
+  if((x < heapAdr) | (x >= heapAdr + heapSize)) {
+    printf("bad reloc. pos %p [%p, %p]\n", x, heapAdr, heapAdr+heapSize);
+  }
+  if (x > heapAdr+codeSize) {
+    y = *(address*)x;
+    if((y < heapAdr) | (y >= heapAdr+heapSize)) {
+      printf("bad reloc. value %p [%p, %p]\n", y, heapAdr, heapAdr+heapSize);
+    }
+  }
+}
+
+	
+void Relocate(size_t shift) {
+  int len; address *adr; 
+  
+  len = RNum(); 
+  while (len != 0) { 
+    adr = heapAdr + RNum();
+    *adr += shift; 
+    Assert( adr );
+    len--; 
+  } 
+}
+
+
+void Boot() {
+  address adr, fileHeapAdr, dlsymAdr;
+  size_t shift, len, fileHeapSize;
+  int arch, d, notfound;  
+  OberonProc body;
+
+  d = 0; notfound = 1;
+  while ((d < nofdir) && notfound) {
+    strcat(strcat(strcpy(fullname, dirs[d++]), "/"), bootname);
+    fd = fopen(fullname, "r");
+    if (fd != NULL) notfound = 0;
+  }
+  if (notfound) {
+    printf("Aos BootLoader: boot file %s not found\n", bootname);  
+    exit(-1);
+  }
+  arch = Rint();
+  if (arch != 8*sizeof(address)) {
+    printf("bootfile %s has wrong architecture, got %d, expected %d\n", bootname, arch, (int)(8*sizeof(address)) );
+    exit(-1);
+  }
+  fileHeapAdr = RAddress(); 
+  fileHeapSize = Rint();
+  if (fileHeapSize > heapSize) {
+    printf("Aos BootLoader: heap too small\n");  
+    exit(-1);
+  }
+  adr = heapAdr; len = heapSize; 
+  while (len > 0) { 
+    *((int*)adr) = 0; 
+    len -= 4; adr += 4; 
+  } 
+  shift = heapAdr - fileHeapAdr;
+  
+  adr = heapAdr + Rint();
+  len = Rint();  /* used heap */
+  while (len > 0) {
+    *(int*)adr = Rint(); adr += 4; len -= 4;
+  }
+  body = (OberonProc)heapAdr + Rint();
+  dlsymAdr = heapAdr + Rint();
+
+  Relocate(shift);
+  *(address*)dlsymAdr = o_dlsym;
+  
+  fclose(fd);
+  if(mprotect((void*)heapAdr, heapSize, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
+     perror("mprotect");
+  (*body)();
+}
+
+void InitPath() {
+  int pos;
+  char ch;
+  
+  if ((AOSPATH = getenv("AOSPATH")) == NULL) AOSPATH = defaultpath;
+  strcpy(path, AOSPATH);
+  pos = 0; nofdir = 0;
+  ch = path[pos++];
+  while (ch != '\0') {
+    while ((ch == ' ') || (ch == ':')) ch = path[pos++];
+    dirs[nofdir] = &path[pos-1];
+    while ((ch > ' ') && (ch != ':')) ch = path[pos++];
+    path[pos-1] = '\0';
+    nofdir ++;
+  }
+}
+
+
+int main(int argc, char *argv[])
+{
+  char* p;
+  void *a, *h;
+  
+  Argc = argc; Argv = argv;
+
+  debug = 0;
+  p = getenv("AOSDEBUG");
+  if (p != NULL) debug = atoi(p);
+
+  if (debug) {
+     printf( "UnixAos Boot Loader 27.10.2013\n" );
+     printf( "debug = %d\n", debug );
+  }
+
+  heapSize = 0x200000;
+#ifdef _use_valloc
+  heapAdr = valloc( heapSize );
+  if (heapAdr == 0) {
+#else
+  if (posix_memalign(&heapAdr, 4096, heapSize) != 0) {
+#endif
+    printf("Aos BootLoader: cannot allocate initial heap space\n");  
+    exit(-1);
+  }
+
+  InitPath();
+  CreateSignalstack();
+  InitSignalHandler();
+  
+  Boot();
+  return 0;
+}
+

二进制
UnixAos/boot/aos.darwin


二进制
UnixAos/boot/aos.linux


二进制
UnixAos/boot/aos.solaris


二进制
UnixAos/buildtools/Darwin.AMD64.Tool


二进制
UnixAos/buildtools/Darwin.I386.Tool


二进制
UnixAos/buildtools/Linux.AMD64.Tool


二进制
UnixAos/buildtools/Linux.I386.Tool


二进制
UnixAos/buildtools/Solaris.AMD64.Tool


二进制
UnixAos/buildtools/Solaris.I386.Tool


二进制
UnixAos/buildtools/UnixAosBuild.Tool


二进制
WinAos/Aos.EXE


二进制
WinAos/AosDebug.exe


二进制
WinAos/PELinker/Arrow.cur


二进制
WinAos/PELinker/ColorFill.cur


二进制
WinAos/PELinker/Columbus.ico


二进制
WinAos/PELinker/Columbus.small.ico


二进制
WinAos/PELinker/CopyHand.cur


二进制
WinAos/PELinker/Cross.cur


二进制
WinAos/PELinker/FlatHand.cur


二进制
WinAos/PELinker/MoveHand.cur


二进制
WinAos/PELinker/Oberon.ico


二进制
WinAos/PELinker/Oberon.small.ico


二进制
WinAos/PELinker/Panel.ico


二进制
WinAos/PELinker/Panel.small.ico


二进制
WinAos/PELinker/Picture.ico


二进制
WinAos/PELinker/Picture.small.ico


二进制
WinAos/PELinker/Point.cur


二进制
WinAos/PELinker/PointHand.cur


二进制
WinAos/PELinker/Text.ico


二进制
WinAos/PELinker/Text.small.ico


二进制
WinAos/PELinker/WinAos.ico


二进制
WinAos/PELinker/stub.exe


二进制
WinAos/WinOberon/ColumbusObjs.Lib


二进制
WinAos/WinOberon/CompilerObjs.Lib


二进制
WinAos/WinOberon/CompressObjs.Lib


二进制
WinAos/WinOberon/DLLConfiguration.Text


二进制
WinAos/WinOberon/Distribution.Text


二进制
WinAos/WinOberon/GadgetsIntroObjs.Lib


二进制
WinAos/WinOberon/GadgetsOberonObjs.Lib


二进制
WinAos/WinOberon/GadgetsProgObjs.Lib


二进制
WinAos/WinOberon/GadgetsUseObjs.Lib


二进制
WinAos/WinOberon/GettingStarted.Text


二进制
WinAos/WinOberon/HTMLIcons.Lib


二进制
WinAos/WinOberon/InternetObjs.Lib


二进制
WinAos/WinOberon/MainObjs.Lib


二进制
WinAos/WinOberon/Mouse.Text


二进制
WinAos/WinOberon/MouseObjs.Lib


二进制
WinAos/WinOberon/OP2.Errors


二进制
WinAos/WinOberon/Oberon3TUIObjs.Lib


二进制
WinAos/WinOberon/OberonExternal.Text


二进制
WinAos/WinOberon/PlugInsGuide.Text


二进制
WinAos/WinOberon/Setup.Tool


二进制
WinAos/WinOberon/System.Log


二进制
WinAos/WinOberon/TextPopups.Text


二进制
WinAos/WinOberon/WatsonObjs.Lib


二进制
WinAos/WinOberon/WinMenus.Lib


+ 52 - 0
WinAos/aos.ini

@@ -0,0 +1,52 @@
+; internal
+
+[Configuration]
+Paths.Search = ~/obj;~/../source;~/PELinker;~/../UnixAos;~/vy.ants/source;~/vy.ants/documents
+Paths.Work = ~/Work
+Oberon = Oberon.Text
+Boot  = Traps.Install
+Boot1 = FileTrapWriter.Install
+Boot2 = Display.Install  --fullscreen
+Boot3 = WindowManager.Install
+Boot4 = Clipboard.Install
+Boot5 = Autostart.Run
+Boot7 = FSTools.Mount WORK RelativeFileSystem ./
+Boot9 = Kernel.GC
+Trace=File
+TraceModules=0
+TraceCommands=1
+EnableReturnBlocks=0
+EnableFreeLists=0
+
+
+
+; Notes:
+
+; Only the values within the very first configuration section are considered.
+
+; For overriding one ore more values, create a file called myaos.ini in the
+; same directory and provide a configuration section with your overrides.
+
+; a preceding ~/ denotes a directory relative to the directory hosting the executable (aos.exe)
+
+; the file name of the ini file can be overridden by a command line option -ini <filename>
+
+[Description]
+BootX= <boot command, X empty or between 1 and 9>
+Paths.Search = <search path that is taken by A2 to look for files  >
+Paths.Work = <path that is taken by A2 to store to by default >
+Obeorn = <configuration file taken by the inbuilt Oberon system >
+TraceModules= < 0 or 1: if Trace of module loading is switched on or off>
+Trace= < File or Console >
+TraceFile = <filename for trace file (if Trace = File)
+
+
+configurations with external oberon require a release that was compiled with external oberon files
+[Configuration for starting with A2 but using external Oberon]
+Oberon = OberonExternal.Text
+MB=2
+
+[Configuration for starting with external Oberon]
+Oberon = OberonExternal.Text
+Boot1 = Oberon.Call Oberon.Start
+

+ 88 - 0
WinAos/license.txt

@@ -0,0 +1,88 @@
+This is a compilation of the 
+- ETH WinAos System (Windows Emulation of the Active Object System, aka A2)
+and 
+- the software packages Voyager and AntsInFields. 
+
+
+Nearly all parts of this compilation belong to the ETH WinAos System, exceptions are the files of "AntsInFields" and "Voyager"
+
+----
+
+Oberon is the name of a modern integrated software environment. It is a single-user, 
+multi-tasking system that runs on bare hardware or on top of a host operating system. 
+Oberon is also the name of a programming language in the Pascal/Modula tradition. 
+The Oberon project was launched in 1985 by Niklaus Wirth and Jürg Gutknecht. 
+See also http://www.oberon.ethz.ch
+
+Voyager is a project to explore the feasibility of a portable and extensible system 
+for simulation and data analysis systems. It is mainly written in and for Oberon. 
+The Voyager project is carried out by StatLab Heidelberg and was launched 
+in 1993 by Günther Sawitzki. 
+See also http://www.statlab.uni-heidelberg.de/projects/voyager/
+
+AntsInFields is a Software Package for Simulation and Statistical Inference on Gibbs Fields.
+AntsInFields is written in Oberon and uses Voyager. It has been developed since 1997
+by Felix Friedrich. 
+
+----
+
+Voyager is - in this distribution - located in the directory "Work/vy"
+Source code of Voyager is marked by preceding "vy" for all Module-Names
+
+AntsInFields is - in this distribution - located in the directory "Work/ants"
+Source code of AntsInFields is marked by preceding letters "ants" for all Module Names.
+
+----
+
+The WinAos System is protected by the following copyright, start and end marked by ">>" and "<<" respectively:
+
+>>
+ ETH Bluebottle
+Copyright (c) 2002-2008, Computer Systems Institute, ETH Zurich
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+    * Neither the name of the ETH Zurich nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+<<
+
+
+----
+
+
+The following copyright note (start and end marked by ">>" and "<<" respectively) 
+concerns either of the software packages   
+
+Voyager 
+(C) 1993-2002 Project Voyager, StatLab Heidelberg ; (C) 1993-2002 G. Sawitzki et al.
+
+
+and 
+
+AntsInFields 
+(C) 1997-2002 Felix Friedrich, Munich:
+
+>>
+  
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+<<
+
+the copy of the LGPL can be found in this directory as file "LGPL.TXT"
+

二进制
WinAos/obj/A2Sequencers.Obw


二进制
WinAos/obj/ADVAPI32.Obw


二进制
WinAos/obj/AFM.Obw


二进制
WinAos/obj/AMD64Decoder.Obw


二进制
WinAos/obj/ARMDecoder.Obw


二进制
WinAos/obj/ASMAMD64.Obw


二进制
WinAos/obj/ASN1.Obw


二进制
WinAos/obj/AVI.Obw


二进制
WinAos/obj/ActiveTimers.Obw


二进制
WinAos/obj/AlmSmtpReceiver.Obw


二进制
WinAos/obj/AnimationCodec.Obw


二进制
WinAos/obj/Archives.Obw


二进制
WinAos/obj/Array1dBytes.Obw


二进制
WinAos/obj/Array1dCplx.Obw


二进制
WinAos/obj/Array1dInt.Obw


二进制
WinAos/obj/Array1dRat.Obw


二进制
WinAos/obj/Array1dRe.Obw


二进制
WinAos/obj/Array2dCplx.Obw


二进制
WinAos/obj/Array2dInt.Obw


二进制
WinAos/obj/Array2dRat.Obw


二进制
WinAos/obj/Array2dRe.Obw


二进制
WinAos/obj/ArrayBase.Obw


二进制
WinAos/obj/ArrayBaseOptimized.Obw


二进制
WinAos/obj/ArrayXdBytes.Obw


二进制
WinAos/obj/ArrayXdCplx.Obw


二进制
WinAos/obj/ArrayXdInt.Obw


部分文件因为文件数量过多而无法显示