summaryrefslogtreecommitdiffhomepage
path: root/dev/ZBAKit/BootKit/Support.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-12-01 18:41:41 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-12-01 18:41:41 +0100
commitf83e7bddcf24433adbfc9214e0f8f8139f8b6362 (patch)
tree0447eddc2ebff291f96286847c238b4f907515b1 /dev/ZBAKit/BootKit/Support.h
parentc62790f8f773a2f10464d2b1e0e286f2b3156712 (diff)
FIX: Fixing ARM64 execution when booting from bootloader.
FIX: Now works both for ARM64 and AMD64 EFI backends. TODO: The ACB backend needs to be done too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZBAKit/BootKit/Support.h')
-rw-r--r--dev/ZBAKit/BootKit/Support.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/dev/ZBAKit/BootKit/Support.h b/dev/ZBAKit/BootKit/Support.h
index 1ee1dc47..2c1db6f4 100644
--- a/dev/ZBAKit/BootKit/Support.h
+++ b/dev/ZBAKit/BootKit/Support.h
@@ -6,13 +6,11 @@
#pragma once
-#include <cstddef>
-
/// @file Support.h
/// @brief Purpose of this file is to help port libs into the bootloader.
-#define cLongMax ((long)(~0UL >> 1))
-#define cLongMin (~cLongMax)
+#define kLongMax ((long)(~0UL >> 1))
+#define kLongMin (~kLongMax)
#ifdef __NEWOSLDR__
@@ -65,7 +63,7 @@ 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: */
+ /* Need unsigned so (-kLongMin) can fit in these: */
unsigned long n = 0UL, cutoff;
int cutlim;
@@ -124,8 +122,8 @@ 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;
+ cutoff = (is_neg) ? -(kLongMin / base) : kLongMax / base;
+ cutlim = (is_neg) ? -(kLongMin % base) : kLongMax % base;
while (1)
{
@@ -160,7 +158,7 @@ inline long StringToLong(const char* nptr, char** endptr, int base)
if (overflow)
{
- return ((is_neg) ? cLongMin : cLongMax);
+ return ((is_neg) ? kLongMin : kLongMax);
}
return (long)((is_neg) ? -n : n);