diff options
| -rw-r--r-- | Private/NewBoot/Source/CDROM/.NEWDEV (renamed from Private/NewBoot/Source/CDROM/.HCORE) | 0 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx | 4 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 24 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx | 15 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/PowerPC/.gitkeep | 0 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/PowerPC/BootPowerPC.S | 22 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/RISCV/BootRISCV.S | 22 | ||||
| -rw-r--r-- | Private/NewBoot/Source/makefile | 4 |
8 files changed, 76 insertions, 15 deletions
diff --git a/Private/NewBoot/Source/CDROM/.HCORE b/Private/NewBoot/Source/CDROM/.NEWDEV index d5d2badf..d5d2badf 100644 --- a/Private/NewBoot/Source/CDROM/.HCORE +++ b/Private/NewBoot/Source/CDROM/.NEWDEV diff --git a/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx b/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx index 29fd596d..d3022339 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx @@ -18,12 +18,10 @@ EXTERN_C Boolean boot_write_newos_partition(BootDeviceATA* ataInterface) { Char newOSHeader[kATASectorSize] = { /// signature of our system partition. - 'N', 'e', 'w', '!', + 'N', 'e', 'w', 'O', 'S', /// version of our os partition (Char)0x10, - /// to retrieve the header size add these two fileds. (divided into parts.) - /// header size (pt 1) (Char)0x100, /// header size (pt 2) diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index 88ad1e32..599a533f 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -17,8 +17,6 @@ #define kMaxBufSize 256 -EXTERN_C void Main(HEL::HandoverInformationHeader* handoverInfo); - /// @brief Bootloader main type. typedef void (*bt_main_type)(HEL::HandoverInformationHeader* handoverInfo); @@ -44,6 +42,7 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, BootDeviceATA ataDrv; Boolean isIniNotFound = No; +#ifndef __DEBUG__ /// if ATA drive is initialized and EFI vendor supports an EPM scheme. /// @EDK tells our OS that it supports EPM scheme as well. if (ataDrv && @@ -51,16 +50,26 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, Char namePart[kEPMNameLength] = {"BootBlock"}; /// tries to read an EPM block, or writes one if it fails. - bool isIniNotFound = + isIniNotFound = boot_write_epm_partition(namePart, kEPMNameLength, &ataDrv); } else if (SystemTable->FirmwareVendor[0] != '@') { - writer.Write(L"This firmware can't understand NewOS, please use Mahrouss Logic products instead\r\nOur website: www.el-mahrouss-logic.com\r\n"); + writer.Write(L"NewBoot.exe: This firmware can't understand NewOS, please use Mahrouss Logic products instead\r\nNewBoot.exe: Our website: www.el-mahrouss-logic.com\r\n"); + return kEfiFail; + } else if (!ataDrv) { + writer.Write(L"NewBoot.exe: This computer can't work with NewOS, please use Mahrouss Logic products instead\r\nNewBoot.exe: Our website: www.el-mahrouss-logic.com\r\n"); return kEfiFail; } +#else + Char namePart[kEPMNameLength] = {"BootBlock"}; + + /// tries to read an EPM block, or writes one if it fails. + isIniNotFound = + boot_write_epm_partition(namePart, kEPMNameLength, &ataDrv); +#endif // !__DEBUG__ /// Read Kernel blob. - BFileReader kernelImg(L".HCORE", ImageHandle); + BFileReader kernelImg(L".NEWDEV", ImageHandle); kernelImg.Size(kMaxBufSize); kernelImg.ReadAll(); @@ -160,11 +169,6 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, if (!isIniNotFound) { writer.Write(L"NewBoot.exe: No partition found for NewOS. (HCR-1000)\r\n"); - writer.Write(L"NewBoot.exe: Running setup for NewOS...\r\n"); - - EFI::ExitBootServices(MapKey, ImageHandle); - - Main(handoverHdrPtr); } else { handoverHdrPtr->f_Magic = kHandoverMagic; handoverHdrPtr->f_Version = kHandoverVersion; diff --git a/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx b/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx new file mode 100644 index 00000000..08a6979f --- /dev/null +++ b/Private/NewBoot/Source/HEL/AMD64/BootPlatform.cxx @@ -0,0 +1,15 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +extern "C" void rt_halt() { asm volatile("hlt"); } + +extern "C" void rt_cli() { asm volatile("cli"); } + +extern "C" void rt_sti() { asm volatile("sti"); } + +extern "C" void rt_cld() { asm volatile("cld"); } + +extern "C" void rt_std() { asm volatile("std"); }
\ No newline at end of file diff --git a/Private/NewBoot/Source/HEL/PowerPC/.gitkeep b/Private/NewBoot/Source/HEL/PowerPC/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Private/NewBoot/Source/HEL/PowerPC/.gitkeep diff --git a/Private/NewBoot/Source/HEL/PowerPC/BootPowerPC.S b/Private/NewBoot/Source/HEL/PowerPC/BootPowerPC.S new file mode 100644 index 00000000..87b87bab --- /dev/null +++ b/Private/NewBoot/Source/HEL/PowerPC/BootPowerPC.S @@ -0,0 +1,22 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +.section .init +.align 4 + +/* NewOS kernel header begin */ + +k_hdr_mag: + .ascii "LX" +k_hdr_name: + // it has to match ten bytes. + .asciz "New OS\0\0\0\0" +k_hdr_ver: + .word 0x104 +k_hdr_proc: + .long __bootloader_start + +/* end */
\ No newline at end of file diff --git a/Private/NewBoot/Source/HEL/RISCV/BootRISCV.S b/Private/NewBoot/Source/HEL/RISCV/BootRISCV.S new file mode 100644 index 00000000..87b87bab --- /dev/null +++ b/Private/NewBoot/Source/HEL/RISCV/BootRISCV.S @@ -0,0 +1,22 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +.section .init +.align 4 + +/* NewOS kernel header begin */ + +k_hdr_mag: + .ascii "LX" +k_hdr_name: + // it has to match ten bytes. + .asciz "New OS\0\0\0\0" +k_hdr_ver: + .word 0x104 +k_hdr_proc: + .long __bootloader_start + +/* end */
\ No newline at end of file diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile index af35a110..a3807a6d 100644 --- a/Private/NewBoot/Source/makefile +++ b/Private/NewBoot/Source/makefile @@ -20,7 +20,7 @@ IMG=epm.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 LD_FLAGS=-e efi_main --subsystem=10 -OBJ=$(wildcard *.o) $(wildcard ../../Objects/*.obj) $(wildcard HEL/AMD64/*.obj) +OBJ=$(wildcard *.o) $(wildcard HEL/AMD64/*.obj) REM=rm REM_FLAG=-f @@ -40,7 +40,7 @@ bootloader-amd64: compile-amd64 .PHONY: compile-amd64 compile-amd64: - $(CC_GNU) $(FLAG_GNU) $(wildcard HEL/AMD64/*.cxx) $(wildcard *.cxx) + $(CC_GNU) $(FLAG_GNU) $(DEBUG) $(wildcard HEL/AMD64/*.cxx) $(wildcard *.cxx) .PHONY: run-efi-amd64 run-efi-amd64: |
