summaryrefslogtreecommitdiffhomepage
path: root/Boot
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-05-23 07:53:50 +0000
committerAmlal <amlalelmahrouss@icloud.com>2024-05-23 07:53:50 +0000
commitf5081a8f9a8537ad5be5d639955cd1d0e68a9e1d (patch)
treec9305701aa2d4ee0235c85c67cd6633e5763ec21 /Boot
parentca675beb41dba8d7d16c5793b55d1672f38be3b4 (diff)
parent06b1a4bb12b4043b606d8bb0d55942d636c6833e (diff)
Merged in MHR-23 (pull request #13)
MHR-23
Diffstat (limited to 'Boot')
-rw-r--r--Boot/BootKit/BitManip.hxx2
-rw-r--r--Boot/BootKit/BootKit.hxx4
-rw-r--r--Boot/BootKit/Device.hxx2
-rw-r--r--Boot/BootKit/EPM.hxx2
-rw-r--r--Boot/BootKit/HW/ATA.hxx2
-rw-r--r--Boot/BootKit/HW/SATA.hxx2
-rw-r--r--Boot/BootKit/Platform.hxx6
-rw-r--r--Boot/BootKit/Protocol.hxx2
-rw-r--r--Boot/BootKit/Vendor/Qr.hxx14
-rw-r--r--Boot/BootKit/Vendor/QrVendor/bit.h247
-rw-r--r--Boot/BootKit/Vendor/Shared/base.h (renamed from Boot/BootKit/Vendor/QrVendor/base.h)12
-rw-r--r--Boot/BootKit/Vendor/Shared/bit.h247
-rw-r--r--Boot/BootKit/Vendor/Support.hxx25
-rw-r--r--Boot/Sources/.gitkeep (renamed from Boot/Source/.gitkeep)0
-rw-r--r--Boot/Sources/BootloaderRsrc.rsrc (renamed from Boot/Source/BootloaderRsrc.rsrc)0
-rw-r--r--Boot/Sources/HEL/AMD64/.gitkeep (renamed from Boot/Source/HEL/AMD64/.gitkeep)0
-rw-r--r--Boot/Sources/HEL/AMD64/BootAHCI.cxx (renamed from Boot/Source/HEL/AMD64/BootAHCI.cxx)2
-rw-r--r--Boot/Sources/HEL/AMD64/BootATA.cxx (renamed from Boot/Source/HEL/AMD64/BootATA.cxx)16
-rw-r--r--Boot/Sources/HEL/AMD64/BootFileReader.cxx (renamed from Boot/Source/HEL/AMD64/BootFileReader.cxx)14
-rw-r--r--Boot/Sources/HEL/AMD64/BootJump.S (renamed from Boot/Source/HEL/AMD64/BootJump.S)0
-rw-r--r--Boot/Sources/HEL/AMD64/BootMain.cxx (renamed from Boot/Source/HEL/AMD64/BootMain.cxx)4
-rw-r--r--Boot/Sources/HEL/AMD64/BootPlatform.cxx (renamed from Boot/Source/HEL/AMD64/BootPlatform.cxx)2
-rw-r--r--Boot/Sources/HEL/AMD64/BootString.cxx (renamed from Boot/Source/HEL/AMD64/BootString.cxx)8
-rw-r--r--Boot/Sources/HEL/AMD64/BootTextWriter.cxx (renamed from Boot/Source/HEL/AMD64/BootTextWriter.cxx)8
-rw-r--r--Boot/Sources/HEL/AMD64/New+Delete.cxx (renamed from Boot/Source/HEL/AMD64/New+Delete.cxx)2
-rw-r--r--Boot/Sources/HEL/AMD64/Support.cxx (renamed from Boot/Source/HEL/AMD64/Support.cxx)2
-rw-r--r--Boot/Sources/HEL/AMD64/compile_flags.txt (renamed from Boot/Source/HEL/AMD64/compile_flags.txt)0
-rw-r--r--Boot/Sources/HEL/ARM64/.gitkeep (renamed from Boot/Source/HEL/ARM64/.gitkeep)0
-rw-r--r--Boot/Sources/HEL/POWER/.gitkeep (renamed from Boot/Source/HEL/POWER/.gitkeep)0
-rw-r--r--Boot/Sources/HEL/POWER/CoreBootStartup.S (renamed from Boot/Source/HEL/POWER/CoreBootStartup.S)0
-rw-r--r--Boot/Sources/HEL/RISCV/.gitkeep (renamed from Boot/Source/HEL/RISCV/.gitkeep)0
-rw-r--r--Boot/Sources/HEL/RISCV/BootRISCV.S (renamed from Boot/Source/HEL/RISCV/BootRISCV.S)0
-rw-r--r--Boot/Sources/Root/EFI/STARTUP.NSH (renamed from Boot/Source/Root/EFI/STARTUP.NSH)0
-rw-r--r--Boot/Sources/Root/SplashScreen.fmt (renamed from Boot/Source/Root/SplashScreen.fmt)0
-rw-r--r--Boot/Sources/compile_flags.txt (renamed from Boot/Source/compile_flags.txt)0
-rw-r--r--Boot/Sources/ovmf.ps1 (renamed from Boot/Source/ovmf.ps1)0
-rw-r--r--Boot/makefile30
37 files changed, 330 insertions, 325 deletions
diff --git a/Boot/BootKit/BitManip.hxx b/Boot/BootKit/BitManip.hxx
index bf46e75c..cef6c875 100644
--- a/Boot/BootKit/BitManip.hxx
+++ b/Boot/BootKit/BitManip.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/BootKit/BootKit.hxx b/Boot/BootKit/BootKit.hxx
index 179ca141..961137ca 100644
--- a/Boot/BootKit/BootKit.hxx
+++ b/Boot/BootKit/BootKit.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
@@ -360,7 +360,7 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const char* partName,
fDiskDev.Write(buf, sectorSz);
BTextWriter writer;
- writer.Write(L"New Boot: Write-Partition, OK.\r");
+ writer.Write(L"New Boot: Write-Partition: OK.\r");
return true;
}
diff --git a/Boot/BootKit/Device.hxx b/Boot/BootKit/Device.hxx
index 3bdc2829..215c10b6 100644
--- a/Boot/BootKit/Device.hxx
+++ b/Boot/BootKit/Device.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/BootKit/EPM.hxx b/Boot/BootKit/EPM.hxx
index 0df86724..0cefad5d 100644
--- a/Boot/BootKit/EPM.hxx
+++ b/Boot/BootKit/EPM.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/BootKit/HW/ATA.hxx b/Boot/BootKit/HW/ATA.hxx
index 8f06739b..d9b251f5 100644
--- a/Boot/BootKit/HW/ATA.hxx
+++ b/Boot/BootKit/HW/ATA.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/BootKit/HW/SATA.hxx b/Boot/BootKit/HW/SATA.hxx
index 1ad87493..bbb65ec0 100644
--- a/Boot/BootKit/HW/SATA.hxx
+++ b/Boot/BootKit/HW/SATA.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/BootKit/Platform.hxx b/Boot/BootKit/Platform.hxx
index 972430ce..14a1fa54 100644
--- a/Boot/BootKit/Platform.hxx
+++ b/Boot/BootKit/Platform.hxx
@@ -1,14 +1,14 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
#pragma once
/**
- @file Processor.hxx
- @brief Processor specific code.
+ @file Processor.hxx
+ @brief Processor specific code.
*/
#ifdef __x86_64__
diff --git a/Boot/BootKit/Protocol.hxx b/Boot/BootKit/Protocol.hxx
index 95a5ca6f..3d9fd9f8 100644
--- a/Boot/BootKit/Protocol.hxx
+++ b/Boot/BootKit/Protocol.hxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/BootKit/Vendor/Qr.hxx b/Boot/BootKit/Vendor/Qr.hxx
index 1df0bdaf..3bafc09f 100644
--- a/Boot/BootKit/Vendor/Qr.hxx
+++ b/Boot/BootKit/Vendor/Qr.hxx
@@ -5,14 +5,16 @@
#include <stddef.h>
#include <stdint.h>
-#include <BootKit/Vendor/QrVendor/base.h>
-#include <BootKit/Vendor/QrVendor/bit.h>
+#include <BootKit/Vendor/Shared/base.h>
+#include <BootKit/Vendor/Shared/bit.h>
#include <BootKit/Vendor/QrPrelude.hxx>
#include <Builtins/Toolbox/Toolbox.hxx>
#include <BootKit/Vendor/Support.hxx>
#include <CompilerKit/Detail.hxx>
+/// @note the QR code is still code 128, it utilizes the same concept of having it's own character set.
+
namespace qr
{
inline uint8_t min_poly =
@@ -285,14 +287,6 @@ namespace qr
{
return SIDE;
}
- constexpr auto data_size() const
- {
- return N_BITS;
- }
- constexpr auto data_ptr() const
- {
- return code;
- }
bool module(int x, int y);
bool encode(const char* str, size_t len, Ecc ecc, int mask = -1);
diff --git a/Boot/BootKit/Vendor/QrVendor/bit.h b/Boot/BootKit/Vendor/QrVendor/bit.h
deleted file mode 100644
index 94ab0bf2..00000000
--- a/Boot/BootKit/Vendor/QrVendor/bit.h
+++ /dev/null
@@ -1,247 +0,0 @@
-#ifndef UTL_BIT_H
-#define UTL_BIT_H
-
-#include <bit>
-
-namespace utl
-{
-
- /**
- * @brief Size of object in terms of bits.
- *
- * @tparam T Object type
- * @return Number of bits
- */
- template <class T>
- constexpr auto bit_size()
- {
- return sizeof(T) * 8;
- }
-
- /**
- * @brief Integer with all bits set to 1.
- *
- * @tparam T Integer type
- * @return All set integer
- */
- template <class T>
- constexpr T bit_full()
- {
- return T(-1);
- }
-
- /**
- * @brief Wrap around mask for power of two number of bits
- * within given integer type. For example:
- * [ bit_wrap<uint8_t> = 8 - 1 = 0b111 ]
- * [ bit_wrap<uint16_t> = 16 - 1 = 0b1111 ]
- * [ bit_wrap<uint32_t> = 32 - 1 = 0b11111 ]
- *
- * @tparam T Integer type
- * @return Wrap around mask for number of bits
- */
- template <class T>
- constexpr T bit_wrap()
- {
- return bit_size<T>() - 1;
- }
-
- /**
- * @brief Number of bits to fit bit_wrap<T> result, in other words
- * bit width of (sizeof(T) * 8 - 1). For example:
- * [ bit_shft<uint8_t> = bit_width(0b111) = 3 ]
- * [ bit_shft<uint16_t> = bit_width(0b1111) = 4 ]
- * [ bit_shft<uint32_t> = bit_width(0b11111) = 5 ]
- *
- * @tparam T Integer type
- * @return Number of bits to shift to divide by sizeof(T) * 8
- */
- template <class T>
- constexpr auto bit_shft()
- {
- return std::bit_width(bit_wrap<T>());
- }
-
- /**
- * @brief Round up division by number of bits within given integer type,
- * which sizeof(T) * 8 is power of two.
- *
- * @tparam T Inetegr type
- * @param x Dividend
- * @return Quotient
- */
- template <class T>
- constexpr auto bit_ceil(auto x)
- {
- return (x + bit_wrap<T>()) >> bit_shft<T>();
- }
-
- /**
- * @brief Count leading zeros.
- *
- * @param x Unsigned integer argument
- * @return Number of leading zeros
- */
- constexpr unsigned cntlz(auto x)
- {
- if constexpr (std::is_same_v<decltype(x), int>)
- return std::countl_zero(unsigned(x));
- else
- return std::countl_zero(x);
- }
-
- /**
- * @brief Count trailing zeros.
- *
- * @param x Unsigned integer argument
- * @return Number of trailing zeros
- */
- constexpr unsigned cnttz(auto x)
- {
- if constexpr (std::is_same_v<decltype(x), int>)
- return std::countr_zero(unsigned(x));
- else
- return std::countr_zero(x);
- }
-
- /**
- * @brief Get number of words (integers) required to store N bits.
- *
- * @tparam T Word integer type
- * @param n Number of bits to store
- * @return Number of words
- */
- template <class T>
- constexpr size_t words_in_bits(size_t n)
- {
- return (n >> bit_shft<T>()) + !!(n & bit_wrap<T>());
- }
-
- /**
- * @brief Get number of bytes required to store N bits.
- *
- * @param n Number of bits to store
- * @return Number of bytes
- */
- constexpr size_t bytes_in_bits(size_t n)
- {
- return words_in_bits<uint8_t>(n);
- }
-
- /**
- * @brief Make integer with bit at given position.
- *
- * @tparam T Inetegr type
- * @param n Bit position
- * @return Integer with set bit
- */
- template <class T = unsigned>
- constexpr T bit(int n)
- {
- return T(1) << n;
- }
-
- /**
- * @brief Get n-th bit of an integer.
- *
- * @tparam T Integer type
- * @param x Integer
- * @param n Bit position from LSB
- * @return true if set
- */
- template <class T>
- constexpr bool get_bit(T x, int n)
- {
- return (x >> n) & 1;
- }
-
- /**
- * @brief Set n-th bit of an integer.
- *
- * @tparam T Integer type
- * @param x Integer
- * @param n Bit position from LSB
- */
- template <class T>
- constexpr void set_bit(T& x, int n)
- {
- x |= 1 << n;
- }
-
- /**
- * @brief Clear n-th bit of an integer.
- *
- * @tparam T Integer type
- * @param x Integer
- * @param n Bit position from LSB
- */
- template <class T>
- constexpr void clr_bit(T& x, int n)
- {
- x &= ~(1 << n);
- }
-
- /**
- * @brief Get n-th bit in array of words (starting from LSB).
- *
- * @tparam T Word type
- * @param p Array of words
- * @param n Index of bit to get
- * @return true if set
- */
- template <class T>
- constexpr bool get_arr_bit(const T* p, unsigned n)
- {
- return get_bit(p[n >> bit_shft<T>()], n & bit_wrap<T>());
- }
-
- /**
- * @brief Set n-th bit in array of words (starting from LSB).
- *
- * @tparam T Word type
- * @param p Array of words
- * @param n Index of bit to set
- */
- template <class T>
- constexpr void set_arr_bit(T* p, unsigned n)
- {
- set_bit(p[n >> bit_shft<T>()], n & bit_wrap<T>());
- }
-
- /**
- * @brief Clear n-th bit in array of words (starting from LSB).
- *
- * @tparam T Word type
- * @param p Array of words
- * @param n Index of bit to clear
- */
- template <class T>
- constexpr void clr_arr_bit(T* p, unsigned n)
- {
- clr_bit(p[n >> bit_shft<T>()], n & bit_wrap<T>());
- }
-
- /**
- * @brief Shift bits left in array of integer elements from least significant bit
- * and considering 0-th byte as the right most.
- * uint16_t example: 0b10000000'11100001 ==> 0b00000001'11000010.
- *
- * @tparam T Integer type
- * @tparam L Length of array
- * @param x Array of integers, nullptr not acceptable!
- * @param len Number of elements
- */
- template <class T, size_t L>
- constexpr void shift_left(T (&x)[L])
- {
- for (int i = L - 1; i > 0; --i)
- {
- x[i] <<= 1;
- x[i] |= x[i - 1] >> bit_wrap<T>();
- }
- x[0] <<= 1;
- }
-
-} // namespace utl
-
-#endif
diff --git a/Boot/BootKit/Vendor/QrVendor/base.h b/Boot/BootKit/Vendor/Shared/base.h
index a98ae4f0..d1c028d7 100644
--- a/Boot/BootKit/Vendor/QrVendor/base.h
+++ b/Boot/BootKit/Vendor/Shared/base.h
@@ -9,12 +9,12 @@ namespace utl
{
/**
- * @brief Helper to get number of elements in array.
- *
- * @tparam T Auto-deduced element type
- * @tparam N Auto-deduced number of elements
- * @return Array size
- */
+ * @brief Helper to get number of elements in array.
+ *
+ * @tparam T Auto-deduced element type
+ * @tparam N Auto-deduced number of elements
+ * @return Array size
+ */
template <class T, size_t N>
constexpr size_t countof(T (&)[N])
{
diff --git a/Boot/BootKit/Vendor/Shared/bit.h b/Boot/BootKit/Vendor/Shared/bit.h
new file mode 100644
index 00000000..6923e94a
--- /dev/null
+++ b/Boot/BootKit/Vendor/Shared/bit.h
@@ -0,0 +1,247 @@
+#ifndef UTL_BIT_H
+#define UTL_BIT_H
+
+#include <bit>
+
+namespace utl
+{
+
+ /**
+ * @brief Size of object in terms of bits.
+ *
+ * @tparam T Object type
+ * @return Number of bits
+ */
+ template <class T>
+ constexpr auto bit_size()
+ {
+ return sizeof(T) * 8;
+ }
+
+ /**
+ * @brief Integer with all bits set to 1.
+ *
+ * @tparam T Integer type
+ * @return All set integer
+ */
+ template <class T>
+ constexpr T bit_full()
+ {
+ return T(-1);
+ }
+
+ /**
+ * @brief Wrap around mask for power of two number of bits
+ * within given integer type. For example:
+ * [ bit_wrap<uint8_t> = 8 - 1 = 0b111 ]
+ * [ bit_wrap<uint16_t> = 16 - 1 = 0b1111 ]
+ * [ bit_wrap<uint32_t> = 32 - 1 = 0b11111 ]
+ *
+ * @tparam T Integer type
+ * @return Wrap around mask for number of bits
+ */
+ template <class T>
+ constexpr T bit_wrap()
+ {
+ return bit_size<T>() - 1;
+ }
+
+ /**
+ * @brief Number of bits to fit bit_wrap<T> result, in other words
+ * bit width of (sizeof(T) * 8 - 1). For example:
+ * [ bit_shft<uint8_t> = bit_width(0b111) = 3 ]
+ * [ bit_shft<uint16_t> = bit_width(0b1111) = 4 ]
+ * [ bit_shft<uint32_t> = bit_width(0b11111) = 5 ]
+ *
+ * @tparam T Integer type
+ * @return Number of bits to shift to divide by sizeof(T) * 8
+ */
+ template <class T>
+ constexpr auto bit_shft()
+ {
+ return std::bit_width(bit_wrap<T>());
+ }
+
+ /**
+ * @brief Round up division by number of bits within given integer type,
+ * which sizeof(T) * 8 is power of two.
+ *
+ * @tparam T Inetegr type
+ * @param x Dividend
+ * @return Quotient
+ */
+ template <class T>
+ constexpr auto bit_ceil(auto x)
+ {
+ return (x + bit_wrap<T>()) >> bit_shft<T>();
+ }
+
+ /**
+ * @brief Count leading zeros.
+ *
+ * @param x Unsigned integer argument
+ * @return Number of leading zeros
+ */
+ constexpr unsigned cntlz(auto x)
+ {
+ if constexpr (std::is_same_v<decltype(x), int>)
+ return std::countl_zero(unsigned(x));
+ else
+ return std::countl_zero(x);
+ }
+
+ /**
+ * @brief Count trailing zeros.
+ *
+ * @param x Unsigned integer argument
+ * @return Number of trailing zeros
+ */
+ constexpr unsigned cnttz(auto x)
+ {
+ if constexpr (std::is_same_v<decltype(x), int>)
+ return std::countr_zero(unsigned(x));
+ else
+ return std::countr_zero(x);
+ }
+
+ /**
+ * @brief Get number of words (integers) required to store N bits.
+ *
+ * @tparam T Word integer type
+ * @param n Number of bits to store
+ * @return Number of words
+ */
+ template <class T>
+ constexpr size_t words_in_bits(size_t n)
+ {
+ return (n >> bit_shft<T>()) + !!(n & bit_wrap<T>());
+ }
+
+ /**
+ * @brief Get number of bytes required to store N bits.
+ *
+ * @param n Number of bits to store
+ * @return Number of bytes
+ */
+ constexpr size_t bytes_in_bits(size_t n)
+ {
+ return words_in_bits<uint8_t>(n);
+ }
+
+ /**
+ * @brief Make integer with bit at given position.
+ *
+ * @tparam T Inetegr type
+ * @param n Bit position
+ * @return Integer with set bit
+ */
+ template <class T = unsigned>
+ constexpr T bit(int n)
+ {
+ return T(1) << n;
+ }
+
+ /**
+ * @brief Get n-th bit of an integer.
+ *
+ * @tparam T Integer type
+ * @param x Integer
+ * @param n Bit position from LSB
+ * @return true if set
+ */
+ template <class T>
+ constexpr bool get_bit(T x, int n)
+ {
+ return (x >> n) & 1;
+ }
+
+ /**
+ * @brief Set n-th bit of an integer.
+ *
+ * @tparam T Integer type
+ * @param x Integer
+ * @param n Bit position from LSB
+ */
+ template <class T>
+ constexpr void set_bit(T& x, int n)
+ {
+ x |= 1 << n;
+ }
+
+ /**
+ * @brief Clear n-th bit of an integer.
+ *
+ * @tparam T Integer type
+ * @param x Integer
+ * @param n Bit position from LSB
+ */
+ template <class T>
+ constexpr void clr_bit(T& x, int n)
+ {
+ x &= ~(1 << n);
+ }
+
+ /**
+ * @brief Get n-th bit in array of words (starting from LSB).
+ *
+ * @tparam T Word type
+ * @param p Array of words
+ * @param n Index of bit to get
+ * @return true if set
+ */
+ template <class T>
+ constexpr bool get_arr_bit(const T* p, unsigned n)
+ {
+ return get_bit(p[n >> bit_shft<T>()], n & bit_wrap<T>());
+ }
+
+ /**
+ * @brief Set n-th bit in array of words (starting from LSB).
+ *
+ * @tparam T Word type
+ * @param p Array of words
+ * @param n Index of bit to set
+ */
+ template <class T>
+ constexpr void set_arr_bit(T* p, unsigned n)
+ {
+ set_bit(p[n >> bit_shft<T>()], n & bit_wrap<T>());
+ }
+
+ /**
+ * @brief Clear n-th bit in array of words (starting from LSB).
+ *
+ * @tparam T Word type
+ * @param p Array of words
+ * @param n Index of bit to clear
+ */
+ template <class T>
+ constexpr void clr_arr_bit(T* p, unsigned n)
+ {
+ clr_bit(p[n >> bit_shft<T>()], n & bit_wrap<T>());
+ }
+
+ /**
+ * @brief Shift bits left in array of integer elements from least significant bit
+ * and considering 0-th byte as the right most.
+ * uint16_t example: 0b10000000'11100001 ==> 0b00000001'11000010.
+ *
+ * @tparam T Integer type
+ * @tparam L Length of array
+ * @param x Array of integers, nullptr not acceptable!
+ * @param len Number of elements
+ */
+ template <class T, size_t L>
+ constexpr void shift_left(T (&x)[L])
+ {
+ for (int i = L - 1; i > 0; --i)
+ {
+ x[i] <<= 1;
+ x[i] |= x[i - 1] >> bit_wrap<T>();
+ }
+ x[0] <<= 1;
+ }
+
+} // namespace utl
+
+#endif
diff --git a/Boot/BootKit/Vendor/Support.hxx b/Boot/BootKit/Vendor/Support.hxx
index d8075152..6a480779 100644
--- a/Boot/BootKit/Vendor/Support.hxx
+++ b/Boot/BootKit/Vendor/Support.hxx
@@ -1,12 +1,13 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
#pragma once
-/// @file Purpose of this file is to help port libs into the bootloader.
+/// @file Support.hxx
+/// @brief Purpose of this file is to help port libs into the bootloader.
#include <BootKit/BootKit.hxx>
@@ -18,7 +19,7 @@
#define CopyMem(dst, src, sz) memcpy(dst, src, sz)
#define StrLen(src) strlen(src)
-inline int isspace(int c)
+inline int IsSpace(int c)
{
return c == ' ';
}
@@ -27,16 +28,21 @@ inline long StringToLong(const char* nptr, char** endptr, int base)
{
const char *p = nptr, *endp;
bool is_neg = 0, overflow = 0;
+
/* Need unsigned so (-cLongMin) can fit in these: */
unsigned long n = 0UL, cutoff;
int cutlim;
+
if (base < 0 || base == 1 || base > 36)
{
return 0L;
}
+
endp = nptr;
- while (isspace(*p))
+
+ while (IsSpace(*p))
p++;
+
if (*p == '+')
{
p++;
@@ -49,8 +55,8 @@ inline long StringToLong(const char* nptr, char** endptr, int base)
{
p++;
/* For strtol(" 0xZ", &endptr, 16), endptr should point to 'x';
- * pointing to ' ' or '0' is non-compliant.
- * (Many implementations do this wrong.) */
+ * pointing to ' ' or '0' is non-compliant.
+ * (Many implementations do this wrong.) */
endp = p;
if (base == 16 && (*p == 'X' || *p == 'x'))
{
@@ -81,8 +87,10 @@ inline long StringToLong(const char* nptr, char** endptr, int base)
{
base = 10;
}
+
cutoff = (is_neg) ? -(cLongMin / base) : cLongMax / base;
cutlim = (is_neg) ? -(cLongMin % base) : cLongMax % base;
+
while (1)
{
int c;
@@ -98,7 +106,7 @@ inline long StringToLong(const char* nptr, char** endptr, int base)
if (overflow)
{
/* endptr should go forward and point to the non-digit character
- * (of the given base); required by ANSI standard. */
+ * (of the given base); required by ANSI standard. */
if (endptr)
continue;
break;
@@ -110,11 +118,14 @@ inline long StringToLong(const char* nptr, char** endptr, int base)
}
n = n * base + c;
}
+
if (endptr)
*endptr = (char*)endp;
+
if (overflow)
{
return ((is_neg) ? cLongMin : cLongMax);
}
+
return (long)((is_neg) ? -n : n);
}
diff --git a/Boot/Source/.gitkeep b/Boot/Sources/.gitkeep
index e69de29b..e69de29b 100644
--- a/Boot/Source/.gitkeep
+++ b/Boot/Sources/.gitkeep
diff --git a/Boot/Source/BootloaderRsrc.rsrc b/Boot/Sources/BootloaderRsrc.rsrc
index 0282192b..0282192b 100644
--- a/Boot/Source/BootloaderRsrc.rsrc
+++ b/Boot/Sources/BootloaderRsrc.rsrc
diff --git a/Boot/Source/HEL/AMD64/.gitkeep b/Boot/Sources/HEL/AMD64/.gitkeep
index e69de29b..e69de29b 100644
--- a/Boot/Source/HEL/AMD64/.gitkeep
+++ b/Boot/Sources/HEL/AMD64/.gitkeep
diff --git a/Boot/Source/HEL/AMD64/BootAHCI.cxx b/Boot/Sources/HEL/AMD64/BootAHCI.cxx
index 6676f660..d60b91fd 100644
--- a/Boot/Source/HEL/AMD64/BootAHCI.cxx
+++ b/Boot/Sources/HEL/AMD64/BootAHCI.cxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/Source/HEL/AMD64/BootATA.cxx b/Boot/Sources/HEL/AMD64/BootATA.cxx
index 499596ca..c82cb2ea 100644
--- a/Boot/Source/HEL/AMD64/BootATA.cxx
+++ b/Boot/Sources/HEL/AMD64/BootATA.cxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
@@ -202,9 +202,9 @@ BootDeviceATA::operator bool()
}
/**
- @brief Read Buf from disk
- @param Sz Sector size
- @param Buf buffer
+ @brief Read Buf from disk
+ @param Sz Sector size
+ @param Buf buffer
*/
BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, const SizeT& SectorSz)
{
@@ -228,9 +228,9 @@ BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, const SizeT& SectorSz
}
/**
- @brief Write Buf into disk
- @param Sz Sector size
- @param Buf buffer
+ @brief Write Buf into disk
+ @param Sz Sector size
+ @param Buf buffer
*/
BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, const SizeT& SectorSz)
{
@@ -263,7 +263,7 @@ BootDeviceATA::ATATrait& BootDeviceATA::Leak()
}
/***
- @brief Getter, gets the number of sectors inside the drive.
+ @brief Getter, gets the number of sectors inside the drive.
*/
SizeT BootDeviceATA::GetSectorsCount() noexcept
{
diff --git a/Boot/Source/HEL/AMD64/BootFileReader.cxx b/Boot/Sources/HEL/AMD64/BootFileReader.cxx
index 61adc4f3..7ec6b7ab 100644
--- a/Boot/Source/HEL/AMD64/BootFileReader.cxx
+++ b/Boot/Sources/HEL/AMD64/BootFileReader.cxx
@@ -1,10 +1,10 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
- File: FileReader.cxx
- Purpose: New Boot FileReader,
- Read complete file and store it in a buffer.
+ File: FileReader.cxx
+ Purpose: New Boot FileReader,
+ Read complete file and store it in a buffer.
------------------------------------------- */
@@ -29,7 +29,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
/***
- @brief File Reader constructor.
+ @brief File Reader constructor.
*/
BFileReader::BFileReader(const CharacterTypeUTF16* path,
EfiHandlePtr ImageHandle)
@@ -111,8 +111,8 @@ BFileReader::~BFileReader()
}
/**
- @brief this reads all of the buffer.
- @param until read until size is reached.
+ @brief this reads all of the buffer.
+ @param until read until size is reached.
*/
Void BFileReader::ReadAll(SizeT until, SizeT chunk)
{
diff --git a/Boot/Source/HEL/AMD64/BootJump.S b/Boot/Sources/HEL/AMD64/BootJump.S
index af278cc7..af278cc7 100644
--- a/Boot/Source/HEL/AMD64/BootJump.S
+++ b/Boot/Sources/HEL/AMD64/BootJump.S
diff --git a/Boot/Source/HEL/AMD64/BootMain.cxx b/Boot/Sources/HEL/AMD64/BootMain.cxx
index 649596b4..f58709be 100644
--- a/Boot/Source/HEL/AMD64/BootMain.cxx
+++ b/Boot/Sources/HEL/AMD64/BootMain.cxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
@@ -31,7 +31,7 @@ STATIC EfiGUID kGopGuid;
EXTERN_C Void hal_init_platform(HEL::HandoverInformationHeader* HIH);
/**
- @brief Finds and stores the GOP.
+ @brief Finds and stores the GOP.
*/
STATIC Void CheckAndFindFramebuffer() noexcept
diff --git a/Boot/Source/HEL/AMD64/BootPlatform.cxx b/Boot/Sources/HEL/AMD64/BootPlatform.cxx
index 9d125ec6..866c4839 100644
--- a/Boot/Source/HEL/AMD64/BootPlatform.cxx
+++ b/Boot/Sources/HEL/AMD64/BootPlatform.cxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/Source/HEL/AMD64/BootString.cxx b/Boot/Sources/HEL/AMD64/BootString.cxx
index a93943cf..54ab2c64 100644
--- a/Boot/Source/HEL/AMD64/BootString.cxx
+++ b/Boot/Sources/HEL/AMD64/BootString.cxx
@@ -1,11 +1,11 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
- File: String.cxx
- Purpose: NewBoot string library
+ File: String.cxx
+ Purpose: NewBoot string library
- Revision History:
+ Revision History:
diff --git a/Boot/Source/HEL/AMD64/BootTextWriter.cxx b/Boot/Sources/HEL/AMD64/BootTextWriter.cxx
index 30c328ad..90d12f3d 100644
--- a/Boot/Source/HEL/AMD64/BootTextWriter.cxx
+++ b/Boot/Sources/HEL/AMD64/BootTextWriter.cxx
@@ -1,11 +1,11 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
- File: String.cxx
- Purpose: NewBoot string library
+ File: String.cxx
+ Purpose: NewBoot string library
- Revision History:
+ Revision History:
diff --git a/Boot/Source/HEL/AMD64/New+Delete.cxx b/Boot/Sources/HEL/AMD64/New+Delete.cxx
index 3316ac1d..6c025646 100644
--- a/Boot/Source/HEL/AMD64/New+Delete.cxx
+++ b/Boot/Sources/HEL/AMD64/New+Delete.cxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/Source/HEL/AMD64/Support.cxx b/Boot/Sources/HEL/AMD64/Support.cxx
index 12c136f8..22b01280 100644
--- a/Boot/Source/HEL/AMD64/Support.cxx
+++ b/Boot/Sources/HEL/AMD64/Support.cxx
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright SoftwareLabs
+ Copyright SoftwareLabs
------------------------------------------- */
diff --git a/Boot/Source/HEL/AMD64/compile_flags.txt b/Boot/Sources/HEL/AMD64/compile_flags.txt
index e4515efe..e4515efe 100644
--- a/Boot/Source/HEL/AMD64/compile_flags.txt
+++ b/Boot/Sources/HEL/AMD64/compile_flags.txt
diff --git a/Boot/Source/HEL/ARM64/.gitkeep b/Boot/Sources/HEL/ARM64/.gitkeep
index e69de29b..e69de29b 100644
--- a/Boot/Source/HEL/ARM64/.gitkeep
+++ b/Boot/Sources/HEL/ARM64/.gitkeep
diff --git a/Boot/Source/HEL/POWER/.gitkeep b/Boot/Sources/HEL/POWER/.gitkeep
index e69de29b..e69de29b 100644
--- a/Boot/Source/HEL/POWER/.gitkeep
+++ b/Boot/Sources/HEL/POWER/.gitkeep
diff --git a/Boot/Source/HEL/POWER/CoreBootStartup.S b/Boot/Sources/HEL/POWER/CoreBootStartup.S
index f8ff99d7..f8ff99d7 100644
--- a/Boot/Source/HEL/POWER/CoreBootStartup.S
+++ b/Boot/Sources/HEL/POWER/CoreBootStartup.S
diff --git a/Boot/Source/HEL/RISCV/.gitkeep b/Boot/Sources/HEL/RISCV/.gitkeep
index e69de29b..e69de29b 100644
--- a/Boot/Source/HEL/RISCV/.gitkeep
+++ b/Boot/Sources/HEL/RISCV/.gitkeep
diff --git a/Boot/Source/HEL/RISCV/BootRISCV.S b/Boot/Sources/HEL/RISCV/BootRISCV.S
index 7a7e7db0..7a7e7db0 100644
--- a/Boot/Source/HEL/RISCV/BootRISCV.S
+++ b/Boot/Sources/HEL/RISCV/BootRISCV.S
diff --git a/Boot/Source/Root/EFI/STARTUP.NSH b/Boot/Sources/Root/EFI/STARTUP.NSH
index d29ba8fd..d29ba8fd 100644
--- a/Boot/Source/Root/EFI/STARTUP.NSH
+++ b/Boot/Sources/Root/EFI/STARTUP.NSH
diff --git a/Boot/Source/Root/SplashScreen.fmt b/Boot/Sources/Root/SplashScreen.fmt
index 863d7b62..863d7b62 100644
--- a/Boot/Source/Root/SplashScreen.fmt
+++ b/Boot/Sources/Root/SplashScreen.fmt
diff --git a/Boot/Source/compile_flags.txt b/Boot/Sources/compile_flags.txt
index c74d22b2..c74d22b2 100644
--- a/Boot/Source/compile_flags.txt
+++ b/Boot/Sources/compile_flags.txt
diff --git a/Boot/Source/ovmf.ps1 b/Boot/Sources/ovmf.ps1
index 5a2c5f0e..5a2c5f0e 100644
--- a/Boot/Source/ovmf.ps1
+++ b/Boot/Sources/ovmf.ps1
diff --git a/Boot/makefile b/Boot/makefile
index 878cee2a..63883321 100644
--- a/Boot/makefile
+++ b/Boot/makefile
@@ -12,10 +12,10 @@ ADD_FILE=touch
COPY=cp
HTTP_GET=wget
-ifeq ($(shell uname), Windows_NT)
-EMU=qemu-system-x86_64w
-else
+ifneq ($(shell uname), Windows_NT)
EMU=qemu-system-x86_64
+else
+EMU=qemu-system-x86_64w
endif
ifeq ($(NEWS_MODEL), )
@@ -26,11 +26,11 @@ BIOS=OVMF.fd
IMG=epm.img
IMG_2=epm-slave.img
-EMU_FLAGS=-net none -smp 4,sockets=1,cores=4,threads=1 -m 8G -M q35 \
- -bios Source/$(BIOS) -device piix3-ide,id=ide \
- -drive id=disk,file=Source/$(IMG),format=raw,if=none \
+EMU_FLAGS=-net none -smp 4,sockets=1,cores=4,threads=1 -m 4G -M q35 \
+ -bios Sources/$(BIOS) -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:Source/Root,index=2,format=raw -d int -hdd Source/$(IMG_2)
+ file=fat:rw:Sources/Root,index=2,format=raw -d int -hdd $(IMG_2)
LD_FLAGS=-e Main --subsystem=10
@@ -59,11 +59,11 @@ invalid-recipe:
.PHONY: all
all: compile-amd64
- mkdir -p Root/EFI/BOOT
- $(LD_GNU) $(OBJ) $(LD_FLAGS) -o Source/$(BOOT_LOADER)
- $(COPY) Source/$(BOOT_LOADER) Source/Root/EFI/BOOT/BOOTX64.EFI
- $(COPY) Source/$(BOOT_LOADER) Source/Root/EFI/BOOT/NEWBOOT.EFI
- $(COPY) ../Kernel/$(KERNEL) Source/Root/$(KERNEL)
+ mkdir -p Sources/Root/EFI/BOOT
+ $(LD_GNU) $(OBJ) $(LD_FLAGS) -o Sources/$(BOOT_LOADER)
+ $(COPY) Sources/$(BOOT_LOADER) Sources/Root/EFI/BOOT/BOOTX64.EFI
+ $(COPY) Sources/$(BOOT_LOADER) Sources/Root/EFI/BOOT/NEWBOOT.EFI
+ $(COPY) ../Kernel/$(KERNEL) Sources/Root/$(KERNEL)
ifneq ($(DEBUG_SUPPORT), )
DEBUG = -D__DEBUG__
@@ -73,9 +73,9 @@ endif
compile-amd64:
$(RESCMD)
$(CC_GNU) $(NEWOS_MODEL) $(STANDALONE_MACRO) $(FLAG_GNU) $(DEBUG) \
- $(wildcard Source/HEL/AMD64/*.cxx) \
- $(wildcard Source/HEL/AMD64/*.S)
- $(wildcard Source/*.cxx)
+ $(wildcard Sources/HEL/AMD64/*.cxx) \
+ $(wildcard Sources/HEL/AMD64/*.S)
+ $(wildcard Sources/*.cxx)
.PHONY: run-efi-amd64
run-efi-amd64: