summaryrefslogtreecommitdiffhomepage
path: root/Drv/SampleDriver
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-05-28 11:52:48 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-05-28 11:52:48 +0200
commit8f262d685126a9a9f68beb6d4002ba30bebae401 (patch)
tree6b4931b8e647bb4b9a8144ce385850eedb086bd9 /Drv/SampleDriver
parent9db58da40cfcb6643412bfae25aefc0cd1077f9d (diff)
MHR-23: Improve scheduler code: Dont use 39, write kErrorProcessFault instead.
MHR-23: Improve filesystem structure. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Drv/SampleDriver')
-rw-r--r--Drv/SampleDriver/DriverRsrc.rsrc25
-rw-r--r--Drv/SampleDriver/SampleDriver.c26
-rw-r--r--Drv/SampleDriver/x86_64.mk51
3 files changed, 102 insertions, 0 deletions
diff --git a/Drv/SampleDriver/DriverRsrc.rsrc b/Drv/SampleDriver/DriverRsrc.rsrc
new file mode 100644
index 00000000..3a3b8774
--- /dev/null
+++ b/Drv/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/Drv/SampleDriver/SampleDriver.c b/Drv/SampleDriver/SampleDriver.c
new file mode 100644
index 00000000..821927be
--- /dev/null
+++ b/Drv/SampleDriver/SampleDriver.c
@@ -0,0 +1,26 @@
+/* -------------------------------------------
+
+ Copyright SoftwareLabs
+
+------------------------------------------- */
+
+#include <DDK/KernelString.h>
+#include <DDK/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)
+{
+ (void)0;
+}
diff --git a/Drv/SampleDriver/x86_64.mk b/Drv/SampleDriver/x86_64.mk
new file mode 100644
index 00000000..54ee54f0
--- /dev/null
+++ b/Drv/SampleDriver/x86_64.mk
@@ -0,0 +1,51 @@
+##################################################
+# (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
+
+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 ../../DDK/*.c) $(wildcard ../../DDK/*.S)
+
+.PHONY: clean
+clean:
+ $(REM) $(REM_FLAG) $(OBJ) SampleDriver.exe
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "clean: Clean driver."
+ @echo "compile-amd64: Build driver."