summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Private/NewBoot/Source')
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/BootATA.cxx11
-rw-r--r--Private/NewBoot/Source/HEL/AMD64/Support.cxx14
-rw-r--r--Private/NewBoot/Source/HEL/POWER/BootEPM.cxx118
-rw-r--r--Private/NewBoot/Source/HEL/POWER/CoreBootStartup.S (renamed from Private/NewBoot/Source/HEL/POWER/BootCoreBoot.S)2
-rw-r--r--Private/NewBoot/Source/makefile5
5 files changed, 26 insertions, 124 deletions
diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
index d3573064..10d4272d 100644
--- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx
@@ -25,7 +25,7 @@
static Boolean kATADetected = false;
static Int32 kATADeviceType = kATADeviceCount;
-static CharacterTypeUTF8 kATAData[kATADataLen] = {0};
+static UInt16 kATAData[kATADataLen] = {0};
Boolean boot_ata_detected(Void);
@@ -82,8 +82,6 @@ ATAInit_Retry:
Out8(IO + ATA_REG_COMMAND, ATA_CMD_IDENTIFY);
- BSetMem(kATAData, 0, kATADataLen);
-
/// fetch serial info
/// model, speed, number of sectors...
@@ -269,3 +267,10 @@ BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, const SizeT& SectorS
* @return BootDeviceATA::ATATrait& the drive config.
*/
BootDeviceATA::ATATrait& BootDeviceATA::Leak() { return mTrait; }
+
+/***
+ @brief Getter, gets the number of sectors inside the drive.
+*/
+SizeT BootDeviceATA::GetSectorsCount() noexcept {
+ return kATAData[60] + kATAData[61];
+}
diff --git a/Private/NewBoot/Source/HEL/AMD64/Support.cxx b/Private/NewBoot/Source/HEL/AMD64/Support.cxx
index c6b62630..0508d491 100644
--- a/Private/NewBoot/Source/HEL/AMD64/Support.cxx
+++ b/Private/NewBoot/Source/HEL/AMD64/Support.cxx
@@ -28,5 +28,19 @@ EXTERN_C VoidPtr memcpy(void *dst, const void *src,
return dst;
}
+/// @brief strlen definition in C++.
+EXTERN_C size_t strlen(const char *whatToCheck) {
+ if (!whatToCheck || *whatToCheck == 0) return 0;
+
+ SizeT len = 0;
+
+ while (whatToCheck[len] != 0) {
+ ++len;
+ }
+
+ return len;
+}
+
+
/// @brief somthing specific to the microsoft ABI, regarding checking the stack.
EXTERN_C void ___chkstk_ms(void) {}
diff --git a/Private/NewBoot/Source/HEL/POWER/BootEPM.cxx b/Private/NewBoot/Source/HEL/POWER/BootEPM.cxx
deleted file mode 100644
index 72276ef9..00000000
--- a/Private/NewBoot/Source/HEL/POWER/BootEPM.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#include <BootKit/BootKit.hxx>
-#include <FSKit/NewFS.hxx>
-
-#define kEPMSectorSize (1024U)
-#define kEPMSwapSize MIB(16)
-
-// {310E1FC7-2060-425D-BE7B-75A37CC679BC}
-STATIC const BlockGUID kEPMGuid = {
- 0x310e1fc7,
- 0x2060,
- 0x425d,
- {0xbe, 0x7b, 0x75, 0xa3, 0x7c, 0xc6, 0x79, 0xbc}};
-
-/// @brief Write epm partition to disk.
-/// @param namePart partition name
-/// @param namePartLength length of name
-/// @param bootDev disk interface.
-/// @return
-EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLength,
- BootDevice* bootDev) {
- if (namePartLength > kEPMNameLength || !namePart) return No;
- if (!bootDev) return No;
-
- bootDev->Leak().mBase = kEPMStartPartitionBlk;
- bootDev->Leak().mSize = kEPMSectorSize;
-
- Char buf[kEPMSectorSize] = {0};
-
- bootDev->Read(buf, 1);
-
- BTextWriter writer;
-
- writer.Write(L"NewBoot: Checking for an EPM partition...\r\n");
-
- for (SizeT index = 0; index < kEPMMagicLength; ++index) {
- if (buf[index] != kEPMMagic[index]) {
- writer.Write(L"NewBoot: Writing an EPM partition...\r\n");
-
- BootBlockType* bootBlock = (BootBlockType*)buf;
-
- bootBlock->Version = kEPMRevision;
- bootBlock->NumBlocks = 2;
-
- for (SizeT i = 0; i < kEPMNameLength; ++i) {
- bootBlock->Magic[i] = kEPMMagic[i];
- }
-
- for (SizeT i = 0; i < namePartLength; ++i) {
- bootBlock->Name[i] = namePart[i];
- }
-
- bootBlock->LbaStart =
- sizeof(BootBlockType) + (sizeof(PartitionBlockType) * kEPMMaxBlks);
-
- bootBlock->SectorSz = kEPMSectorSize;
-
- bootBlock->Uuid = kEPMGuid;
-
- PartitionBlock* partBlock = (PartitionBlock*)(buf + sizeof(BootBlock));
-
- char* fsName = "NewFS";
- int fsNameLength = 6;
-
- for (SizeT i = 0; i < fsNameLength; ++i) {
- partBlock->Fs[i] = fsName[i];
- }
-
- partBlock->Version = kEPMNewOS;
-
- char* partName = "System HD";
- int partNameLength = 10;
-
- for (SizeT i = 0; i < partNameLength; ++i) {
- partBlock->Name[i] = partName[i];
- }
-
- partBlock->SectorSz = kEPMSectorSize;
- partBlock->LbaStart = kEPMStartPartitionBlk + kEPMSwapSize;
- partBlock->Version = kNewFSVersionInteger;
- partBlock->Kind = kNewFSPartitionTypeStandard;
- partBlock->LbaEnd = 0UL; ///! grows on the disk.
-
- PartitionBlock* swapBlock = (PartitionBlock*)(buf + sizeof(BootBlock) + sizeof(PartitionBlock));
-
- for (SizeT i = 0; i < fsNameLength; ++i) {
- swapBlock->Fs[i] = fsName[i];
- }
-
- swapBlock->Version = kEPMNewOS;
-
- partName = "Swap HD";
- partNameLength = 8;
-
- for (SizeT i = 0; i < partNameLength; ++i) {
- swapBlock->Name[i] = partName[i];
- }
-
- swapBlock->SectorSz = kEPMSectorSize;
- swapBlock->LbaStart = kEPMStartPartitionBlk;
- swapBlock->Version = kNewFSVersionInteger;
- swapBlock->Kind = kNewFSPartitionTypePage;
- swapBlock->LbaEnd = kEPMSwapSize; /// 4 MIB swap partition.
-
- bootDev->Write(buf, 1);
-
- return No;
- }
- }
-
- writer.Write(L"NewBoot: Partition found, everything's OK.\r\n");
- return Yes;
-}
diff --git a/Private/NewBoot/Source/HEL/POWER/BootCoreBoot.S b/Private/NewBoot/Source/HEL/POWER/CoreBootStartup.S
index c611467d..41fc6ae2 100644
--- a/Private/NewBoot/Source/HEL/POWER/BootCoreBoot.S
+++ b/Private/NewBoot/Source/HEL/POWER/CoreBootStartup.S
@@ -10,7 +10,7 @@
/* NewBoot boot header begin */
boot_hdr_mag:
- .ascii "LX"
+ .ascii "CB"
boot_hdr_name:
// it has to match ten bytes.
.asciz "NewBoot\0\0\0"
diff --git a/Private/NewBoot/Source/makefile b/Private/NewBoot/Source/makefile
index 11c1da75..7ed42abd 100644
--- a/Private/NewBoot/Source/makefile
+++ b/Private/NewBoot/Source/makefile
@@ -51,6 +51,7 @@ all: compile-amd64
$(DD) if=$(KERNEL_OBJ) of=$(BOOT_LOADER) bs=1 seek=0 conv=notrunc
$(COPY) $(BOOT_LOADER) CDROM/EFI/BOOT/BOOTX64.EFI
$(COPY) $(BOOT_LOADER) CDROM/EFI/BOOT/NEWBOOT.EFI
+ $(COPY) ../../$(KERNEL) CDROM/$(KERNEL)
$(COPY) $(BOOT_LOADER) ../../Root/Boot/$(BOOT_LOADER)
ifneq ($(DEBUG_SUPPORT), )
@@ -68,8 +69,8 @@ run-efi-amd64:
.PHONY: epm-img
epm-img:
- qemu-img create -f raw $(IMG) 256M
- qemu-img create -f raw $(IMG_2) 512M
+ qemu-img create -f qcow2 $(IMG) 256M
+ qemu-img create -f qcow2 $(IMG_2) 512M
.PHONY: download-edk
download-edk: