summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-28 22:49:49 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-28 22:53:45 +0100
commitd562c97291a69d1ce73e89ba300209a49d419173 (patch)
tree7ee625bb1ef115f3fae9cf60e0586880dc8ba3c7
parentb2c7b8604ed3a4c209a15a9ffd718a43163dd9b4 (diff)
Extend Swap HD from 4MIB to 16MIB, Made SystemLib purely C, added SystemCxxLib for that occasion.
Update Framebuffer include to define the color utils inside the C++ source file. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
-rw-r--r--Private/KernelKit/Framebuffer.hpp10
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx4
-rw-r--r--Private/Source/Framebuffer.cxx8
-rw-r--r--Public/Developer/System.Core/Headers/Defines.h5
-rw-r--r--Public/Developer/System.Core/Headers/Window.h10
-rw-r--r--Public/Developer/System.Core/Makefile18
-rw-r--r--Public/Developer/System.Core/Sources/Start.c7
-rw-r--r--Public/Developer/System.Core/Sources/Window.c10
-rw-r--r--Public/Developer/System.Cxx/.gitkeep0
-rw-r--r--Public/Developer/System.Cxx/Sources/New+Delete.cxx (renamed from Public/Developer/System.Core/Sources/New+Delete.cxx)15
10 files changed, 48 insertions, 39 deletions
diff --git a/Private/KernelKit/Framebuffer.hpp b/Private/KernelKit/Framebuffer.hpp
index d399f382..91b4e8fd 100644
--- a/Private/KernelKit/Framebuffer.hpp
+++ b/Private/KernelKit/Framebuffer.hpp
@@ -70,11 +70,11 @@ class Framebuffer final {
/// Color utils.
/***********************************************************************************/
-const UInt32 kRgbRed = 0x000000FF;
-const UInt32 kRgbGreen = 0x0000FF00;
-const UInt32 kRgbBlue = 0x00FF0000;
-const UInt32 kRgbBlack = 0x00000000;
-const UInt32 kRgbWhite = 0xFFFFFFFF;
+extern const UInt32 kRgbRed;
+extern const UInt32 kRgbGreen;
+extern const UInt32 kRgbBlue;
+extern const UInt32 kRgbBlack;
+extern const UInt32 kRgbWhite;
} // namespace NewOS
/***********************************************************************************/
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx
index da8e6107..0d1d4086 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx
@@ -73,7 +73,7 @@ EXTERN_C Boolean boot_write_newfs_partition(const Char* namePart, SizeT namePart
}
partBlock->SectorSz = kATASectorSize;
- partBlock->SectorStart = kEPMStartPartition + MIB(4);
+ partBlock->SectorStart = kEPMStartPartition + MIB(16);
partBlock->Version = kNewFSVersionInteger;
partBlock->Kind = kNewFSPartitionTypeStandard;
partBlock->SectorEnd = 0; /// grows on the disk.
@@ -97,7 +97,7 @@ EXTERN_C Boolean boot_write_newfs_partition(const Char* namePart, SizeT namePart
swapBlock->SectorStart = kEPMStartPartition;
swapBlock->Version = kNewFSVersionInteger;
swapBlock->Kind = kNewFSPartitionTypePage;
- swapBlock->SectorEnd = MIB(4); /// 4 MIB swap partition.
+ swapBlock->SectorEnd = MIB(16); /// 4 MIB swap partition.
ataInterface->Write(buf, 1);
diff --git a/Private/Source/Framebuffer.cxx b/Private/Source/Framebuffer.cxx
index 2682d165..d0be2a13 100644
--- a/Private/Source/Framebuffer.cxx
+++ b/Private/Source/Framebuffer.cxx
@@ -21,6 +21,14 @@
using namespace NewOS;
+namespace NewOS {
+const UInt32 kRgbRed = 0x000000FF;
+const UInt32 kRgbGreen = 0x0000FF00;
+const UInt32 kRgbBlue = 0x00FF0000;
+const UInt32 kRgbBlack = 0x00000000;
+const UInt32 kRgbWhite = 0xFFFFFFFF;
+} // namespace NewOS
+
/**
* @brief Get Pixel at
*
diff --git a/Public/Developer/System.Core/Headers/Defines.h b/Public/Developer/System.Core/Headers/Defines.h
index 36884786..56367cff 100644
--- a/Public/Developer/System.Core/Headers/Defines.h
+++ b/Public/Developer/System.Core/Headers/Defines.h
@@ -196,9 +196,12 @@ CA_EXTERN_C ObjectRef RtGetAppObject(VoidType);
CA_EXTERN_C SizeType RtGetAppArgumentsCount(VoidType);
CA_EXTERN_C CharacterTypeUTF8* RtGetAppArgumentsPtr(VoidType);
-CA_INLINE ObjectRef kApplicationObject;
+CA_EXTERN_C ObjectRef kApplicationObject;
typedef CharacterTypeUTF8 Str255Type[255];
#define True 1
#define False 0
+#define Bool BooleanType
+
+#define NULL ((PtrVoidType)0)
diff --git a/Public/Developer/System.Core/Headers/Window.h b/Public/Developer/System.Core/Headers/Window.h
index 714ef7de..846d5cff 100644
--- a/Public/Developer/System.Core/Headers/Window.h
+++ b/Public/Developer/System.Core/Headers/Window.h
@@ -67,11 +67,11 @@ typedef UInt32Type ColorRef;
/// Color utils.
/***********************************************************************************/
-const ColorRef kRgbRed = 0x000000FF;
-const ColorRef kRgbGreen = 0x0000FF00;
-const ColorRef kRgbBlue = 0x00FF0000;
-const ColorRef kRgbBlack = 0x00000000;
-const ColorRef kRgbWhite = 0xFFFFFFFF;
+CA_EXTERN_C const ColorRef kRgbRed;
+CA_EXTERN_C const ColorRef kRgbGreen;
+CA_EXTERN_C const ColorRef kRgbBlue;
+CA_EXTERN_C const ColorRef kRgbBlack;
+CA_EXTERN_C const ColorRef kRgbWhite;
/***********************************************************************************/
/// Color macro.
diff --git a/Public/Developer/System.Core/Makefile b/Public/Developer/System.Core/Makefile
index 34851e99..b9a0a663 100644
--- a/Public/Developer/System.Core/Makefile
+++ b/Public/Developer/System.Core/Makefile
@@ -3,19 +3,21 @@
# This is the SystemLib Makefile.
##################################################
-CC=x86_64-w64-mingw32-g++
-CCINC=-I../ -I../../../Private/
-CCFLAGS=-shared -ffreestanding -D__SINGLE_PRECISION__ -nostdlib -fno-rtti -fno-exceptions -std=c++20 -Xlinker --subsystem=17
+CC=x86_64-w64-mingw32-gcc
+AR=x86_64-w64-mingw32-ar
+ARFLAGS=-rcs
+CCINC=-I../
+CCFLAGS=-D__SINGLE_PRECISION__ -nostdlib -std=c17 -ffreestanding -Xlinker --subsystem=17 -shared
OUTPUT=SystemLib.lib
-.PHONY: build-core-amd64
-build-core-amd64:
- $(CC) $(CCINC) $(CCFLAGS) $(wildcard Sources/*.c) $(wildcard Sources/*.cxx) $(wildcard AMD64/*.s) -o $(OUTPUT)
-
.PHONY: all
all: build-core-amd64
@echo "[SystemLib.lib] Build done."
+.PHONY: build-core-amd64
+build-core-amd64:
+ $(CC) $(CCINC) $(CCFLAGS) $(wildcard Sources/*.c) $(wildcard AMD64/*.s) -o $(OUTPUT)
+
.PHONY: clean
clean:
- rm -f *.o
+ rm -f $(wildcard *.o)
diff --git a/Public/Developer/System.Core/Sources/Start.c b/Public/Developer/System.Core/Sources/Start.c
index 25a29e18..24d41a1e 100644
--- a/Public/Developer/System.Core/Sources/Start.c
+++ b/Public/Developer/System.Core/Sources/Start.c
@@ -4,11 +4,12 @@
#include <System.Core/Headers/Heap.h>
+/// @brief Main Application object, retrieved from __start symbol.
+CA_EXTERN_C ObjectRef kApplicationObject = NULL;
+
/// @brief Inits the library.
/// @return if it was succesful or not.
-CA_EXTERN_C DWordType __start(VoidType) {
+CA_EXTERN_C VoidType __start(VoidType) {
kApplicationObject = RtGetAppObject();
CA_MUST_PASS(kApplicationObject);
-
- return 0;
}
diff --git a/Public/Developer/System.Core/Sources/Window.c b/Public/Developer/System.Core/Sources/Window.c
index 2b589402..b68c1afb 100644
--- a/Public/Developer/System.Core/Sources/Window.c
+++ b/Public/Developer/System.Core/Sources/Window.c
@@ -59,4 +59,12 @@ CA_EXTERN_C Int32Type WmMoveWindow(WindowPort* id, WmPoint where) {
id->windowMoving = True;
return 0;
-} \ No newline at end of file
+}
+
+/// Colors!
+
+CA_EXTERN_C const ColorRef kRgbRed = 0x000000FF;
+CA_EXTERN_C const ColorRef kRgbGreen = 0x0000FF00;
+CA_EXTERN_C const ColorRef kRgbBlue = 0x00FF0000;
+CA_EXTERN_C const ColorRef kRgbBlack = 0x00000000;
+CA_EXTERN_C const ColorRef kRgbWhite = 0xFFFFFFFF;
diff --git a/Public/Developer/System.Cxx/.gitkeep b/Public/Developer/System.Cxx/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Public/Developer/System.Cxx/.gitkeep
diff --git a/Public/Developer/System.Core/Sources/New+Delete.cxx b/Public/Developer/System.Cxx/Sources/New+Delete.cxx
index 0800da22..b54b5ea8 100644
--- a/Public/Developer/System.Core/Sources/New+Delete.cxx
+++ b/Public/Developer/System.Cxx/Sources/New+Delete.cxx
@@ -24,17 +24,4 @@ void operator delete[](void* ptr) {
if (ptr == nullptr) return;
RtFreeProcessPtr(ptr);
-}
-
-void operator delete(void* ptr) {
- if (ptr == nullptr) return;
-
- RtFreeProcessPtr(ptr);
-}
-
-void operator delete(void* ptr, size_t sz) {
- if (ptr == nullptr) return;
- CA_UNREFERENCED_PARAMETER(sz);
-
- RtFreeProcessPtr(ptr);
-}
+} \ No newline at end of file