summaryrefslogtreecommitdiffhomepage
path: root/Boot
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-05-17 22:25:04 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-05-17 22:25:04 +0200
commitc0428f8e5feba9573e572a1a1b3c66cfa1f29108 (patch)
treea0ecdb03c667558133a23cd7cb546a3e84489659 /Boot
parent9ebaf586257bf42996881b70a79cb2d57d8fd1ef (diff)
MHR-23: Improve scheduler code.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Boot')
-rw-r--r--Boot/BootKit/BootKit.hxx2
-rw-r--r--Boot/BootKit/Vendor/Qr.hxx14
-rw-r--r--Boot/BootKit/Vendor/Shared/base.h (renamed from Boot/BootKit/Vendor/QrVendor/base.h)0
-rw-r--r--Boot/BootKit/Vendor/Shared/bit.h (renamed from Boot/BootKit/Vendor/QrVendor/bit.h)0
-rw-r--r--Boot/BootKit/Vendor/Support.hxx17
-rw-r--r--Boot/makefile8
6 files changed, 23 insertions, 18 deletions
diff --git a/Boot/BootKit/BootKit.hxx b/Boot/BootKit/BootKit.hxx
index 179ca141..6ddecca1 100644
--- a/Boot/BootKit/BootKit.hxx
+++ b/Boot/BootKit/BootKit.hxx
@@ -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/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/base.h b/Boot/BootKit/Vendor/Shared/base.h
index a98ae4f0..a98ae4f0 100644
--- a/Boot/BootKit/Vendor/QrVendor/base.h
+++ b/Boot/BootKit/Vendor/Shared/base.h
diff --git a/Boot/BootKit/Vendor/QrVendor/bit.h b/Boot/BootKit/Vendor/Shared/bit.h
index 94ab0bf2..94ab0bf2 100644
--- a/Boot/BootKit/Vendor/QrVendor/bit.h
+++ b/Boot/BootKit/Vendor/Shared/bit.h
diff --git a/Boot/BootKit/Vendor/Support.hxx b/Boot/BootKit/Vendor/Support.hxx
index d8075152..a2c2af65 100644
--- a/Boot/BootKit/Vendor/Support.hxx
+++ b/Boot/BootKit/Vendor/Support.hxx
@@ -6,7 +6,8 @@
#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++;
@@ -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;
@@ -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/makefile b/Boot/makefile
index 878cee2a..8eef2dba 100644
--- a/Boot/makefile
+++ b/Boot/makefile
@@ -12,7 +12,7 @@ ADD_FILE=touch
COPY=cp
HTTP_GET=wget
-ifeq ($(shell uname), Windows_NT)
+ifneq ($(shell uname), Darwin)
EMU=qemu-system-x86_64w
else
EMU=qemu-system-x86_64
@@ -28,9 +28,9 @@ 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 \
+ -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:Source/Root,index=2,format=raw -d int -hdd $(IMG_2)
LD_FLAGS=-e Main --subsystem=10
@@ -59,7 +59,7 @@ invalid-recipe:
.PHONY: all
all: compile-amd64
- mkdir -p Root/EFI/BOOT
+ mkdir -p Source/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