summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/BootKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-22 03:47:51 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-22 03:47:51 +0100
commitbc9b63a3dbc63d818e90237beb019f584acfe133 (patch)
tree8c95e0dbfbbe5fce9ca8e10f6ce9b84236fa756c /Private/NewBoot/BootKit
parent6f1aa4288c62580afb876fb9e35a45d022027d1d (diff)
NewBoot: Working ATA driver, and new drive scheme, each data has a
padding of 1 byte. Example: { "H", "\0", "e", "\0", "y" } So that the drive doesnt skip any bytes. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/NewBoot/BootKit')
-rw-r--r--Private/NewBoot/BootKit/Arch/ATA.hxx5
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx27
2 files changed, 21 insertions, 11 deletions
diff --git a/Private/NewBoot/BootKit/Arch/ATA.hxx b/Private/NewBoot/BootKit/Arch/ATA.hxx
index 5493b29f..8cd948a3 100644
--- a/Private/NewBoot/BootKit/Arch/ATA.hxx
+++ b/Private/NewBoot/BootKit/Arch/ATA.hxx
@@ -22,6 +22,7 @@ class BDeviceATA final {
struct ATATrait final {
SizeT mBase{1024};
+ SizeT mSize{1024};
UInt16 mBus{kPrimary};
UInt8 mMaster{0};
Boolean mErr{false};
@@ -31,8 +32,8 @@ class BDeviceATA final {
operator bool();
- BDeviceATA& Read(WideChar* Buf, const SizeT& SecCount);
- BDeviceATA& Write(WideChar* Buf, const SizeT& SecCount);
+ BDeviceATA& Read(Char* Buf, const SizeT& SecCount);
+ BDeviceATA& Write(Char* Buf, const SizeT& SecCount);
ATATrait& Leak();
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 31acff3f..7a393e2a 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -20,6 +20,7 @@ class BVersionString;
#include <CompilerKit/Version.hxx>
#include <FirmwareKit/EFI.hxx>
#include <NewKit/Defines.hpp>
+#include <FirmwareKit/EPM.hxx>
using namespace HCore;
@@ -32,7 +33,8 @@ enum {
kSegmentBss = 6,
};
-typedef WideChar CharacterType;
+typedef WideChar CharacterTypeUTF16;
+typedef Char CharacterTypeUTF8;
/**
* @brief BootKit Text Writer class
@@ -43,8 +45,8 @@ class BTextWriter final {
public:
BTextWriter &Write(const Long &num);
BTextWriter &Write(const UChar *str);
- BTextWriter &Write(const CharacterType *str);
- BTextWriter &WriteCharacter(CharacterType c);
+ BTextWriter &Write(const CharacterTypeUTF16 *str);
+ BTextWriter &WriteCharacter(CharacterTypeUTF16 c);
public:
explicit BTextWriter() = default;
@@ -55,10 +57,17 @@ class BTextWriter final {
BTextWriter(const BTextWriter &) = default;
};
-HCore::SizeT BCopyMem(CharacterType *dest, CharacterType *src,
+HCore::SizeT BCopyMem(CharacterTypeUTF16 *dest, CharacterTypeUTF16 *src,
const HCore::SizeT len);
-HCore::SizeT BStrLen(const CharacterType *ptr);
-HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte,
+
+HCore::SizeT BSetMem(CharacterTypeUTF8 *src, const CharacterTypeUTF8 byte,
+ const HCore::SizeT len);
+
+/// String length functions.
+
+HCore::SizeT BStrLen(const CharacterTypeUTF16 *ptr);
+
+HCore::SizeT BSetMem(CharacterTypeUTF16 *src, const CharacterTypeUTF16 byte,
const HCore::SizeT len);
/**
@@ -67,7 +76,7 @@ HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte,
*/
class BFileReader final {
public:
- explicit BFileReader(const CharacterType *path, EfiHandlePtr ImageHandle);
+ explicit BFileReader(const CharacterTypeUTF16 *path, EfiHandlePtr ImageHandle);
~BFileReader();
Void ReadAll();
@@ -98,7 +107,7 @@ class BFileReader final {
private:
Int32 mErrorCode{kOperationOkay};
VoidPtr mBlob{nullptr};
- CharacterType mPath[kPathLen];
+ CharacterTypeUTF16 mPath[kPathLen];
BTextWriter mWriter;
EfiFileProtocol *mFile{nullptr};
UInt64 mSizeFile{0};
@@ -193,5 +202,5 @@ inline Void InitGOP() noexcept {
class BVersionString final {
public:
- static const CharacterType *Shared() { return BOOTLOADER_VERSION; }
+ static const CharacterTypeUTF16 *Shared() { return BOOTLOADER_VERSION; }
};