mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[bootloader] Fix exam mode with Epsilon 22
This commit is contained in:
@@ -87,14 +87,14 @@ void Boot::patchKernel(const Slot & s) {
|
||||
// data[origin_isr + sizeof(uint32_t) * 5 + 1] = ptr[1];
|
||||
// data[origin_isr + sizeof(uint32_t) * 5 + 2] = ptr[2];
|
||||
// data[origin_isr + sizeof(uint32_t) * 5 + 3] = ptr[3];
|
||||
|
||||
|
||||
data[origin_isr + sizeof(uint32_t) * 7] = ptr[0]; // UsageFault
|
||||
data[origin_isr + sizeof(uint32_t) * 7 + 1] = ptr[1];
|
||||
data[origin_isr + sizeof(uint32_t) * 7 + 2] = ptr[2];
|
||||
data[origin_isr + sizeof(uint32_t) * 7 + 3] = ptr[3];
|
||||
|
||||
// data[origin_isr + sizeof(uint32_t) * 4] = ptr[0];//hardfault
|
||||
// data[origin_isr + sizeof(uint32_t) * 4 + 1] = ptr[1];
|
||||
// data[origin_isr + sizeof(uint32_t) * 4 + 1] = ptr[1];
|
||||
// data[origin_isr + sizeof(uint32_t) * 4 + 2] = ptr[2];
|
||||
// data[origin_isr + sizeof(uint32_t) * 4 + 3] = ptr[3];
|
||||
|
||||
@@ -107,7 +107,7 @@ void Boot::bootSlot(Bootloader::Slot s) {
|
||||
if (!s.userlandHeader()->isOmega() && !s.userlandHeader()->isUpsilon()) {
|
||||
// We are trying to boot epsilon, so we check the version and show an advertisement if needed
|
||||
const char * version = s.userlandHeader()->version();
|
||||
const char * min = "21.3.1";
|
||||
const char * min = "22.2.1";
|
||||
int versionSum = Utility::versionSum(version, strlen(version));
|
||||
int minimalVersionTrigger = Utility::versionSum(min, strlen(min));
|
||||
if (versionSum >= minimalVersionTrigger) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
constexpr static const char * aboutMessage4 = "and select the OS";
|
||||
constexpr static const char * aboutMessage5 = "to boot.";
|
||||
|
||||
constexpr static const char * bootloaderVersion = "Version 1.0.8 - FREED0M.21.3";
|
||||
constexpr static const char * bootloaderVersion = "Version 1.0.9 - FREED0M.22";
|
||||
|
||||
//USB NAMES
|
||||
constexpr static const char * usbUpsilonBootloader = "NumWorks Calculator";
|
||||
|
||||
@@ -50,11 +50,16 @@ uint8_t SlotsExamMode::FetchSlotExamMode(const char * version, const char * Slot
|
||||
start = getSlotAStartExamAddress(0);
|
||||
end = getSlotAEndExamAddress(0);
|
||||
}
|
||||
// Else get new addresses
|
||||
else {
|
||||
// Else versions before 22
|
||||
else if (version[0] == '2' && version[1] < '2') {
|
||||
start = getSlotAStartExamAddress(1);
|
||||
end = getSlotAEndExamAddress(1);
|
||||
}
|
||||
// Else Epsilon 22 +
|
||||
else {
|
||||
start = getSlotAStartExamAddress(2);
|
||||
end = getSlotAEndExamAddress(2);
|
||||
}
|
||||
}
|
||||
else if (Slot == "B") {
|
||||
// If version under 16 get old
|
||||
@@ -62,11 +67,16 @@ uint8_t SlotsExamMode::FetchSlotExamMode(const char * version, const char * Slot
|
||||
start = getSlotBStartExamAddress(0);
|
||||
end = getSlotBEndExamAddress(0);
|
||||
}
|
||||
// Else get new
|
||||
else {
|
||||
// Else versions before 22
|
||||
else if (version[0] == '2' && version[1] < '2') {
|
||||
start = getSlotBStartExamAddress(1);
|
||||
end = getSlotBEndExamAddress(1);
|
||||
}
|
||||
// Else Epsilon 22 +
|
||||
else {
|
||||
start = getSlotBStartExamAddress(2);
|
||||
end = getSlotBEndExamAddress(2);
|
||||
}
|
||||
} else if (Slot == "Khi") {
|
||||
// We directly get the address of the Khi exam mode without checking the
|
||||
// version, because on Khi, version is KhiCAS version, not the OS version
|
||||
@@ -171,38 +181,63 @@ uint8_t SlotsExamMode::examFetch19(uint32_t start, uint32_t end) {
|
||||
|
||||
uint32_t SlotsExamMode::getSlotAStartExamAddress(int ExamVersion) {
|
||||
if (ExamVersion == 0) {
|
||||
return SlotAExamModeBufferStartOldVersions;
|
||||
return SlotAExamModeBufferStartBefore16;
|
||||
}
|
||||
else {
|
||||
return SlotAExamModeBufferStartNewVersions;
|
||||
if (ExamVersion == 1) {
|
||||
return SlotAExamModeBufferStartEpsilon16;
|
||||
}
|
||||
if (ExamVersion == 2) {
|
||||
return SlotAExamModeBufferStartEpsilon22;
|
||||
}
|
||||
assert(false);
|
||||
// Should not happen
|
||||
return SlotAExamModeBufferStartEpsilon22;
|
||||
}
|
||||
|
||||
uint32_t SlotsExamMode::getSlotAEndExamAddress(int ExamVersion) {
|
||||
if (ExamVersion == 0) {
|
||||
return SlotAExamModeBufferEndOldVersions;
|
||||
return SlotAExamModeBufferEndBefore16;
|
||||
}
|
||||
else {
|
||||
return SlotAExamModeBufferEndNewVersions;;
|
||||
if (ExamVersion == 1) {
|
||||
return SlotAExamModeBufferEndEpsilon16;
|
||||
}
|
||||
if (ExamVersion == 2) {
|
||||
return SlotAExamModeBufferEndEpsilon22;
|
||||
}
|
||||
assert(false);
|
||||
// Should not happen
|
||||
return SlotAExamModeBufferEndEpsilon22;
|
||||
|
||||
}
|
||||
|
||||
uint32_t SlotsExamMode::getSlotBStartExamAddress(int ExamVersion) {
|
||||
if (ExamVersion == 0) {
|
||||
return SlotBExamModeBufferStartOldVersions;
|
||||
return SlotBExamModeBufferStartBeforeEpsilon16;
|
||||
}
|
||||
else {
|
||||
return SlotBExamModeBufferStartNewVersions;
|
||||
if (ExamVersion == 1) {
|
||||
return SlotBExamModeBufferStartEpsilon16;
|
||||
}
|
||||
if (ExamVersion == 2) {
|
||||
return SlotBExamModeBufferStartEpsilon22;
|
||||
}
|
||||
assert(false);
|
||||
// Should not happen
|
||||
return SlotBExamModeBufferStartEpsilon22;
|
||||
}
|
||||
|
||||
uint32_t SlotsExamMode::getSlotBEndExamAddress(int ExamVersion) {
|
||||
if (ExamVersion == 0) {
|
||||
return SlotBExamModeBufferEndOldVersions;
|
||||
return SlotBExamModeBufferEndBeforeEpsilon16;
|
||||
}
|
||||
else {
|
||||
return SlotBExamModeBufferEndNewVersions;
|
||||
if (ExamVersion == 1) {
|
||||
return SlotBExamModeBufferEndEpsilon16;
|
||||
}
|
||||
if (ExamVersion == 2) {
|
||||
return SlotBExamModeBufferEndEpsilon22;
|
||||
}
|
||||
assert(false);
|
||||
// Should not happen
|
||||
return SlotBExamModeBufferEndEpsilon22;
|
||||
}
|
||||
|
||||
uint32_t SlotsExamMode::getSlotKhiStartExamAddress() {
|
||||
|
||||
@@ -8,17 +8,23 @@ extern "C" {
|
||||
namespace Bootloader {
|
||||
namespace ExamMode {
|
||||
|
||||
static const uint32_t SlotAExamModeBufferStartOldVersions = 0x90001000;
|
||||
static const uint32_t SlotAExamModeBufferEndOldVersions = 0x90003000;
|
||||
static const uint32_t SlotAExamModeBufferStartBefore16 = 0x90001000;
|
||||
static const uint32_t SlotAExamModeBufferEndBefore16 = 0x90003000;
|
||||
|
||||
static const uint32_t SlotAExamModeBufferStartNewVersions = 0x903f0000;
|
||||
static const uint32_t SlotAExamModeBufferEndNewVersions = 0x90400000;
|
||||
static const uint32_t SlotAExamModeBufferStartEpsilon16 = 0x903f0000;
|
||||
static const uint32_t SlotAExamModeBufferEndEpsilon16 = 0x90400000;
|
||||
|
||||
static const uint32_t SlotBExamModeBufferStartOldVersions = 0x90401000;
|
||||
static const uint32_t SlotBExamModeBufferEndOldVersions = 0x90403000;
|
||||
static const uint32_t SlotAExamModeBufferStartEpsilon22 = 0x903f0400;
|
||||
static const uint32_t SlotAExamModeBufferEndEpsilon22 = 0x90400000;
|
||||
|
||||
static const uint32_t SlotBExamModeBufferStartNewVersions = 0x907f0000;
|
||||
static const uint32_t SlotBExamModeBufferEndNewVersions = 0x90800000;
|
||||
static const uint32_t SlotBExamModeBufferStartBeforeEpsilon16 = 0x90401000;
|
||||
static const uint32_t SlotBExamModeBufferEndBeforeEpsilon16 = 0x90403000;
|
||||
|
||||
static const uint32_t SlotBExamModeBufferStartEpsilon16 = 0x907f0000;
|
||||
static const uint32_t SlotBExamModeBufferEndEpsilon16 = 0x90800000;
|
||||
|
||||
static const uint32_t SlotBExamModeBufferStartEpsilon22 = 0x907f0400;
|
||||
static const uint32_t SlotBExamModeBufferEndEpsilon22 = 0x90800000;
|
||||
|
||||
static const uint32_t SlotKhiExamModeBufferStart = 0x90181000;
|
||||
static const uint32_t SlotKhiExamModeBufferEnd = 0x90183000;
|
||||
|
||||
Reference in New Issue
Block a user