summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-14 22:26:42 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-14 22:26:42 +0100
commit6bbf5ad2058db4020ae20d6aba8f5b099dadc85f (patch)
treead39f25f27938729261f733d2addf839e8a110b3 /dev/Kernel
parent1c4f8ae3804be72d947b0b96f90b9300515399bc (diff)
TQ-24 && TQ-16: Add build scripts for MBCI, MBCI+Flash, and UFS.
META: Along other tweaks and important ARM64 patches. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel')
-rw-r--r--dev/Kernel/FirmwareKit/EFI/API.h22
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc (renamed from dev/Kernel/HALKit/AMD64/Storage/AHCI.cc)0
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/DMA+Generic.cc (renamed from dev/Kernel/HALKit/AMD64/Storage/DMA.cc)0
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc (renamed from dev/Kernel/HALKit/AMD64/Storage/PIO.cc)0
-rw-r--r--dev/Kernel/HALKit/ARM64/HalACPIFactoryInterface.cc3
-rw-r--r--dev/Kernel/HALKit/ARM64/HalDebugOutput.cc4
-rw-r--r--dev/Kernel/HALKit/ARM64/HalFlushTLB.S (renamed from dev/Kernel/HALKit/ARM64/HalPageInternal.S)0
-rw-r--r--dev/Kernel/HALKit/ARM64/HalKernelMain.cc2
-rw-r--r--dev/Kernel/HALKit/ARM64/HalPagingMgrARM64.cc4
-rw-r--r--dev/Kernel/HALKit/ARM64/Processor.h2
-rw-r--r--dev/Kernel/HALKit/ARM64/Storage/MBCI+Flash+IO+Generic.cc (renamed from dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc)20
-rw-r--r--dev/Kernel/HALKit/ARM64/Storage/UFS+Generic.cc11
-rw-r--r--dev/Kernel/amd64-desktop.make2
-rw-r--r--dev/Kernel/arm64-desktop.make2
-rw-r--r--dev/Kernel/arm64-mobile.make64
15 files changed, 98 insertions, 38 deletions
diff --git a/dev/Kernel/FirmwareKit/EFI/API.h b/dev/Kernel/FirmwareKit/EFI/API.h
index 03b79019..50b6ea19 100644
--- a/dev/Kernel/FirmwareKit/EFI/API.h
+++ b/dev/Kernel/FirmwareKit/EFI/API.h
@@ -11,10 +11,9 @@
#include <FirmwareKit/Handover.h>
#include <KernelKit/MSDOS.h>
#include <KernelKit/PE.h>
-#include <BootKit/Qr.h>
-#define kNeKernelSubsystem (17)
-#define kNeWebsiteMacro "https://vswirl.com/help"
+#define kNeWebsiteMacro "https://aker.com/help"
+#define kNeKernelSubsystem (StrLen(kNeWebsiteMacro))
#ifdef __BOOTZ__
// forward decl.
@@ -80,23 +79,6 @@ Bascially frees everything we have in the EFI side.
ST->ConOut->OutputString(ST->ConOut, L" ***\r");
- constexpr auto ver = 4;
- auto ecc = qr::Ecc::H;
- auto input = kNeWebsiteMacro;
- auto len = StrLen(kNeWebsiteMacro);
-
- qr::Qr<ver> encoder;
- qr::QrDelegate del;
-
- encoder.encode(input, len, ecc, 0); // Manual mask 0
-
- constexpr auto whereX = 10;
- constexpr auto whereY = 10;
-
- /// tell delegate to draw encoded QR.
- del.draw<ver>(encoder, whereX,
- whereY);
-
EFI::Stop();
}
} // namespace EFI
diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 874b7012..874b7012 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
diff --git a/dev/Kernel/HALKit/AMD64/Storage/DMA.cc b/dev/Kernel/HALKit/AMD64/Storage/DMA+Generic.cc
index 109b55af..109b55af 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/DMA.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/DMA+Generic.cc
diff --git a/dev/Kernel/HALKit/AMD64/Storage/PIO.cc b/dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc
index 62791aee..62791aee 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/PIO.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc
diff --git a/dev/Kernel/HALKit/ARM64/HalACPIFactoryInterface.cc b/dev/Kernel/HALKit/ARM64/HalACPIFactoryInterface.cc
index 6dcfa9a2..8ca9ac06 100644
--- a/dev/Kernel/HALKit/ARM64/HalACPIFactoryInterface.cc
+++ b/dev/Kernel/HALKit/ARM64/HalACPIFactoryInterface.cc
@@ -17,9 +17,10 @@ namespace NeOS
{
}
- Void ACPIFactoryInterface::Shutdown()
+ BOOL ACPIFactoryInterface::Shutdown()
{
apm_send_io_command(kAPMPowerCommandShutdown, 0);
+ return NO;
}
/// @brief Reboot machine in either ACPI or by triple faulting.
diff --git a/dev/Kernel/HALKit/ARM64/HalDebugOutput.cc b/dev/Kernel/HALKit/ARM64/HalDebugOutput.cc
index 97621e23..8d54739f 100644
--- a/dev/Kernel/HALKit/ARM64/HalDebugOutput.cc
+++ b/dev/Kernel/HALKit/ARM64/HalDebugOutput.cc
@@ -11,7 +11,7 @@
namespace NeOS
{
- EXTERN_C void ke_io_write(const Char* bytes)
+ EXTERN_C void ke_io_write(IDeviceObject<const Char*>* self, const Char* bytes)
{
#ifdef __DEBUG__
if (*bytes == 0)
@@ -38,7 +38,7 @@ namespace NeOS
TerminalDevice::~TerminalDevice() = default;
- EXTERN_C void ke_io_read(const Char* bytes)
+ EXTERN_C void ke_io_read(IDeviceObject<const Char*>* self, const Char* bytes)
{
#ifdef __DEBUG__
SizeT index = 0;
diff --git a/dev/Kernel/HALKit/ARM64/HalPageInternal.S b/dev/Kernel/HALKit/ARM64/HalFlushTLB.S
index 8fcf40ff..8fcf40ff 100644
--- a/dev/Kernel/HALKit/ARM64/HalPageInternal.S
+++ b/dev/Kernel/HALKit/ARM64/HalFlushTLB.S
diff --git a/dev/Kernel/HALKit/ARM64/HalKernelMain.cc b/dev/Kernel/HALKit/ARM64/HalKernelMain.cc
index afb1cc0e..5a6d0dc2 100644
--- a/dev/Kernel/HALKit/ARM64/HalKernelMain.cc
+++ b/dev/Kernel/HALKit/ARM64/HalKernelMain.cc
@@ -18,6 +18,8 @@
#include <HALKit/ARM64/Processor.h>
#include <CFKit/Property.h>
+#include <HALKit/ARM64/ApplicationProcessor.h>
+
EXTERN_C void hal_init_platform(
NeOS::HEL::BootInfoHeader* handover_hdr)
{
diff --git a/dev/Kernel/HALKit/ARM64/HalPagingMgrARM64.cc b/dev/Kernel/HALKit/ARM64/HalPagingMgrARM64.cc
index e04b77cd..4ec45b51 100644
--- a/dev/Kernel/HALKit/ARM64/HalPagingMgrARM64.cc
+++ b/dev/Kernel/HALKit/ARM64/HalPagingMgrARM64.cc
@@ -45,7 +45,7 @@ namespace NeOS::HAL
/// @param phys_addr point to physical address.
/// @param flags the flags to put on the page.
/// @return Status code of page manipulation process.
- EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, UInt32 flags)
+ EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, VoidPtr physical_address, UInt32 flags)
{
if (!virtual_address ||
!flags)
@@ -73,7 +73,7 @@ namespace NeOS::HAL
{
NE_PAGE_STORE& page_store = NE_PAGE_STORE::The();
- // Update Internal store.
+ // Update internal store.
page_store.fInternalStore.fPde = nullptr;
page_store.fInternalStore.fPte = pt_entry;
diff --git a/dev/Kernel/HALKit/ARM64/Processor.h b/dev/Kernel/HALKit/ARM64/Processor.h
index 4dba5a8b..e79a99c7 100644
--- a/dev/Kernel/HALKit/ARM64/Processor.h
+++ b/dev/Kernel/HALKit/ARM64/Processor.h
@@ -36,7 +36,7 @@ namespace NeOS::HAL
/// @param phys_addr point to physical address.
/// @param flags the flags to put on the page.
/// @return Status code of page manip.
- EXTERN_C Int32 mm_map_page(VoidPtr virt_addr, UInt32 flags);
+ EXTERN_C Int32 mm_map_page(VoidPtr virtual_address, VoidPtr physical_address, UInt32 flags);
typedef UIntPtr Reg;
typedef Register64 Register;
diff --git a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc b/dev/Kernel/HALKit/ARM64/Storage/MBCI+Flash+IO+Generic.cc
index 1335a9e4..3ccca867 100644
--- a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc
+++ b/dev/Kernel/HALKit/ARM64/Storage/MBCI+Flash+IO+Generic.cc
@@ -11,10 +11,10 @@
#include <Mod/MFlash/MFlash.h>
#include <Mod/MBCI/MBCI.h>
-/// @file MFlash.cc
+/// @file MBCI+Flash.cc
/// @brief MBCI Flash support.
-#define kMaxFlashSlots (8U)
+#define MBCI_MAX_SLOTS (8U)
namespace NeOS
{
@@ -23,10 +23,10 @@ namespace NeOS
constexpr auto kFlashBridgeRevision = 1;
STATIC BOOL kFlashEnabled = NO;
- STATIC SizeT kFlashSize[kMaxFlashSlots] = {};
- STATIC SizeT kFlashSectorSz[kMaxFlashSlots] = {};
- STATIC IMBCIHost* kFlashMetaPackets[kMaxFlashSlots] = {};
- STATIC IMBCIHost* kFlashDataPackets[kMaxFlashSlots] = {};
+ STATIC SizeT kFlashSize[MBCI_MAX_SLOTS] = {};
+ STATIC SizeT kFlashSectorSz[MBCI_MAX_SLOTS] = {};
+ STATIC IMBCIHost* kFlashMetaPackets[MBCI_MAX_SLOTS] = {};
+ STATIC IMBCIHost* kFlashDataPackets[MBCI_MAX_SLOTS] = {};
STATIC Void drv_std_io(Int32 slot, UInt64 lba, Char* buf, SizeT sector_sz, SizeT buf_sz);
@@ -40,7 +40,7 @@ namespace NeOS
/// @return slot sector count.
SizeT drv_get_sector_count(Int32 slot)
{
- if (slot > kMaxFlashSlots)
+ if (slot > MBCI_MAX_SLOTS)
return 0;
return kFlashSectorSz[slot];
@@ -50,7 +50,7 @@ namespace NeOS
/// @return drive slot size
SizeT drv_get_size(Int32 slot)
{
- if (slot > kMaxFlashSlots)
+ if (slot > MBCI_MAX_SLOTS)
return 0;
return kFlashSize[slot];
@@ -59,7 +59,7 @@ namespace NeOS
/// @brief Enable flash memory at slot.
BOOL drv_enable_at(Int32 slot)
{
- if (slot > kMaxFlashSlots)
+ if (slot > MBCI_MAX_SLOTS)
return NO;
kFlashMetaPackets[slot]->InterruptEnable = YES;
@@ -72,7 +72,7 @@ namespace NeOS
/// @brief Disable flash memory at slot.
BOOL drv_disable_at(Int32 slot)
{
- if (slot > kMaxFlashSlots)
+ if (slot > MBCI_MAX_SLOTS)
return NO;
kFlashMetaPackets[slot]->InterruptEnable = NO;
diff --git a/dev/Kernel/HALKit/ARM64/Storage/UFS+Generic.cc b/dev/Kernel/HALKit/ARM64/Storage/UFS+Generic.cc
new file mode 100644
index 00000000..20d06671
--- /dev/null
+++ b/dev/Kernel/HALKit/ARM64/Storage/UFS+Generic.cc
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+/// @file UFS.cc
+/// @brief UFS Flash Memory support.
+
+#define UFS_PCI_VENDOR_ID (0x01001) /* AKER */
+#define UFS_PCI_DEVICE_ID (0xAEAEA) /* AKER */ \ No newline at end of file
diff --git a/dev/Kernel/amd64-desktop.make b/dev/Kernel/amd64-desktop.make
index 56017c8e..3e8040c0 100644
--- a/dev/Kernel/amd64-desktop.make
+++ b/dev/Kernel/amd64-desktop.make
@@ -5,7 +5,7 @@
CXX = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -fshort-wchar -c -D__NE_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions -std=c++23 -D__NE_SUPPORT_NX__ -O0 -I../Vendor -D__FSKIT_INCLUDES_NEFS__ -D__NEOSKRNL__ -D__HAVE_NE_APIS__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../zba
+CCFLAGS = -fshort-wchar -c -D__NE_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__NE_SUPPORT_NX__ -O0 -I../Vendor -D__FSKIT_INCLUDES_NEFS__ -D__NEOSKRNL__ -D__HAVE_NE_APIS__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../zba
ASM = nasm
diff --git a/dev/Kernel/arm64-desktop.make b/dev/Kernel/arm64-desktop.make
index 3d23ad08..1b3521d5 100644
--- a/dev/Kernel/arm64-desktop.make
+++ b/dev/Kernel/arm64-desktop.make
@@ -7,7 +7,7 @@ CC = clang++
LD = lld-link
CCFLAGS = -fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NE_ARM64__ -fno-rtti -fno-exceptions -I./ \
-target aarch64-unknown-windows \
- -std=c++23 -O3 -D__NEOSKRNL__ -D__NE_MINIMAL_OS__ -D__NE_NO_BUILTIN__ -D__HAVE_NE_APIS__ -D__NE__ -I../
+ -std=c++20 -O3 -D__NEOSKRNL__ -D__NE_MINIMAL_OS__ -D__NE_NO_BUILTIN__ -D__HAVE_NE_APIS__ -D__NE__ -I../
ASM = clang++
diff --git a/dev/Kernel/arm64-mobile.make b/dev/Kernel/arm64-mobile.make
new file mode 100644
index 00000000..1b3521d5
--- /dev/null
+++ b/dev/Kernel/arm64-mobile.make
@@ -0,0 +1,64 @@
+##################################################
+# (c) Amlal EL Mahrouss, all rights reserved.
+# This is the microKernel makefile.
+##################################################
+
+CC = clang++
+LD = lld-link
+CCFLAGS = -fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NE_ARM64__ -fno-rtti -fno-exceptions -I./ \
+ -target aarch64-unknown-windows \
+ -std=c++20 -O3 -D__NEOSKRNL__ -D__NE_MINIMAL_OS__ -D__NE_NO_BUILTIN__ -D__HAVE_NE_APIS__ -D__NE__ -I../
+
+ASM = clang++
+
+DISKDRIVER = -D__USE_FLASH_MEM__
+
+ifneq ($(DEBUG_SUPPORT), )
+DEBUG = -D__DEBUG__
+endif
+
+COPY = cp
+
+LDFLAGS = -subsystem:efi_application -entry:hal_init_platform /nodefaultlib
+LDOBJ = obj/*.obj
+
+# This file is the Kernel, responsible of task management and memory.
+KERNEL = neoskrnl.exe
+
+.PHONY: error
+error:
+ @echo "=== ERROR ==="
+ @echo "=> Use a specific target."
+
+MOVEALL=./MoveAll.ARM64.sh
+
+.PHONY: newos-arm64-epm
+newos-arm64-epm: clean
+ $(CC) $(CCFLAGS) $(DISKDRIVER) $(DEBUG) $(wildcard src/*.cc) \
+ $(wildcard src/FS/*.cc) $(wildcard HALKit/ARM64/Storage/*.cc) \
+ $(wildcard HALKit/ARM64/PCI/*.cc) $(wildcard src/Network/*.cc) $(wildcard src/Storage/*.cc) \
+ $(wildcard HALKit/ARM64/*.cc) $(wildcard HALKit/ARM64/*.cpp) \
+ $(wildcard HALKit/ARM64/*.s) $(wildcard HALKit/ARM64/APM/*.cc)
+
+ $(MOVEALL)
+
+OBJCOPY=x86_64-w64-mingw32-objcopy
+
+.PHONY: link-arm64-epm
+link-arm64-epm:
+ $(LD) $(LDFLAGS) $(LDOBJ) /out:$(KERNEL)
+
+.PHONY: all
+all: newos-arm64-epm link-arm64-epm
+ @echo "Kernel => OK."
+
+.PHONY: help
+help:
+ @echo "=== HELP ==="
+ @echo "all: Build Kernel and link it."
+ @echo "link-arm64-epm: Link Kernel for EPM based disks."
+ @echo "newos-arm64-epm: Build Kernel for EPM based disks."
+
+.PHONY: clean
+clean:
+ rm -f $(LDOBJ) $(wildcard *.o) $(KERNEL)