]> git.mdlowis.com Git - proto/cerise-os.git/commitdiff
initial commit of module sketches based on active oberon design
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 1 Sep 2022 20:19:11 +0000 (16:19 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 1 Sep 2022 20:19:11 +0000 (16:19 -0400)
src/Active.h [new file with mode: 0644]
src/Boot.h [new file with mode: 0644]
src/Heap.h [new file with mode: 0644]
src/Interrupts.h [new file with mode: 0644]
src/Kernel.h [new file with mode: 0644]
src/Locks.h [new file with mode: 0644]
src/Memory.h [new file with mode: 0644]
src/Modules.h [new file with mode: 0644]
src/Out.h [new file with mode: 0644]
src/Processors.h [new file with mode: 0644]
src/main.c [new file with mode: 0644]

diff --git a/src/Active.h b/src/Active.h
new file mode 100644 (file)
index 0000000..aa56f30
--- /dev/null
@@ -0,0 +1 @@
+/* Active objects (Threads/Processes/Actors)*/
diff --git a/src/Boot.h b/src/Boot.h
new file mode 100644 (file)
index 0000000..6fdfbcb
--- /dev/null
@@ -0,0 +1,13 @@
+/* Boot loader and environment interface */
+
+/* get the ID of the cpu on which the caller is executing */
+Int Boot_GetCpuId(void);
+
+/* atomic operations */
+// test and set
+// increment
+// and
+// or
+
+/* initialize the module */
+void Boot(void);
\ No newline at end of file
diff --git a/src/Heap.h b/src/Heap.h
new file mode 100644 (file)
index 0000000..3ef6b1f
--- /dev/null
@@ -0,0 +1,22 @@
+/* Heap and Garbage Collector */
+
+//PROCEDURE RegisterCandidates(adr, size: LONGINT);
+//PROCEDURE CheckCandidates;
+
+//PROCEDURE CollectGarbage(root: PTR);
+//VAR obj: RootObject;
+//BEGIN
+//rootList := NIL; Mark(root);
+//REPEAT
+//REPEAT
+//WHILE rootList # NIL DO
+//obj := Get(rootList);
+//obj.FindRoots (* calls Mark and RegisterCandidates *)
+//END;
+//IF numCandidates # 0 THEN CheckCandidates END
+//UNTIL (numCandidates = 0) & (rootList = NIL);
+//CheckFinalizedObjects
+//UNTIL rootList = NIL;
+//Sweep
+//END CollectGarbage;
+
diff --git a/src/Interrupts.h b/src/Interrupts.h
new file mode 100644 (file)
index 0000000..267b6da
--- /dev/null
@@ -0,0 +1,14 @@
+/* Low-level interrupts */
+
+TYPE
+State = RECORD ... END; (* processor state *)
+Handler = PROCEDURE (VAR state: State);
+PROCEDURE InstallHandler(h: Handler; int: INTEGER);
+
+PROCEDURE EnableInterrupt(int: INTEGER);
+PROCEDURE DisableInterrupt(int: INTEGER);
+PROCEDURE InitInterrupts; (* initialize interrupt handling *)
+
+TYPE
+ExceptionState = RECORD ... END; (* additional state *)
+PROCEDURE GetExceptionState(VAR int: State; VAR exc: ExceptionState);
\ No newline at end of file
diff --git a/src/Kernel.h b/src/Kernel.h
new file mode 100644 (file)
index 0000000..592070d
--- /dev/null
@@ -0,0 +1 @@
+/* Portable kernel interface */
diff --git a/src/Locks.h b/src/Locks.h
new file mode 100644 (file)
index 0000000..71df66c
--- /dev/null
@@ -0,0 +1 @@
+/* Fine-grained locks */
diff --git a/src/Memory.h b/src/Memory.h
new file mode 100644 (file)
index 0000000..bbdc9e0
--- /dev/null
@@ -0,0 +1,22 @@
+/* Virtual address space */
+
+void Memory_GetHeapAddr(LongInt* beg, LongInt* end, LongInt* first, LongInt* free);
+void Memory_SetHeapAddr(LongInt* end);
+
+
+typedef struct {
+    longint low;
+    longint high;
+} Memory_Stack;
+
+void Memory_NewStack(Memory_Stack* stack, LongInt* sp);
+void Memory_DisposeStack(Memory_Stack* stack);
+void Memory_ExtendStack(Memory_Stack* stack, LongInt addr);
+
+
+//PROCEDURE MapPhysical(phys, size: LONGINT; VAR virt: LONGINT);
+//PROCEDURE UnmapPhysical(virt, size: LONGINT);
+//PROCEDURE PhysicalAdr(virt, size: LONGINT): LONGINT;
+
+//PROCEDURE InitBootPage(start: PROCEDURE; VAR phys: LONGINT);
+//PROCEDURE InitMemory; (* initialize paging *)
diff --git a/src/Modules.h b/src/Modules.h
new file mode 100644 (file)
index 0000000..d7a268c
--- /dev/null
@@ -0,0 +1 @@
+/* Modules and types */
diff --git a/src/Out.h b/src/Out.h
new file mode 100644 (file)
index 0000000..960f36d
--- /dev/null
+++ b/src/Out.h
@@ -0,0 +1 @@
+/* Serial console output (debugging) */
\ No newline at end of file
diff --git a/src/Processors.h b/src/Processors.h
new file mode 100644 (file)
index 0000000..e37611f
--- /dev/null
@@ -0,0 +1 @@
+/* Multiple processors */
\ No newline at end of file
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..0e9a63d
--- /dev/null
@@ -0,0 +1,12 @@
+#include "Boot.h"
+#include "Memory.h"
+#include "Processors.h"
+
+int main(int argc, char** argv)
+{
+    Boot();
+    Memory();
+    // ...
+    Processors();
+    return 0;
+}
\ No newline at end of file