summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-18 10:55:51 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-04-18 11:12:37 +0200
commit706c58b9b9fa74c63180f490a1f48652d0408944 (patch)
treee6b95ff57512dfc2af153805286041c332a53f52
parent41cc598c501ee190385c041b2149eae228b24741 (diff)
MHR-3: Start working on drivers now.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--Private/Documentation/Spec.md14
-rw-r--r--Private/Drivers/.gitkeep (renamed from Private/Servers/.gitkeep)0
-rw-r--r--Private/Drivers/SampleDriver/DriverRsrc.rsrc25
-rw-r--r--Private/Drivers/SampleDriver/SampleDriver.c (renamed from Private/Servers/CoreDisplay/Headers/CDServerStartup.h)7
-rw-r--r--Private/Drivers/SampleDriver/makefile62
-rw-r--r--Private/KernelRsrc.rsrc2
-rw-r--r--Private/NewBoot/Source/BootloaderRsrc.rsrc2
-rw-r--r--Private/NewBoot/Source/makefile2
-rw-r--r--Private/Root/Boot/Icons/boot-logo.ico (renamed from Private/Root/Boot/boot-logo.ico)bin2238 -> 2238 bytes
-rw-r--r--Private/Root/Boot/Icons/driver-logo.icobin0 -> 2238 bytes
-rw-r--r--Private/Root/Boot/Icons/kernel-logo.ico (renamed from Private/Root/Boot/kernel-logo.ico)bin2238 -> 2238 bytes
-rw-r--r--Private/Servers/CoreDisplay/Headers/.gitkeep0
-rw-r--r--Private/Servers/CoreDisplay/Headers/CDBitBlt.h10
-rw-r--r--Private/Servers/CoreDisplay/README.txt4
-rw-r--r--Private/Servers/CoreDisplay/Sources/CDBitBlt.c11
-rw-r--r--Private/Servers/CoreDisplay/Sources/CDServerStartup.c25
16 files changed, 105 insertions, 59 deletions
diff --git a/Private/Documentation/Spec.md b/Private/Documentation/Spec.md
index 458d17a9..69f6d87f 100644
--- a/Private/Documentation/Spec.md
+++ b/Private/Documentation/Spec.md
@@ -1,13 +1,17 @@
===================================
+
# 0: General Information
+
===================================
- ABI and Format: PEF/PE32+.
-- Kernel architecture: Microkernel.
+- Kernel architecture: Portable hybrid kernel.
- Language: C++/(Assembly (AMD64, X64000, X86S, ARM64, PowerPC, RISCV))
===================================
+
# 1: The NewKernel
+
===================================
- Drive/Device Abstraction.
@@ -25,7 +29,9 @@
- Permission Selectors.
===================================
+
# 2: The Filesystem
+
===================================
- Catalog object with associated forks.
@@ -34,7 +40,9 @@
- UNIX path style.
==================================
+
# 3: Common naming conventions:
+
==================================
- Kernel -> ke_init_x
@@ -42,11 +50,13 @@
- Hal -> hal_foo_bar
===================================
+
# 4: The NewBoot
+
===================================
- Capable of booting from a network drive.
- Loads a PE file which is the kernel.
-- Sanity checks, based on the number of sections.
+- Sanity checks, based on the number of sections.
- Handover compliant.
- Does check for a valid partition (useful in the case of recovering)
diff --git a/Private/Servers/.gitkeep b/Private/Drivers/.gitkeep
index e69de29b..e69de29b 100644
--- a/Private/Servers/.gitkeep
+++ b/Private/Drivers/.gitkeep
diff --git a/Private/Drivers/SampleDriver/DriverRsrc.rsrc b/Private/Drivers/SampleDriver/DriverRsrc.rsrc
new file mode 100644
index 00000000..f37e2796
--- /dev/null
+++ b/Private/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", "Mahrouss-Logic"
+ VALUE "FileDescription", "NewOS driver."
+ VALUE "FileVersion", "1.00"
+ VALUE "InternalName", "SampleDriver"
+ VALUE "LegalCopyright", "Copyright Mahrouss-Logic, 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/Private/Servers/CoreDisplay/Headers/CDServerStartup.h b/Private/Drivers/SampleDriver/SampleDriver.c
index 47f369ae..79b19bf3 100644
--- a/Private/Servers/CoreDisplay/Headers/CDServerStartup.h
+++ b/Private/Drivers/SampleDriver/SampleDriver.c
@@ -2,9 +2,8 @@
Copyright Mahrouss Logic
- File: CDServerStartup.h
- Purpose: Server entrypoint.
-
------------------------------------------- */
-#pragma once \ No newline at end of file
+int __ImageStart(void) {
+ return 0;
+}
diff --git a/Private/Drivers/SampleDriver/makefile b/Private/Drivers/SampleDriver/makefile
new file mode 100644
index 00000000..7d58b611
--- /dev/null
+++ b/Private/Drivers/SampleDriver/makefile
@@ -0,0 +1,62 @@
+##################################################
+# (C) Mahrouss Logic, 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
+
+ifeq ($(shell uname), Windows_NT)
+EMU=qemu-system-x86_64w
+else
+EMU=qemu-system-x86_64
+endif
+
+IMG=epm.img
+IMG_2=epm-slave.img
+EMU_FLAGS=-net none -smp 4 -m 4G -M q35 -bios OVMF.fd -device piix3-ide,id=ide -drive id=disk,file=$(IMG),format=raw,if=none -device ide-hd,drive=disk,bus=ide.0 -drive file=fat:rw:CDROM,index=2,format=raw -d int -hdd epm-slave.img
+
+LD_FLAGS=-e __ImageStart --subsystem=17
+
+OBJ=$(wildcard *.o) $(wildcard HEL/AMD64/*.obj)
+
+
+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)
+
+.PHONY: clean
+clean:
+ $(REM) $(REM_FLAG) $(OBJ) SampleDriver.exe
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "clean: Clean driver."
+ @echo "compile-amd64: Build driver."
diff --git a/Private/KernelRsrc.rsrc b/Private/KernelRsrc.rsrc
index 7cdcf0e0..6eacce84 100644
--- a/Private/KernelRsrc.rsrc
+++ b/Private/KernelRsrc.rsrc
@@ -1,4 +1,4 @@
-1 ICON "Root/Boot/kernel-logo.ico"
+1 ICON "Root/Boot/Icons/kernel-logo.ico"
#include "CompilerKit/Version.hxx"
diff --git a/Private/NewBoot/Source/BootloaderRsrc.rsrc b/Private/NewBoot/Source/BootloaderRsrc.rsrc
index f77a4079..424d4575 100644
--- a/Private/NewBoot/Source/BootloaderRsrc.rsrc
+++ b/Private/NewBoot/Source/BootloaderRsrc.rsrc
@@ -1,6 +1,6 @@
#include "../../CompilerKit/Version.hxx"
-1 ICON "../../Root/Boot/boot-logo.ico"
+1 ICON "../../Root/Boot/Icons/boot-logo.ico"
1 VERSIONINFO
FILEVERSION 1,0,0,0
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 4016e3a8..a73b3adb 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -35,7 +35,7 @@ FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mgeneral-regs-only -mno-red-zone -D__KE
.PHONY: invalid-recipe
invalid-recipe:
- @echo "invalid-recipe: Use make bootloader-<arch> all instead."
+ @echo "invalid-recipe: Use make bootloader-<arch> instead."
.PHONY: all
all: compile-amd64
diff --git a/Private/Root/Boot/boot-logo.ico b/Private/Root/Boot/Icons/boot-logo.ico
index a9c250ed..a9c250ed 100644
--- a/Private/Root/Boot/boot-logo.ico
+++ b/Private/Root/Boot/Icons/boot-logo.ico
Binary files differ
diff --git a/Private/Root/Boot/Icons/driver-logo.ico b/Private/Root/Boot/Icons/driver-logo.ico
new file mode 100644
index 00000000..9ee1b954
--- /dev/null
+++ b/Private/Root/Boot/Icons/driver-logo.ico
Binary files differ
diff --git a/Private/Root/Boot/kernel-logo.ico b/Private/Root/Boot/Icons/kernel-logo.ico
index d5ea0310..d5ea0310 100644
--- a/Private/Root/Boot/kernel-logo.ico
+++ b/Private/Root/Boot/Icons/kernel-logo.ico
Binary files differ
diff --git a/Private/Servers/CoreDisplay/Headers/.gitkeep b/Private/Servers/CoreDisplay/Headers/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/Private/Servers/CoreDisplay/Headers/.gitkeep
+++ /dev/null
diff --git a/Private/Servers/CoreDisplay/Headers/CDBitBlt.h b/Private/Servers/CoreDisplay/Headers/CDBitBlt.h
deleted file mode 100644
index 21823755..00000000
--- a/Private/Servers/CoreDisplay/Headers/CDBitBlt.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
- File: CDBitBlt.h
- Purpose: Userbuffer to Framebuffer magic.
-
-------------------------------------------- */
-
-#pragma once \ No newline at end of file
diff --git a/Private/Servers/CoreDisplay/README.txt b/Private/Servers/CoreDisplay/README.txt
deleted file mode 100644
index 669ec31c..00000000
--- a/Private/Servers/CoreDisplay/README.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CoreDisplay is the window manager of NewOS.
-Written in C by Amlal EL Mahrouss.
-
-Unlike X it is not networked, but can be extend to with NetworkDisplay.
diff --git a/Private/Servers/CoreDisplay/Sources/CDBitBlt.c b/Private/Servers/CoreDisplay/Sources/CDBitBlt.c
deleted file mode 100644
index 91e5342f..00000000
--- a/Private/Servers/CoreDisplay/Sources/CDBitBlt.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
- File: CDBitBlt.c
- Purpose: Userbuffer to Framebuffer magic.
-
-------------------------------------------- */
-
-#include <CDBitBlt.h>
-
diff --git a/Private/Servers/CoreDisplay/Sources/CDServerStartup.c b/Private/Servers/CoreDisplay/Sources/CDServerStartup.c
deleted file mode 100644
index 7293b720..00000000
--- a/Private/Servers/CoreDisplay/Sources/CDServerStartup.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
- File: CDServerStartup.c
- Purpose: Server entrypoint.
-
-------------------------------------------- */
-
-#include <CDServerStartup.h>
-#include <IPC.h>
-
-/// @brief Called when the server starts.
-int ServerStartup(void)
-{
- return 0;
-}
-
-/// @brief Called when the server shuts down.
-int ServerShutdown(void)
-{
- return 0;
-}
-
-/// EOF.