summaryrefslogtreecommitdiffhomepage
path: root/dev/boot
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-11 13:04:22 +0200
committerGitHub <noreply@github.com>2025-05-11 13:04:22 +0200
commit57d040e3e6b6d0257c0ba5a914396520b18d9d87 (patch)
tree78be4974d8a24e983034b0962ac5435f1b1d0b53 /dev/boot
parent7690c1976b3127e17370708aef47ba3f18f3b8c2 (diff)
parentf775566da3cf4f8e3ffd4ca6dfe0a3c7776c3b35 (diff)
Merge pull request #30 from nekernel-org/dev0.0.2e2
0.0.2e2
Diffstat (limited to 'dev/boot')
-rw-r--r--dev/boot/BootKit/BootKit.h9
-rw-r--r--dev/boot/BootKit/HW/SATA.h8
-rw-r--r--dev/boot/amd64-desktop.make2
-rw-r--r--dev/boot/src/BootString.cc2
-rw-r--r--dev/boot/src/HEL/AMD64/BootATA+Next.cc8
-rw-r--r--dev/boot/src/HEL/AMD64/BootATA.cc8
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc9
-rw-r--r--dev/boot/src/HEL/AMD64/BootSATA.cc4
-rw-r--r--dev/boot/src/docs/KERN_VER.md2
9 files changed, 24 insertions, 28 deletions
diff --git a/dev/boot/BootKit/BootKit.h b/dev/boot/BootKit/BootKit.h
index 181be973..cc80e359 100644
--- a/dev/boot/BootKit/BootKit.h
+++ b/dev/boot/BootKit/BootKit.h
@@ -40,7 +40,7 @@
/***********************************************************************************/
namespace Boot {
-EXTERN void ThrowError(const WideChar* errorCode, const WideChar* reason) noexcept;
+void ThrowError(const WideChar* errorCode, const WideChar* reason) noexcept;
class BootTextWriter;
class BootFileReader;
@@ -51,7 +51,8 @@ typedef Char* PEFImagePtr;
typedef Char* PEImagePtr;
typedef WideChar CharacterTypeUTF16;
-typedef Char CharacterTypeUTF8;
+typedef Char CharacterTypeASCII;
+typedef char8_t CharacterTypeUTF8;
using namespace Kernel;
@@ -86,7 +87,7 @@ class BootTextWriter final {
Kernel::SizeT BCopyMem(CharacterTypeUTF16* dest, CharacterTypeUTF16* src, const Kernel::SizeT len);
-Kernel::SizeT BSetMem(CharacterTypeUTF8* src, const CharacterTypeUTF8 byte,
+Kernel::SizeT BSetMem(CharacterTypeASCII* src, const CharacterTypeASCII byte,
const Kernel::SizeT len);
/// String length functions.
@@ -151,7 +152,7 @@ typedef UInt8* BlobType;
/// @brief Bootloader Version String.
class BVersionString final {
public:
- static const CharacterTypeUTF8* The() { return BOOTLOADER_VERSION; }
+ static const CharacterTypeASCII* The() { return BOOTLOADER_VERSION; }
};
/***********************************************************************************/
diff --git a/dev/boot/BootKit/HW/SATA.h b/dev/boot/BootKit/HW/SATA.h
index 8cf48ec7..eecf426d 100644
--- a/dev/boot/BootKit/HW/SATA.h
+++ b/dev/boot/BootKit/HW/SATA.h
@@ -10,6 +10,8 @@
#include <CompilerKit/CompilerKit.h>
#include <modules/AHCI/AHCI.h>
+#define kAHCISectorSz (4096)
+
class BootDeviceSATA final {
public:
explicit BootDeviceSATA() noexcept;
@@ -32,13 +34,11 @@ class BootDeviceSATA final {
constexpr static auto kSectorSize = kAHCISectorSize;
- BootDeviceSATA& Read(Boot::CharacterTypeUTF8* Buf, const Kernel::SizeT SecCount);
- BootDeviceSATA& Write(Boot::CharacterTypeUTF8* Buf, const Kernel::SizeT SecCount);
+ BootDeviceSATA& Read(Boot::CharacterTypeASCII* Buf, const Kernel::SizeT SecCount);
+ BootDeviceSATA& Write(Boot::CharacterTypeASCII* Buf, const Kernel::SizeT SecCount);
SATATrait& Leak();
private:
SATATrait mTrait;
};
-
-#define kAHCISectorSz 4096
diff --git a/dev/boot/amd64-desktop.make b/dev/boot/amd64-desktop.make
index 8b2aa760..c660df87 100644
--- a/dev/boot/amd64-desktop.make
+++ b/dev/boot/amd64-desktop.make
@@ -131,7 +131,7 @@ run-efi-amd64-ata: run-efi-amd64-ata-dma
# img_2 is the rescue disk. img is the bootable disk, as provided by the NeKernel specs.
.PHONY: epm-img
epm-img:
- qemu-img create -f raw $(IMG) 1G
+ qemu-img create -f raw $(IMG) 8G
.PHONY: efi
efi:
diff --git a/dev/boot/src/BootString.cc b/dev/boot/src/BootString.cc
index 8762a151..277f3273 100644
--- a/dev/boot/src/BootString.cc
+++ b/dev/boot/src/BootString.cc
@@ -62,7 +62,7 @@ Kernel::SizeT Boot::BSetMem(CharacterTypeUTF16* src, const CharacterTypeUTF16 by
return cnt;
}
-Kernel::SizeT Boot::BSetMem(CharacterTypeUTF8* src, const CharacterTypeUTF8 byte,
+Kernel::SizeT Boot::BSetMem(CharacterTypeASCII* src, const CharacterTypeASCII byte,
const Kernel::SizeT len) {
if (!src) return 0;
diff --git a/dev/boot/src/HEL/AMD64/BootATA+Next.cc b/dev/boot/src/HEL/AMD64/BootATA+Next.cc
index 723224c1..547d4f99 100644
--- a/dev/boot/src/HEL/AMD64/BootATA+Next.cc
+++ b/dev/boot/src/HEL/AMD64/BootATA+Next.cc
@@ -103,7 +103,7 @@ ATAInit_Retry:
return true;
}
-Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz,
+Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz,
SizeT Size) {
Lba /= SectorSz;
@@ -136,7 +136,7 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
}
}
-Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz,
+Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz,
SizeT Size) {
Lba /= SectorSz;
@@ -208,7 +208,7 @@ BootDeviceATA::operator bool() {
@param Sz Sector size
@param Buf buffer
*/
-BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+BootDeviceATA& BootDeviceATA::Read(CharacterTypeASCII* Buf, SizeT SectorSz) {
if (!boot_ata_detected()) {
Leak().mErr = true;
return *this;
@@ -229,7 +229,7 @@ BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
@param Sz Sector size
@param Buf buffer
*/
-BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+BootDeviceATA& BootDeviceATA::Write(CharacterTypeASCII* Buf, SizeT SectorSz) {
if (!boot_ata_detected()) {
Leak().mErr = true;
return *this;
diff --git a/dev/boot/src/HEL/AMD64/BootATA.cc b/dev/boot/src/HEL/AMD64/BootATA.cc
index 0fd46832..e1ccbfc3 100644
--- a/dev/boot/src/HEL/AMD64/BootATA.cc
+++ b/dev/boot/src/HEL/AMD64/BootATA.cc
@@ -101,7 +101,7 @@ ATAInit_Retry:
return NO;
}
-Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz,
+Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz,
SizeT Size) {
Lba /= SectorSz;
@@ -130,7 +130,7 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
}
}
-Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz,
+Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeASCII* Buf, SizeT SectorSz,
SizeT Size) {
Lba /= SectorSz;
@@ -196,7 +196,7 @@ BootDeviceATA::operator bool() {
@param Sz Sector size
@param Buf buffer
*/
-BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+BootDeviceATA& BootDeviceATA::Read(CharacterTypeASCII* Buf, SizeT SectorSz) {
if (!boot_ata_detected()) {
Leak().mErr = true;
return *this;
@@ -217,7 +217,7 @@ BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
@param Sz Sector size
@param Buf buffer
*/
-BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+BootDeviceATA& BootDeviceATA::Write(CharacterTypeASCII* Buf, SizeT SectorSz) {
if (!boot_ata_detected()) {
Leak().mErr = true;
return *this;
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 260d7c00..dbc12265 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -17,11 +17,6 @@
#include <modules/CoreGfx/CoreGfx.h>
#include <modules/CoreGfx/TextGfx.h>
-// Makes the compiler shut up.
-#ifndef kMachineModel
-#define kMachineModel "OS"
-#endif // !kMachineModel
-
/** Graphics related. */
STATIC EfiGraphicsOutputProtocol* kGop = nullptr;
@@ -136,14 +131,14 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
Int32 trials = 5 * 10000000;
writer.Write("BootZ: Welcome to BootZ.\r");
- writer.Write("BootZ: Allocating sufficent memory, trying 4GB...\r");
+ writer.Write("BootZ: Allocating sufficient memory, trying 4GB...\r");
while (BS->AllocatePool(EfiLoaderData, handover_hdr->f_BitMapSize,
&handover_hdr->f_BitMapStart) != kEfiOk) {
--trials;
if (!trials) {
- writer.Write("BootZ: Unable to allocate sufficent memory, trying again with 2GB...\r");
+ writer.Write("BootZ: Unable to allocate sufficient memory, trying again with 2GB...\r");
trials = 3 * 10000000;
diff --git a/dev/boot/src/HEL/AMD64/BootSATA.cc b/dev/boot/src/HEL/AMD64/BootSATA.cc
index 2b1bc78e..b0b0b52f 100644
--- a/dev/boot/src/HEL/AMD64/BootSATA.cc
+++ b/dev/boot/src/HEL/AMD64/BootSATA.cc
@@ -48,7 +48,7 @@ BootDeviceSATA::BootDeviceSATA() noexcept {
@param Sz Sector size
@param Buf buffer
*/
-BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeASCII* Buf, SizeT SectorSz) {
NE_UNUSED(Buf);
NE_UNUSED(SectorSz);
@@ -62,7 +62,7 @@ BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
@param Sz Sector size
@param Buf buffer
*/
-BootDeviceSATA& BootDeviceSATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+BootDeviceSATA& BootDeviceSATA::Write(CharacterTypeASCII* Buf, SizeT SectorSz) {
NE_UNUSED(Buf);
NE_UNUSED(SectorSz);
diff --git a/dev/boot/src/docs/KERN_VER.md b/dev/boot/src/docs/KERN_VER.md
index abe3e823..cabdb1d2 100644
--- a/dev/boot/src/docs/KERN_VER.md
+++ b/dev/boot/src/docs/KERN_VER.md
@@ -1,4 +1,4 @@
-# /props/kern_ver
+# The `/props/kern_ver` NVRAM variable
The `/props/kern_ver` variable is used to track NeKernel's current version in a BCD format.