diff options
Diffstat (limited to 'Private')
| -rw-r--r-- | Private/HALKit/AMD64/HalNewBoot.asm | 3 | ||||
| -rw-r--r-- | Private/NewBoot/Source/CDROM/SplashScreen.fmt | 5 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 25 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx | 9 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx | 4 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/Support.cxx | 5 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 5 | ||||
| -rw-r--r-- | Private/Source/Utils.cxx | 9 |
8 files changed, 36 insertions, 29 deletions
diff --git a/Private/HALKit/AMD64/HalNewBoot.asm b/Private/HALKit/AMD64/HalNewBoot.asm index 11b11c0c..e9034f05 100644 --- a/Private/HALKit/AMD64/HalNewBoot.asm +++ b/Private/HALKit/AMD64/HalNewBoot.asm @@ -28,9 +28,12 @@ HandoverStart: dq __ImageStart section .text global __ImageStart +global __NewBootJumpProc + extern hal_init_platform ;; Just a simple setup, we'd also need to tell some before +__NewBootJumpProc: __ImageStart: push rcx call hal_init_platform diff --git a/Private/NewBoot/Source/CDROM/SplashScreen.fmt b/Private/NewBoot/Source/CDROM/SplashScreen.fmt index 339b94e7..857c63a1 100644 --- a/Private/NewBoot/Source/CDROM/SplashScreen.fmt +++ b/Private/NewBoot/Source/CDROM/SplashScreen.fmt @@ -1,6 +1,7 @@ Welcome to NeWS. -Brought to you by: -* MicroKernel, Bootloader: Amlal EL Mahrouss. +Brought to you by: Amlal EL Mahrouss. +* NewBoot, NewKernel: Amlal EL Mahrouss. +This copy can boot directly to NewKernel (Unified System). Copyright Mahrouss-Logic, all rights reserved. diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index 1c969b28..68762089 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -21,6 +21,8 @@ /** Graphics related. */ +EXTERN_C Void hal_init_platform(HEL::HandoverInformationHeader* HIH); + STATIC EfiGraphicsOutputProtocol* kGop = nullptr; STATIC UInt16 kStride = 0U; STATIC EfiGUID kGopGuid; @@ -181,12 +183,6 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, /// format the disk. // - constexpr auto binarySize = KIB(512); - - /// need this as well, to invoke BExecutableLoader. - BFileReader readerKernel(L"NewKernel.exe", ImageHandle); - readerKernel.ReadAll(binarySize, BootDeviceATA::kSectorSize); - BDiskFormatFactory<BootDeviceATA> diskFormatter; if (!diskFormatter) { @@ -220,28 +216,15 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle, memcpy(bootDesc.fBlob, kMachineModel " startup folder.", strlen(kMachineModel " startup folder.")); - BDiskFormatFactory<BootDeviceATA>::BFileDescriptor kernelDesc{0}; - - kernelDesc.fKind = kNewFSCatalogKindFile; - - memcpy(kernelDesc.fFileName, "/Boot/NewKernel", strlen("/Boot/NewKernel")); - memcpy(kernelDesc.fForkName, kNewFSDataFork, strlen(kNewFSDataFork)); - - kernelDesc.fBlob = readerKernel.Blob(); - kernelDesc.fBlobSz = readerKernel.Size(); - rootDesc.fNext = &bootDesc; rootDesc.fNext->fPrev = &rootDesc; - rootDesc.fNext->fNext = &kernelDesc; - rootDesc.fNext->fNext->fPrev = &bootDesc; - - diskFormatter.Format(kMachineModel, &rootDesc, 3); + diskFormatter.Format(kMachineModel, &rootDesc, 2); } EFI::ExitBootServices(MapKey, ImageHandle); - rt_jump_to_address(readerKernel.Blob()); + hal_init_platform(kHandoverHeader); EFI::Stop(); diff --git a/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx b/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx index f47e3532..2ac90dd8 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx @@ -7,6 +7,9 @@ #include <BootKit/Platform.hxx> #include <BootKit/Protocol.hxx> #include <BootKit/BootKit.hxx> +#include "HALKit/AMD64/Processor.hpp" + +#if 0 EXTERN_C void rt_hlt() { asm volatile("hlt"); } @@ -50,3 +53,9 @@ EXTERN_C UInt32 In32(UInt16 port) { return value; } + +#else + +void rt_hlt() { NewOS::HAL::rt_halt(); } + +#endif // 0 diff --git a/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx b/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx index 01911c43..909ccca6 100644 --- a/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/New+Delete.cxx @@ -9,6 +9,8 @@ #include <BootKit/BootKit.hxx> #include <cstddef> /* Since we're using GCC for this EFI program. */ +#if 0 + /// @brief Allocates a new object. /// @param sz the size. /// @return @@ -45,3 +47,5 @@ void operator delete(void* buf, size_t size) { BS->FreePool(buf); } + +#endif // Inactive diff --git a/Private/NewBoot/Source/HEL/AMD64/Support.cxx b/Private/NewBoot/Source/HEL/AMD64/Support.cxx index 0508d491..a8e2c275 100644 --- a/Private/NewBoot/Source/HEL/AMD64/Support.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/Support.cxx @@ -8,6 +8,8 @@ #include <FirmwareKit/Handover.hxx> #include <BootKit/Vendor/Support.hxx> +#if 0 + /// @brief memset definition in C++. /// @param dst destination pointer. /// @param byte value to fill in. @@ -41,6 +43,7 @@ EXTERN_C size_t strlen(const char *whatToCheck) { return len; } - /// @brief somthing specific to the microsoft ABI, regarding checking the stack. EXTERN_C void ___chkstk_ms(void) {} + +#endif diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index 92128b02..8306f844 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -28,7 +28,7 @@ EMU_FLAGS=-net none -smp 4 -m 8G -M q35 -bios OVMF.fd -device piix3-ide,id=ide - LD_FLAGS=-e Main --subsystem=10 -OBJ=*.o +OBJ=*.o ../../Objects/*.obj REM=rm REM_FLAG=-f @@ -53,7 +53,6 @@ all: compile-amd64 $(LD_GNU) $(OBJ) $(LD_FLAGS) -o $(BOOT_LOADER) $(COPY) $(BOOT_LOADER) CDROM/EFI/BOOT/BOOTX64.EFI $(COPY) $(BOOT_LOADER) CDROM/EFI/BOOT/NEWBOOT.EFI - $(COPY) ../../$(KERNEL) CDROM/$(KERNEL) ifneq ($(DEBUG_SUPPORT), ) DEBUG = -D__DEBUG__ @@ -61,7 +60,7 @@ endif .PHONY: compile-amd64 compile-amd64: - $(WINDRES) BootloaderRsrc.rsrc -O coff -o BootloaderRsrc.o + # $(WINDRES) BootloaderRsrc.rsrc -O coff -o BootloaderRsrc.o $(CC_GNU) $(NEWOS_MODEL) $(FLAG_GNU) $(DEBUG) $(wildcard HEL/AMD64/*.cxx) $(wildcard HEL/AMD64/*.S) $(wildcard *.cxx) .PHONY: run-efi-amd64 diff --git a/Private/Source/Utils.cxx b/Private/Source/Utils.cxx index e12041c8..fcdddc4a 100644 --- a/Private/Source/Utils.cxx +++ b/Private/Source/Utils.cxx @@ -169,10 +169,15 @@ char *rt_string_frofchar(char *str, const char chr) { } } // namespace NewOS -extern "C" void memset(void *dst, char src, size_t len) { +EXTERN_C void memset(void *dst, char src, size_t len) { NewOS::rt_set_memory(dst, src, len); } -extern "C" void memcpy(void *dst, void *src, size_t len) { +EXTERN_C void memcpy(void *dst, void *src, size_t len) { NewOS::rt_copy_memory(src, dst, len); } + +/// @brief strlen definition in C++. +EXTERN_C size_t strlen(const char *whatToCheck) { + return NewOS::rt_string_len(whatToCheck); +} |
