From 3d1c1865bedce777b8b7c36b77352cf5636d1d7f Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Thu, 1 Sep 2022 16:19:11 -0400 Subject: [PATCH] initial commit of module sketches based on active oberon design --- src/Active.h | 1 + src/Boot.h | 13 +++++++++++++ src/Heap.h | 22 ++++++++++++++++++++++ src/Interrupts.h | 14 ++++++++++++++ src/Kernel.h | 1 + src/Locks.h | 1 + src/Memory.h | 22 ++++++++++++++++++++++ src/Modules.h | 1 + src/Out.h | 1 + src/Processors.h | 1 + src/main.c | 12 ++++++++++++ 11 files changed, 89 insertions(+) create mode 100644 src/Active.h create mode 100644 src/Boot.h create mode 100644 src/Heap.h create mode 100644 src/Interrupts.h create mode 100644 src/Kernel.h create mode 100644 src/Locks.h create mode 100644 src/Memory.h create mode 100644 src/Modules.h create mode 100644 src/Out.h create mode 100644 src/Processors.h create mode 100644 src/main.c diff --git a/src/Active.h b/src/Active.h new file mode 100644 index 0000000..aa56f30 --- /dev/null +++ b/src/Active.h @@ -0,0 +1 @@ +/* Active objects (Threads/Processes/Actors)*/ diff --git a/src/Boot.h b/src/Boot.h new file mode 100644 index 0000000..6fdfbcb --- /dev/null +++ b/src/Boot.h @@ -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 index 0000000..3ef6b1f --- /dev/null +++ b/src/Heap.h @@ -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 index 0000000..267b6da --- /dev/null +++ b/src/Interrupts.h @@ -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 index 0000000..592070d --- /dev/null +++ b/src/Kernel.h @@ -0,0 +1 @@ +/* Portable kernel interface */ diff --git a/src/Locks.h b/src/Locks.h new file mode 100644 index 0000000..71df66c --- /dev/null +++ b/src/Locks.h @@ -0,0 +1 @@ +/* Fine-grained locks */ diff --git a/src/Memory.h b/src/Memory.h new file mode 100644 index 0000000..bbdc9e0 --- /dev/null +++ b/src/Memory.h @@ -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 index 0000000..d7a268c --- /dev/null +++ b/src/Modules.h @@ -0,0 +1 @@ +/* Modules and types */ diff --git a/src/Out.h b/src/Out.h new file mode 100644 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 index 0000000..e37611f --- /dev/null +++ b/src/Processors.h @@ -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 index 0000000..0e9a63d --- /dev/null +++ b/src/main.c @@ -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 -- 2.54.0