summaryrefslogtreecommitdiffhomepage
path: root/Kernel/Drivers
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Drivers')
-rw-r--r--Kernel/Drivers/.gitkeep0
-rw-r--r--Kernel/Drivers/Bonjour/Bonjour.c20
-rw-r--r--Kernel/Drivers/Bonjour/DriverRsrc.rsrc25
-rw-r--r--Kernel/Drivers/Bonjour/x86_64.mk52
-rw-r--r--Kernel/Drivers/MahroussUpdate/DriverRsrc.rsrc25
-rw-r--r--Kernel/Drivers/MahroussUpdate/MahroussUpdate.cc24
-rw-r--r--Kernel/Drivers/MahroussUpdate/MahroussUpdate.hxx37
-rw-r--r--Kernel/Drivers/MahroussUpdate/x86_64.mk53
-rw-r--r--Kernel/Drivers/SampleDriver/DriverRsrc.rsrc25
-rw-r--r--Kernel/Drivers/SampleDriver/SampleDriver.c25
-rw-r--r--Kernel/Drivers/SampleDriver/x86_64.mk52
11 files changed, 338 insertions, 0 deletions
diff --git a/Kernel/Drivers/.gitkeep b/Kernel/Drivers/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Kernel/Drivers/.gitkeep
diff --git a/Kernel/Drivers/Bonjour/Bonjour.c b/Kernel/Drivers/Bonjour/Bonjour.c
new file mode 100644
index 00000000..71b304ef
--- /dev/null
+++ b/Kernel/Drivers/Bonjour/Bonjour.c
@@ -0,0 +1,20 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#include <DriverKit/KernelString.h>
+#include <DriverKit/KernelPrint.h>
+
+int __ImageStart(void)
+{
+ kernelPrintStr("Bonjour: Starting up zeroconf...\r");
+ return 0;
+}
+
+int __ImageEnd(void)
+{
+ kernelPrintStr("Bonjour: Shutting down zeroconf...\r");
+ return 0;
+}
diff --git a/Kernel/Drivers/Bonjour/DriverRsrc.rsrc b/Kernel/Drivers/Bonjour/DriverRsrc.rsrc
new file mode 100644
index 00000000..494e85ee
--- /dev/null
+++ b/Kernel/Drivers/Bonjour/DriverRsrc.rsrc
@@ -0,0 +1,25 @@
+1 ICON "../../Root/Boot/Icons/bonjour-logo.ico"
+
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080904E4"
+ BEGIN
+ VALUE "CompanyName", "SoftwareLabs"
+ VALUE "FileDescription", "New OS Bonjour driver."
+ VALUE "FileVersion", "1.00"
+ VALUE "InternalName", "Bonjour."
+ VALUE "LegalCopyright", "Copyright SoftwareLabs, all rights reserved."
+ VALUE "OriginalFilename", "Bonjour.exe"
+ VALUE "ProductName", "Bonjour."
+ VALUE "ProductVersion", "1.00"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x809, 1252
+ END
+END
diff --git a/Kernel/Drivers/Bonjour/x86_64.mk b/Kernel/Drivers/Bonjour/x86_64.mk
new file mode 100644
index 00000000..b2493edf
--- /dev/null
+++ b/Kernel/Drivers/Bonjour/x86_64.mk
@@ -0,0 +1,52 @@
+##################################################
+# (C) SoftwareLabs, all rights reserved.
+# This is the sample driver makefile.
+##################################################
+
+CC_GNU=x86_64-w64-mingw32-gcc
+LD_GNU=x86_64-w64-mingw32-ld
+
+WINDRES=x86_64-w64-mingw32-windres
+
+ADD_FILE=touch
+COPY=cp
+HTTP_GET=wget
+
+LD_FLAGS=-e __ImageStart --subsystem=17
+
+OBJ=*.o
+
+
+REM=rm
+REM_FLAG=-f
+
+FLAG_ASM=-f win64
+FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -std=c17 -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./
+
+.PHONY: invalid-recipe
+invalid-recipe:
+ @echo "invalid-recipe: Use make all instead."
+
+.PHONY: all
+all: compile-amd64
+ $(LD_GNU) $(OBJ) $(LD_FLAGS) -o Bonjour.exe
+ cp Bonjour.exe ../../Root/Boot/Bonjour.exe
+
+ifneq ($(DEBUG_SUPPORT), )
+DEBUG = -D__DEBUG__
+endif
+
+.PHONY: compile-amd64
+compile-amd64:
+ $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o
+ $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DriverKit/*.c) $(wildcard ../../DriverKit/*.S)
+
+.PHONY: clean
+clean:
+ $(REM) $(REM_FLAG) $(OBJ) Bonjour.exe
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "clean: Clean driver."
+ @echo "compile-amd64: Build driver."
diff --git a/Kernel/Drivers/MahroussUpdate/DriverRsrc.rsrc b/Kernel/Drivers/MahroussUpdate/DriverRsrc.rsrc
new file mode 100644
index 00000000..88261a47
--- /dev/null
+++ b/Kernel/Drivers/MahroussUpdate/DriverRsrc.rsrc
@@ -0,0 +1,25 @@
+1 ICON "../../Root/Boot/Icons/update-logo.ico"
+
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080904E4"
+ BEGIN
+ VALUE "CompanyName", "SoftwareLabs"
+ VALUE "FileDescription", "New OS Mahrouss Update driver."
+ VALUE "FileVersion", "1.00"
+ VALUE "InternalName", "Mahrouss Update."
+ VALUE "LegalCopyright", "Copyright SoftwareLabs, all rights reserved."
+ VALUE "OriginalFilename", "MahroussUpdate.exe"
+ VALUE "ProductName", "MahroussUpdate."
+ VALUE "ProductVersion", "1.00"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x809, 1252
+ END
+END
diff --git a/Kernel/Drivers/MahroussUpdate/MahroussUpdate.cc b/Kernel/Drivers/MahroussUpdate/MahroussUpdate.cc
new file mode 100644
index 00000000..eb8d03c7
--- /dev/null
+++ b/Kernel/Drivers/MahroussUpdate/MahroussUpdate.cc
@@ -0,0 +1,24 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#include <DriverKit/KernelString.h>
+#include <DriverKit/KernelPrint.h>
+
+#include <Drivers/MahroussUpdate/MahroussUpdate.hxx>
+
+DK_EXTERN int __ImageStart(void) {
+ kernelPrintStr("Mahrouss Update: Looking for updates...\r");
+ UpdateRequest req("mup://release-mahrouss.logic/newos/");
+
+ return 0;
+}
+
+DK_EXTERN int __ImageEnd(void) {
+ return 0;
+}
+
+///! @brief Use this to check your stack, if using MinGW/MSVC.
+DK_EXTERN void ___chkstk_ms(void) {}
diff --git a/Kernel/Drivers/MahroussUpdate/MahroussUpdate.hxx b/Kernel/Drivers/MahroussUpdate/MahroussUpdate.hxx
new file mode 100644
index 00000000..5f866544
--- /dev/null
+++ b/Kernel/Drivers/MahroussUpdate/MahroussUpdate.hxx
@@ -0,0 +1,37 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#pragma once
+
+#include <DriverKit/KernelString.h>
+
+#include "DriverKit/KernelPrint.h"
+
+/// @file Software update job driver.
+
+class UpdateRequest;
+class UpdateRequestObserver;
+
+class UpdateRequest
+{
+public:
+ explicit UpdateRequest(const char* patchUrl = "mup://invalid-url-scheme/")
+ {
+ kernelStringCopy(this->fPatchUrl, patchUrl, kernelStringLength(patchUrl));
+
+ kernelPrintStr("Mahrouss Update, Looking at: ");
+ kernelPrintStr(patchUrl);
+ kernelPrintChar('\r');
+ kernelPrintChar('\n');
+ }
+
+ ~UpdateRequest()
+ {
+ }
+
+private:
+ char fPatchUrl[4096] = {0};
+};
diff --git a/Kernel/Drivers/MahroussUpdate/x86_64.mk b/Kernel/Drivers/MahroussUpdate/x86_64.mk
new file mode 100644
index 00000000..13b30d59
--- /dev/null
+++ b/Kernel/Drivers/MahroussUpdate/x86_64.mk
@@ -0,0 +1,53 @@
+##################################################
+# (C) SoftwareLabs, all rights reserved.
+# This is the sample driver makefile.
+##################################################
+
+CC_GNU=x86_64-w64-mingw32-gcc
+LD_GNU=x86_64-w64-mingw32-ld
+
+WINDRES=x86_64-w64-mingw32-windres
+
+ADD_FILE=touch
+COPY=cp
+HTTP_GET=wget
+
+LD_FLAGS=-e __ImageStart --subsystem=17
+
+OBJ=*.o
+
+
+REM=rm
+REM_FLAG=-f
+
+FLAG_ASM=-f win64
+FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./
+
+.PHONY: invalid-recipe
+invalid-recipe:
+ @echo "invalid-recipe: Use make all instead."
+
+.PHONY: all
+all: compile-amd64
+ $(LD_GNU) $(OBJ) $(LD_FLAGS) -o MahroussUpdate.exe
+ cp MahroussUpdate.exe ../../Root/Boot/MahroussUpdate.exe
+
+ifneq ($(DEBUG_SUPPORT), )
+DEBUG = -D__DEBUG__
+endif
+
+.PHONY: compile-amd64
+compile-amd64:
+ $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o
+ $(CC_GNU) $(FLAG_GNU) -std=c17 $(DEBUG) $(wildcard *.c) $(wildcard ../../DriverKit/*.c) $(wildcard ../../DriverKit/*.S)
+ $(CC_GNU) $(FLAG_GNU) -std=c++17 -fno-rtti -fno-exceptions $(DEBUG) $(wildcard *.cc) $(wildcard ../../DriverKit/*.cc)
+
+.PHONY: clean
+clean:
+ $(REM) $(REM_FLAG) $(OBJ) MahroussUpdate.exe
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "clean: Clean driver."
+ @echo "compile-amd64: Build driver."
diff --git a/Kernel/Drivers/SampleDriver/DriverRsrc.rsrc b/Kernel/Drivers/SampleDriver/DriverRsrc.rsrc
new file mode 100644
index 00000000..3a3b8774
--- /dev/null
+++ b/Kernel/Drivers/SampleDriver/DriverRsrc.rsrc
@@ -0,0 +1,25 @@
+1 ICON "../../Root/Boot/Icons/driver-logo.ico"
+
+1 VERSIONINFO
+FILEVERSION 1,0,0,0
+PRODUCTVERSION 1,0,0,0
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "080904E4"
+ BEGIN
+ VALUE "CompanyName", "SoftwareLabs"
+ VALUE "FileDescription", "New OS driver."
+ VALUE "FileVersion", "1.00"
+ VALUE "InternalName", "SampleDriver"
+ VALUE "LegalCopyright", "Copyright SoftwareLabs, all rights reserved."
+ VALUE "OriginalFilename", "SampleDriver.exe"
+ VALUE "ProductName", "SampleDriver"
+ VALUE "ProductVersion", "1.00"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x809, 1252
+ END
+END
diff --git a/Kernel/Drivers/SampleDriver/SampleDriver.c b/Kernel/Drivers/SampleDriver/SampleDriver.c
new file mode 100644
index 00000000..54f3ebef
--- /dev/null
+++ b/Kernel/Drivers/SampleDriver/SampleDriver.c
@@ -0,0 +1,25 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#include <DriverKit/KernelString.h>
+#include <DriverKit/KernelPrint.h>
+
+int __ImageStart(void)
+{
+ kernelPrintStr("SampleDriver: Starting up...\r");
+ return 0;
+}
+
+int __ImageEnd(void)
+{
+ kernelPrintStr("SampleDriver: Shutting down...\r");
+ return 0;
+}
+
+///! @brief Use this to check your stack, if using MinGW/MSVC.
+void ___chkstk_ms(void)
+{
+}
diff --git a/Kernel/Drivers/SampleDriver/x86_64.mk b/Kernel/Drivers/SampleDriver/x86_64.mk
new file mode 100644
index 00000000..5bdf0331
--- /dev/null
+++ b/Kernel/Drivers/SampleDriver/x86_64.mk
@@ -0,0 +1,52 @@
+##################################################
+# (C) SoftwareLabs, all rights reserved.
+# This is the sample driver makefile.
+##################################################
+
+CC_GNU=x86_64-w64-mingw32-gcc
+LD_GNU=x86_64-w64-mingw32-ld
+
+WINDRES=x86_64-w64-mingw32-windres
+
+ADD_FILE=touch
+COPY=cp
+HTTP_GET=wget
+
+LD_FLAGS=-e __ImageStart --subsystem=17
+
+OBJ=*.o
+
+
+REM=rm
+REM_FLAG=-f
+
+FLAG_ASM=-f win64
+FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KERNEL__ -DEFI_FUNCTION_WRAPPER -I../ -I../../ -I./ -c -ffreestanding -std=c17 -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__ -D__BOOTLOADER__ -I./
+
+.PHONY: invalid-recipe
+invalid-recipe:
+ @echo "invalid-recipe: Use make all instead."
+
+.PHONY: all
+all: compile-amd64
+ $(LD_GNU) $(OBJ) $(LD_FLAGS) -o SampleDriver.exe
+ cp SampleDriver.exe ../../Root/Boot/SampleDriver.exe
+
+ifneq ($(DEBUG_SUPPORT), )
+DEBUG = -D__DEBUG__
+endif
+
+.PHONY: compile-amd64
+compile-amd64:
+ $(WINDRES) DriverRsrc.rsrc -O coff -o DriverRsrc.o
+ $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard *.c) $(wildcard ../../DriverKit/*.c) $(wildcard ../../DriverKit/*.S)
+
+.PHONY: clean
+clean:
+ $(REM) $(REM_FLAG) $(OBJ) SampleDriver.exe
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "clean: Clean driver."
+ @echo "compile-amd64: Build driver."