summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 10:43:19 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-08-15 10:43:19 +0200
commit86640816e8b1d3595365f1fcc8a2a9e61fb40ff1 (patch)
treeeed7de21285b72905f819f9f84e673ce77e039a3
parent98403fe342c8c2795de34e922958ee8d02c94e04 (diff)
[IMP] MHR-28: Zero memory on BSS regions.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
-rw-r--r--Boot/Sources/Thread.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Boot/Sources/Thread.cxx b/Boot/Sources/Thread.cxx
index 6a3e8797..5bd18b19 100644
--- a/Boot/Sources/Thread.cxx
+++ b/Boot/Sources/Thread.cxx
@@ -83,6 +83,7 @@ namespace Boot
constexpr auto sectionForCode = ".text";
constexpr auto sectionForNewLdr = ".ldr";
+ constexpr auto sectionForBSS = ".bss";
for (SizeT sectIndex = 0; sectIndex < numSecs; ++sectIndex)
{
@@ -93,6 +94,10 @@ namespace Boot
fStartAddress = (VoidPtr)((UIntPtr)loadStartAddress + optHdr->mAddressOfEntryPoint);
writer.Write("newosldr: Start Address: ").Write((UIntPtr)fStartAddress).Write("\r");
}
+ else if (StrCmp(sectionForBSS, sect->mName) == 0)
+ {
+ SetMem((VoidPtr)(loadStartAddress + sect->mVirtualAddress), 0, sect->mSizeOfRawData);
+ }
else if (StrCmp(sectionForNewLdr, sect->mName) == 0)
{
struct HANDOVER_INFORMATION_STUB
@@ -111,7 +116,6 @@ namespace Boot
writer.Write("newosldr: offset ").Write(sect->mPointerToRawData).Write(" of ").Write(sect->mName).Write("\r");
- SetMem((VoidPtr)(loadStartAddress + sect->mVirtualAddress), 0, sect->mSizeOfRawData);
CopyMem((VoidPtr)(loadStartAddress + sect->mVirtualAddress), (VoidPtr)((UIntPtr)fBlob + sect->mPointerToRawData), sect->mSizeOfRawData);
}
}