mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-08-28 05:06:02 +00:00
Re-add ELF support
This commit is contained in:
parent
210af599ab
commit
3b1d05ecce
1 changed files with 52 additions and 51 deletions
|
@ -4,9 +4,10 @@
|
|||
#include "memory.hpp"
|
||||
|
||||
using namespace ELFIO;
|
||||
using namespace KernelMemoryTypes;
|
||||
|
||||
std::optional<u32> Memory::loadELF(std::ifstream& file) {
|
||||
/* loadedCXI = std::nullopt; // ELF files don't have a CXI, so set this to null
|
||||
loadedCXI = std::nullopt; // ELF files don't have a CXI, so set this to null
|
||||
|
||||
elfio reader;
|
||||
if (!file.good() || !reader.load(file)) {
|
||||
|
@ -24,6 +25,7 @@ std::optional<u32> Memory::loadELF(std::ifstream& file) {
|
|||
auto segNum = reader.segments.size();
|
||||
printf("Number of segments: %d\n", segNum);
|
||||
printf(" # Perms Vaddr File Size Mem Size\n");
|
||||
|
||||
for (int i = 0; i < segNum; ++i) {
|
||||
const auto seg = reader.segments[i];
|
||||
const auto flags = seg->get_flags();
|
||||
|
@ -55,12 +57,11 @@ std::optional<u32> Memory::loadELF(std::ifstream& file) {
|
|||
Helpers::warn("Rounding ELF segment size to %08X\n", memorySize);
|
||||
}
|
||||
|
||||
// This should also assert that findPaddr doesn't fail
|
||||
u32 fcramAddr = findPaddr(memorySize).value();
|
||||
std::memcpy(&fcram[fcramAddr], data, fileSize);
|
||||
allocMemory(vaddr, memorySize / Memory::pageSize, FcramRegion::App, r, w, x, MemoryState::Code);
|
||||
copyToVaddr(vaddr, data, fileSize);
|
||||
}
|
||||
|
||||
// ELF can't specify a region, make it default to USA
|
||||
region = Regions::USA;
|
||||
return static_cast<u32>(reader.get_entry());*/
|
||||
return std::nullopt;
|
||||
return static_cast<u32>(reader.get_entry());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue