diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-15 10:43:19 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-15 10:43:19 +0200 |
| commit | 86640816e8b1d3595365f1fcc8a2a9e61fb40ff1 (patch) | |
| tree | eed7de21285b72905f819f9f84e673ce77e039a3 /Boot/Sources | |
| parent | 98403fe342c8c2795de34e922958ee8d02c94e04 (diff) | |
[IMP] MHR-28: Zero memory on BSS regions.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Boot/Sources')
| -rw-r--r-- | Boot/Sources/Thread.cxx | 6 |
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); } } |
