summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-19 17:56:55 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-06-19 17:57:16 +0200
commit19d0857d84cbc0267a8b222368e143bdcdaaf9a7 (patch)
tree8d8a274003cbe6837a5f565e97a810d0774f0624
parent720e24cea004356da037648b92fd7eb02f3c74a8 (diff)
ARM64: Got into the linking stage, writing missing drivers in HAL now.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--Kernel/ArchKit/ArchKit.hpp2
-rw-r--r--Kernel/Builtins/Flash/Flash.hxx17
-rw-r--r--Kernel/HALKit/AMD64/HalPageAlloc.hpp2
-rw-r--r--Kernel/HALKit/AMD64/Processor.hpp12
-rw-r--r--Kernel/HALKit/ARM64/HalPageAlloc.hpp82
-rw-r--r--Kernel/HALKit/ARM64/HalPageInternal.S5
-rw-r--r--Kernel/HALKit/ARM64/Hart.hxx4
-rw-r--r--Kernel/HALKit/ARM64/Processor.hxx55
-rw-r--r--Kernel/HALKit/ARM64/Storage/Flash.cxx27
-rw-r--r--Kernel/HALKit/POWER/Hart.hxx4
-rw-r--r--Kernel/HALKit/RISCV/Hart.hxx4
-rw-r--r--Kernel/KernelKit/ProcessScheduler.hxx6
-rwxr-xr-xKernel/MoveAll.ARM64.sh7
-rwxr-xr-xKernel/MoveAll.X64.sh (renamed from Kernel/MoveAll.sh)0
-rw-r--r--Kernel/NewKit/PageAllocator.hpp1
-rw-r--r--Kernel/Sources/CxxAbi.cxx25
-rw-r--r--Kernel/Sources/FS/NewFS.cxx1
-rw-r--r--Kernel/Sources/HalPageAlloc.cxx (renamed from Kernel/HALKit/AMD64/HalPageAlloc.cpp)6
-rw-r--r--Kernel/Sources/KeMain.cxx17
-rw-r--r--Kernel/Sources/KernelCheck.cxx6
-rw-r--r--Kernel/Sources/PageManager.cxx4
-rw-r--r--Kernel/Sources/Pmm.cxx4
-rw-r--r--Kernel/Sources/Utils.cxx15
-rw-r--r--Kernel/amd64-efi.make2
-rw-r--r--Kernel/arm64-cb.make19
25 files changed, 272 insertions, 55 deletions
diff --git a/Kernel/ArchKit/ArchKit.hpp b/Kernel/ArchKit/ArchKit.hpp
index ba2a1903..639a3f04 100644
--- a/Kernel/ArchKit/ArchKit.hpp
+++ b/Kernel/ArchKit/ArchKit.hpp
@@ -16,6 +16,8 @@
#include <HALKit/AMD64/Processor.hpp>
#elif defined(__NEWOS_PPC__)
#include <HALKit/POWER/Processor.hpp>
+#elif defined(__NEWOS_ARM64__)
+#include <HALKit/ARM64/Processor.hxx>
#else
#error !!! unknown architecture !!!
#endif
diff --git a/Kernel/Builtins/Flash/Flash.hxx b/Kernel/Builtins/Flash/Flash.hxx
new file mode 100644
index 00000000..c894089a
--- /dev/null
+++ b/Kernel/Builtins/Flash/Flash.hxx
@@ -0,0 +1,17 @@
+/* -------------------------------------------
+
+ Copyright Zeta Electronics Corporation
+
+------------------------------------------- */
+
+#pragma once
+
+#ifdef __FLASH_MEM__
+
+/// @brief get sector count.
+NewOS::SizeT drv_std_get_sector_count();
+
+/// @brief get device size.
+NewOS::SizeT drv_std_get_drv_size();
+
+#endif // ifdef __FLASH_MEM__
diff --git a/Kernel/HALKit/AMD64/HalPageAlloc.hpp b/Kernel/HALKit/AMD64/HalPageAlloc.hpp
index 29947f2f..332c8ed4 100644
--- a/Kernel/HALKit/AMD64/HalPageAlloc.hpp
+++ b/Kernel/HALKit/AMD64/HalPageAlloc.hpp
@@ -45,7 +45,7 @@ namespace NewOS::HAL
bool Cache : 1;
bool Accessed : 1;
NewOS::Int32 Reserved : 6;
- NewOS::UIntPtr PhysicalAddress : 36;
+ NewOS::UInt64 PhysicalAddress : 36;
NewOS::Int32 Reserved1 : 15;
bool ExecDisable : 1;
};
diff --git a/Kernel/HALKit/AMD64/Processor.hpp b/Kernel/HALKit/AMD64/Processor.hpp
index c52fecdf..7c0a4415 100644
--- a/Kernel/HALKit/AMD64/Processor.hpp
+++ b/Kernel/HALKit/AMD64/Processor.hpp
@@ -54,7 +54,7 @@ namespace NewOS
namespace NewOS::HAL
{
-
+ /// @brief Virtual memory flags.
enum
{
eFlagsUser,
@@ -87,9 +87,11 @@ namespace NewOS::HAL
{
kcout << "PM is already present.\r";
- kcout << "PhysicalAddress: " << hex_number(pde->Pte[pml4_index].PhysicalAddress) << endl;
- kcout << "User: " << (pde->Pte[pml4_index].User ? "yes" : "no") << "\r";
- kcout << "RW: " << (pde->Pte[pml4_index].Rw ? "yes" : "no") << "\r";
+ kcout << "PhysicalAddress: " << hex_number(pde->Pte[pml4_index].PhysicalAddress);
+ kcout << "\r";
+
+ kcout << "User: " << (pde->Pte[pml4_index].User ? "YES" : "NO") << "\r";
+ kcout << "RW: " << (pde->Pte[pml4_index].Rw ? "YES" : "NO") << "\r";
return 1;
}
@@ -146,7 +148,7 @@ namespace NewOS::HAL
using RawRegister = UInt64;
using InterruptId = UShort; /* For each element in the IVT */
- using interruptTrap = UIntPtr(UIntPtr sp);
+ using InterruptTrapKind = UIntPtr(UIntPtr sp);
typedef UIntPtr Reg;
diff --git a/Kernel/HALKit/ARM64/HalPageAlloc.hpp b/Kernel/HALKit/ARM64/HalPageAlloc.hpp
new file mode 100644
index 00000000..57e1e193
--- /dev/null
+++ b/Kernel/HALKit/ARM64/HalPageAlloc.hpp
@@ -0,0 +1,82 @@
+/* -------------------------------------------
+
+ Copyright Zeta Electronics Corporation
+
+------------------------------------------- */
+
+#pragma once
+
+/** ---------------------------------------------------
+
+ * THIS FILE CONTAINS CODE FOR ARM64 PAGING.
+
+------------------------------------------------------- */
+
+#include <NewKit/Defines.hpp>
+
+#ifndef kPTEMax
+#define kPTEMax (0x200)
+#endif //! kPTEMax
+
+#ifndef kPTEAlign
+#define kPTEAlign (0x1000)
+#endif //! kPTEAlign
+
+#ifndef kPTESize
+#define kPTESize (0x1000)
+#endif // !kPTESize
+
+EXTERN_C void hal_flush_tlb();
+
+namespace NewOS::HAL
+{
+ struct PACKED PageTable64 final
+ {
+ bool Present : 1;
+ bool Rw : 1;
+ bool User : 1;
+ bool Wt : 1;
+ bool Cache : 1;
+ bool Accessed : 1;
+ NewOS::Int32 Reserved : 6;
+ NewOS::UInt64 PhysicalAddress : 36;
+ NewOS::Int32 Reserved1 : 15;
+ bool ExecDisable : 1;
+ };
+
+ namespace Detail
+ {
+ enum class ControlRegisterBits
+ {
+ ProtectedModeEnable = 0,
+ MonitorCoProcessor = 1,
+ Emulation = 2,
+ TaskSwitched = 3,
+ ExtensionType = 4,
+ NumericError = 5,
+ WriteProtect = 16,
+ AlignementMask = 18,
+ NotWriteThrough = 29,
+ CacheDisable = 30,
+ PageEnable = 31,
+ };
+
+ inline UInt8 control_register_cast(ControlRegisterBits reg)
+ {
+ return static_cast<UInt8>(reg);
+ }
+ } // namespace Detail
+
+ struct PageDirectory64 final
+ {
+ PageTable64 ALIGN(kPTEAlign) Pte[kPTEMax];
+ };
+
+ VoidPtr hal_alloc_page(Boolean rw, Boolean user, SizeT size);
+} // namespace NewOS::HAL
+
+namespace NewOS
+{
+ typedef HAL::PageTable64 PTE;
+ typedef HAL::PageDirectory64 PDE;
+} // namespace NewOS
diff --git a/Kernel/HALKit/ARM64/HalPageInternal.S b/Kernel/HALKit/ARM64/HalPageInternal.S
new file mode 100644
index 00000000..8fcf40ff
--- /dev/null
+++ b/Kernel/HALKit/ARM64/HalPageInternal.S
@@ -0,0 +1,5 @@
+.text
+
+hal_flush_tlb:
+ tlbi
+ ret
diff --git a/Kernel/HALKit/ARM64/Hart.hxx b/Kernel/HALKit/ARM64/Hart.hxx
index 1b16a072..5769b01e 100644
--- a/Kernel/HALKit/ARM64/Hart.hxx
+++ b/Kernel/HALKit/ARM64/Hart.hxx
@@ -16,8 +16,8 @@ typedef NewOS::Int32 Arm64HartType;
/// @brief Set PC to specific hart.
/// @param hart the hart
/// @param epc the pc.
-/// @return
-EXTERN_C NewOS::Void hal_switch_to_hart(Arm64HartType hart, NewOS::VoidPtr epc);
+/// @return
+EXTERN_C NewOS::Void hal_set_pc_to_hart(Arm64HartType hart, NewOS::VoidPtr epc);
/// @brief Hart IPI enum
enum {
diff --git a/Kernel/HALKit/ARM64/Processor.hxx b/Kernel/HALKit/ARM64/Processor.hxx
new file mode 100644
index 00000000..8b06794f
--- /dev/null
+++ b/Kernel/HALKit/ARM64/Processor.hxx
@@ -0,0 +1,55 @@
+/* -------------------------------------------
+
+ Copyright Zeta Electronics Corporation
+
+------------------------------------------- */
+
+#pragma once
+
+#include <NewKit/Array.hpp>
+#include <NewKit/Defines.hpp>
+#include <NewKit/Utils.hpp>
+#include <FirmwareKit/Handover.hxx>
+
+#ifdef kCPUBackendName
+#undef kCPUBackendName
+#endif // ifdef kCPUBackendName
+
+#define kPTESize 512 /* 64-bit PT */
+
+#define kCPUBackendName "ARM64"
+
+#ifdef __ZETA_MACHINE__
+#define kVirtualAddressStartOffset (0x80000000)
+#else
+#error !!! please provide that macro. !!!
+#endif
+
+namespace NewOS::HAL
+{
+ struct PACKED Register64 final
+ {
+ UShort Limit;
+ UIntPtr Base;
+ };
+
+ typedef UIntPtr Reg;
+ typedef Register64 Register;
+
+ struct PACKED StackFrame final
+ {
+ Reg IntNum, Exception;
+ Reg Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
+ Reg R8, R9, R10, R11, R12, R13, R14, R15;
+ Reg Gs, Fs;
+ };
+
+ typedef StackFrame* StackFramePtr;
+}
+
+inline NewOS::VoidPtr kKernelVirtualStart = (NewOS::VoidPtr)kVirtualAddressStartOffset;
+inline NewOS::UIntPtr kKernelVirtualSize = 0UL;
+
+inline NewOS::VoidPtr kKernelPhysicalStart = nullptr;
+
+#include <HALKit/ARM64/HalPageAlloc.hpp>
diff --git a/Kernel/HALKit/ARM64/Storage/Flash.cxx b/Kernel/HALKit/ARM64/Storage/Flash.cxx
new file mode 100644
index 00000000..8afd0f58
--- /dev/null
+++ b/Kernel/HALKit/ARM64/Storage/Flash.cxx
@@ -0,0 +1,27 @@
+/* -------------------------------------------
+
+ Copyright Zeta Electronics Corporation
+
+------------------------------------------- */
+
+#include <NewKit/Defines.hpp>
+#include <ArchKit/ArchKit.hpp>
+
+/// @brief MBCI flash drive.
+
+#ifdef __FLASH_MEM__
+
+namespace NewOS
+{
+ SizeT drv_std_get_sector_count(void)
+ {
+ return 0;
+ }
+
+ SizeT drv_std_get_drv_size(void)
+ {
+ return 0;
+ }
+} // namespace NewOS
+
+#endif // if __FLASH_MEM__ (MBCI)
diff --git a/Kernel/HALKit/POWER/Hart.hxx b/Kernel/HALKit/POWER/Hart.hxx
index 10066048..ab74be4a 100644
--- a/Kernel/HALKit/POWER/Hart.hxx
+++ b/Kernel/HALKit/POWER/Hart.hxx
@@ -30,5 +30,5 @@ typedef struct HalHardwareThread
/// @brief Set PC to specific hart.
/// @param hart the hart
/// @param epc the pc.
-/// @return
-EXTERN_C NewOS::Void hal_switch_to_hart(HalHardwareThread* hart, NewOS::VoidPtr epc); \ No newline at end of file
+/// @return
+EXTERN_C NewOS::Void hal_set_pc_to_hart(HalHardwareThread* hart, NewOS::VoidPtr epc);
diff --git a/Kernel/HALKit/RISCV/Hart.hxx b/Kernel/HALKit/RISCV/Hart.hxx
index ba56b7c9..38160322 100644
--- a/Kernel/HALKit/RISCV/Hart.hxx
+++ b/Kernel/HALKit/RISCV/Hart.hxx
@@ -20,5 +20,5 @@ typedef NewOS::Int32 Rv64HartType;
/// @brief Set PC to specific hart.
/// @param hart the hart
/// @param epc the pc.
-/// @return
-EXTERN_C NewOS::Void hal_switch_to_hart(Rv64HartType hart, NewOS::VoidPtr epc); \ No newline at end of file
+/// @return
+EXTERN_C NewOS::Void hal_set_pc_to_hart(Rv64HartType hart, NewOS::VoidPtr epc);
diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx
index 8c470bb4..633cdca3 100644
--- a/Kernel/KernelKit/ProcessScheduler.hxx
+++ b/Kernel/KernelKit/ProcessScheduler.hxx
@@ -122,7 +122,7 @@ namespace NewOS
// Helper types.
using ImagePtr = VoidPtr;
- using HeapPtr = VoidPtr;
+ using HeapPtrKind = VoidPtr;
// @name ProcessHeader
// @brief Process Header (PH)
@@ -152,9 +152,9 @@ namespace NewOS
ProcessStatus Status;
// Memory, images.
- HeapPtr HeapCursor{nullptr};
+ HeapPtrKind HeapCursor{nullptr};
ImagePtr Image{nullptr};
- HeapPtr HeapPtr{nullptr};
+ HeapPtrKind HeapPtr{nullptr};
// memory usage
SizeT UsedMemory{0};
diff --git a/Kernel/MoveAll.ARM64.sh b/Kernel/MoveAll.ARM64.sh
new file mode 100755
index 00000000..5198559f
--- /dev/null
+++ b/Kernel/MoveAll.ARM64.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+for file in *.o; do
+ mv -- "$file" "${file%.o}.obj"
+done
+
+mv *.obj Objects/
diff --git a/Kernel/MoveAll.sh b/Kernel/MoveAll.X64.sh
index 664ad472..664ad472 100755
--- a/Kernel/MoveAll.sh
+++ b/Kernel/MoveAll.X64.sh
diff --git a/Kernel/NewKit/PageAllocator.hpp b/Kernel/NewKit/PageAllocator.hpp
index a0df473f..5f307d79 100644
--- a/Kernel/NewKit/PageAllocator.hpp
+++ b/Kernel/NewKit/PageAllocator.hpp
@@ -6,7 +6,6 @@
#pragma once
-#include <HALKit/AMD64/HalPageAlloc.hpp>
#include <NewKit/Defines.hpp>
#include <NewKit/PageManager.hpp>
diff --git a/Kernel/Sources/CxxAbi.cxx b/Kernel/Sources/CxxAbi.cxx
index 1e585a50..e358caca 100644
--- a/Kernel/Sources/CxxAbi.cxx
+++ b/Kernel/Sources/CxxAbi.cxx
@@ -12,21 +12,26 @@ atexit_func_entry_t __atexit_funcs[kDSOMaxObjects];
uarch_t __atexit_func_count;
-extern "C" void __cxa_pure_virtual()
+/// @brief Dynamic Shared Object Handle.
+NewOS::UIntPtr __dso_handle;
+
+EXTERN_C void __cxa_pure_virtual()
{
NewOS::kcout << "newoskrnl: C++ placeholder method.\n";
}
-extern "C" void ___chkstk_ms()
+EXTERN_C void ___chkstk_ms()
{
- while (1)
+ while (true)
{
- asm("cli");
- asm("hlt");
}
}
-extern "C" int atexit(void (*f)(void*), void* arg, void* dso)
+#ifdef __NEWOS_ARM64__
+#define atexit __aeabi_atexit
+#endif
+
+EXTERN_C int atexit(void (*f)(void*), void* arg, void* dso)
{
if (__atexit_func_count >= kDSOMaxObjects)
return -1;
@@ -40,7 +45,7 @@ extern "C" int atexit(void (*f)(void*), void* arg, void* dso)
return 0;
}
-extern "C" void __cxa_finalize(void* f)
+EXTERN_C void __cxa_finalize(void* f)
{
uarch_t i = __atexit_func_count;
if (!f)
@@ -68,19 +73,19 @@ extern "C" void __cxa_finalize(void* f)
namespace cxxabiv1
{
- extern "C" int __cxa_guard_acquire(__guard* g)
+ EXTERN_C int __cxa_guard_acquire(__guard* g)
{
(void)g;
return 0;
}
- extern "C" int __cxa_guard_release(__guard* g)
+ EXTERN_C int __cxa_guard_release(__guard* g)
{
*(char*)g = 1;
return 0;
}
- extern "C" void __cxa_guard_abort(__guard* g)
+ EXTERN_C void __cxa_guard_abort(__guard* g)
{
(void)g;
}
diff --git a/Kernel/Sources/FS/NewFS.cxx b/Kernel/Sources/FS/NewFS.cxx
index 2938c53f..3d9cd2e7 100644
--- a/Kernel/Sources/FS/NewFS.cxx
+++ b/Kernel/Sources/FS/NewFS.cxx
@@ -8,6 +8,7 @@
#include <Builtins/AHCI/AHCI.hxx>
#include <Builtins/ATA/ATA.hxx>
+#include <Builtins/Flash/Flash.hxx>
#include <FSKit/NewFS.hxx>
#include <KernelKit/HError.hpp>
#include <NewKit/Crc32.hpp>
diff --git a/Kernel/HALKit/AMD64/HalPageAlloc.cpp b/Kernel/Sources/HalPageAlloc.cxx
index ac043cff..3df68501 100644
--- a/Kernel/HALKit/AMD64/HalPageAlloc.cpp
+++ b/Kernel/Sources/HalPageAlloc.cxx
@@ -5,7 +5,13 @@
------------------------------------------- */
#include <ArchKit/ArchKit.hpp>
+
+#ifdef __NEWOS_AMD64__
#include <HALKit/AMD64/HalPageAlloc.hpp>
+#elif defined(__NEWOS_ARM64__)
+#include <HALKit/ARM64/HalPageAlloc.hpp>
+#endif
+
#include <NewKit/Defines.hpp>
#include <NewKit/KernelCheck.hpp>
diff --git a/Kernel/Sources/KeMain.cxx b/Kernel/Sources/KeMain.cxx
index fb127271..418bda20 100644
--- a/Kernel/Sources/KeMain.cxx
+++ b/Kernel/Sources/KeMain.cxx
@@ -214,14 +214,15 @@ EXTERN_C NewOS::Void KeMain(NewOS::Void)
NewOS::Detail::FilesystemInstaller installer; // automatic filesystem creation.
NewOS::Detail::ke_launch_srv();
-
- // fetch system cores.
+
+#if __NEWOS_AMD64__
+ /// fetch system cores.
NewOS::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_RsdPtr);
+#else
+ /// ... or fetch using CoreBoot.
+#endif
- // spin forever.
- while (Yes)
- {
- // start scheduling.
- NewOS::ProcessHelper::StartScheduling();
- }
+ NewOS::ProcessHelper::StartScheduling();
+
+ NewOS::ke_stop(RUNTIME_CHECK_BOOTSTRAP);
}
diff --git a/Kernel/Sources/KernelCheck.cxx b/Kernel/Sources/KernelCheck.cxx
index 10c263b8..e0e61ab2 100644
--- a/Kernel/Sources/KernelCheck.cxx
+++ b/Kernel/Sources/KernelCheck.cxx
@@ -9,12 +9,14 @@
#include <NewKit/KernelCheck.hpp>
#include <NewKit/String.hpp>
-extern "C" [[noreturn]] void ke_wait_for_debugger()
+EXTERN_C [[noreturn]] void ke_wait_for_debugger()
{
while (true)
{
+#ifdef __NEWOS_AMD64__
NewOS::HAL::rt_cli();
NewOS::HAL::rt_halt();
+#endif
}
}
@@ -52,7 +54,7 @@ namespace NewOS
}
case RUNTIME_CHECK_BOOTSTRAP: {
kcout << "*** CAUSE: RUNTIME_CHECK_BOOTSTRAP *** \r";
- kcout << "*** WHAT: INVALID BOOT SEQUENCE. *** \r";
+ kcout << "*** WHAT: END OF CODE. *** \r";
break;
}
case RUNTIME_CHECK_HANDSHAKE: {
diff --git a/Kernel/Sources/PageManager.cxx b/Kernel/Sources/PageManager.cxx
index 118fbe53..331be178 100644
--- a/Kernel/Sources/PageManager.cxx
+++ b/Kernel/Sources/PageManager.cxx
@@ -7,8 +7,10 @@
#include <KernelKit/DebugOutput.hpp>
#include <NewKit/PageManager.hpp>
-#ifdef __x86_64__
+#ifdef __NEWOS_AMD64__
#include <HALKit/AMD64/HalPageAlloc.hpp>
+#elif defined(__NEWOS_ARM64__)
+#include <HALKit/ARM64/Processor.hxx>
#endif // ifdef __x86_64__
//! null deref will throw (Page Zero detected, aborting app!)
diff --git a/Kernel/Sources/Pmm.cxx b/Kernel/Sources/Pmm.cxx
index e794b57b..f3535968 100644
--- a/Kernel/Sources/Pmm.cxx
+++ b/Kernel/Sources/Pmm.cxx
@@ -7,6 +7,10 @@
#include <KernelKit/DebugOutput.hpp>
#include <NewKit/Pmm.hpp>
+#if defined(__NEWOS_ARM64__)
+#include <HALKit/ARM64/Processor.hxx>
+#endif
+
namespace NewOS
{
/// @brief Pmm constructor.
diff --git a/Kernel/Sources/Utils.cxx b/Kernel/Sources/Utils.cxx
index 66d7582b..a307d416 100644
--- a/Kernel/Sources/Utils.cxx
+++ b/Kernel/Sources/Utils.cxx
@@ -6,7 +6,6 @@
#include <NewKit/Utils.hpp>
#include <KernelKit/DebugOutput.hpp>
-#include <cstddef>
namespace NewOS
{
@@ -186,7 +185,7 @@ namespace NewOS
voidPtr rt_string_in_string(const char* in, const char* needle)
{
- for (size_t i = 0; i < rt_string_len(in); ++i)
+ for (SizeT i = 0; i < rt_string_len(in); ++i)
{
if (rt_string_cmp(in + i, needle, rt_string_len(needle)) == 0)
return reinterpret_cast<voidPtr>(const_cast<char*>(in + i));
@@ -216,38 +215,38 @@ namespace NewOS
////////////////////////////////////////////////////////////////////////////////////////
/// @brief memset in C++
-EXTERN_C void memset(void* dst, char src, size_t len)
+EXTERN_C void memset(void* dst, char src, NewOS::SizeT len)
{
NewOS::rt_set_memory(dst, src, len);
}
/// @brief memcpy in C++
-EXTERN_C void memcpy(void* dst, void* src, size_t len)
+EXTERN_C void memcpy(void* dst, void* src, NewOS::SizeT len)
{
NewOS::rt_copy_memory(src, dst, len);
}
/// @brief memmove in C++
-EXTERN_C void* memmove(void* dst, void* src, size_t len)
+EXTERN_C void* memmove(void* dst, void* src, NewOS::SizeT len)
{
NewOS::rt_copy_memory(src, dst, len);
return dst;
}
/// @brief strlen definition in C++.
-EXTERN_C size_t strlen(const char* whatToCheck)
+EXTERN_C NewOS::SizeT strlen(const char* whatToCheck)
{
return NewOS::rt_string_len(whatToCheck);
}
/// @brief memcmp in C++
-EXTERN_C NewOS::SizeT memcmp(void* dst, void* src, size_t len)
+EXTERN_C NewOS::SizeT memcmp(void* dst, void* src, NewOS::SizeT len)
{
return NewOS::rt_string_cmp((char*)src, (char*)dst, len);
}
/// @brief strcmp in C++
-EXTERN_C NewOS::SizeT strcmp(char* dst, char* src, size_t len)
+EXTERN_C NewOS::SizeT strcmp(char* dst, char* src, NewOS::SizeT len)
{
return NewOS::rt_string_cmp(src, dst, len);
}
diff --git a/Kernel/amd64-efi.make b/Kernel/amd64-efi.make
index b7ca45e9..f543c1e6 100644
--- a/Kernel/amd64-efi.make
+++ b/Kernel/amd64-efi.make
@@ -45,7 +45,7 @@ error:
@echo "=== ERROR ==="
@echo "=> Use a specific target."
-MOVEALL=./MoveAll.sh
+MOVEALL=./MoveAll.X64.sh
WINDRES=x86_64-w64-mingw32-windres
.PHONY: newos-amd64-epm
diff --git a/Kernel/arm64-cb.make b/Kernel/arm64-cb.make
index ac7ccd2d..1d87edf6 100644
--- a/Kernel/arm64-cb.make
+++ b/Kernel/arm64-cb.make
@@ -3,17 +3,17 @@
# This is the microkernel makefile.
##################################################
-CC = arm-none-eabi-g++.exe
-LD = arm-none-eabi-ld.exe
+CC = arm-none-eabi-g++ -march=armv8-a
+LD = arm-none-eabi-ld
CCFLAGS = -c -fPIC -ffreestanding -D__NEWOS_ARM64__ -fno-rtti -fno-exceptions -I./ \
- -std=c++20 -D__FSKIT_NEWFS__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__
+ -std=c++20 -D__FSKIT_NEWFS__ -D__ZETA_MACHINE__ -D__KERNEL__ -D__HAVE_MAHROUSS_APIS__ -D__MAHROUSS__
-ASM = arm-none-eabi-as.exe
+ASM = arm-none-eabi-as -march=armv8-a
DISKDRIVER = -D__FLASH_MEM__
ifneq ($(SDCARD_SUPPORT), )
-DISKDRIVER = -D__SDCARD__
+DISKDRIVER = -D__SDCARD__
endif
ifneq ($(DEBUG_SUPPORT), )
@@ -27,13 +27,14 @@ LDOBJ = Objects/*.obj
# This file is the kernel, responsible of task management and memory.
KERNEL = newoskrnl.exe
+KERNEL_512K = newoskrnl.512k.exe
.PHONY: error
error:
@echo "=== ERROR ==="
@echo "=> Use a specific target."
-MOVEALL=./MoveAll.sh
+MOVEALL=./MoveAll.ARM64.sh
.PHONY: newos-arm64-epm
newos-arm64-epm: clean
@@ -53,8 +54,8 @@ link-arm64-epm:
.PHONY: all
all: newos-arm64-epm link-arm64-epm
- qemu-img create -f raw newoskrnl.512k.exe 512K
- dd if=newoskrnl.exe of=newoskrnl.512k.exe bs=1 seek=0 conv=notrunc
+ qemu-img create -f raw $(KERNEL_512K) 512K
+ dd if=newoskrnl.exe of=$(KERNEL_512K) bs=1 seek=0 conv=notrunc
@echo "NewOSKrnl => OK."
.PHONY: help
@@ -66,4 +67,4 @@ help:
.PHONY: clean
clean:
- rm -f $(LDOBJ) $(wildcard *.o) $(KERNEL)
+ rm -f $(LDOBJ) $(wildcard *.o) $(KERNEL) $(KERNEL_512K)