Fix compile errors

This commit is contained in:
fearlessTobi 2018-08-23 18:23:21 +02:00
parent c786df3e4b
commit 2abe11ee1e
2 changed files with 22 additions and 20 deletions

View file

@ -219,19 +219,19 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr,
// Create the CodeSet // Create the CodeSet
SharedPtr<CodeSet> code_set = CodeSet::Create("", 0); SharedPtr<CodeSet> code_set = CodeSet::Create("", 0);
code_set->code.offset = loadinfo.seg_ptrs[0] - program_image.data(); code_set->CodeSegment().offset = loadinfo.seg_ptrs[0] - program_image.data();
code_set->code.addr = loadinfo.seg_addrs[0]; code_set->CodeSegment().addr = loadinfo.seg_addrs[0];
code_set->code.size = loadinfo.seg_sizes[0]; code_set->CodeSegment().size = loadinfo.seg_sizes[0];
code_set->rodata.offset = loadinfo.seg_ptrs[1] - program_image.data(); code_set->RODataSegment().offset = loadinfo.seg_ptrs[1] - program_image.data();
code_set->rodata.addr = loadinfo.seg_addrs[1]; code_set->RODataSegment().addr = loadinfo.seg_addrs[1];
code_set->rodata.size = loadinfo.seg_sizes[1]; code_set->RODataSegment().size = loadinfo.seg_sizes[1];
code_set->data.offset = loadinfo.seg_ptrs[2] - program_image.data(); code_set->DataSegment().offset = loadinfo.seg_ptrs[2] - program_image.data();
code_set->data.addr = loadinfo.seg_addrs[2]; code_set->DataSegment().addr = loadinfo.seg_addrs[2];
code_set->data.size = loadinfo.seg_sizes[2]; code_set->DataSegment().size = loadinfo.seg_sizes[2];
code_set->entrypoint = code_set->code.addr; code_set->entrypoint = code_set->CodeSegment().addr;
code_set->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); code_set->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
LOG_DEBUG(Loader, "code size: {:#X}", loadinfo.seg_sizes[0]); LOG_DEBUG(Loader, "code size: {:#X}", loadinfo.seg_sizes[0]);

View file

@ -76,14 +76,15 @@ ResultStatus AppLoader_NCCH::LoadExec(Kernel::SharedPtr<Kernel::Process>& proces
SharedPtr<CodeSet> codeset = CodeSet::Create(process_name, program_id); SharedPtr<CodeSet> codeset = CodeSet::Create(process_name, program_id);
codeset->code.offset = 0; codeset->CodeSegment().offset = 0;
codeset->code.addr = overlay_ncch->exheader_header.codeset_info.text.address; codeset->CodeSegment().addr = overlay_ncch->exheader_header.codeset_info.text.address;
codeset->code.size = codeset->CodeSegment().size =
overlay_ncch->exheader_header.codeset_info.text.num_max_pages * Memory::PAGE_SIZE; overlay_ncch->exheader_header.codeset_info.text.num_max_pages * Memory::PAGE_SIZE;
codeset->rodata.offset = codeset->code.offset + codeset->code.size; codeset->RODataSegment().offset =
codeset->rodata.addr = overlay_ncch->exheader_header.codeset_info.ro.address; codeset->CodeSegment().offset + codeset->CodeSegment().size;
codeset->rodata.size = codeset->RODataSegment().addr = overlay_ncch->exheader_header.codeset_info.ro.address;
codeset->RODataSegment().size =
overlay_ncch->exheader_header.codeset_info.ro.num_max_pages * Memory::PAGE_SIZE; overlay_ncch->exheader_header.codeset_info.ro.num_max_pages * Memory::PAGE_SIZE;
// TODO(yuriks): Not sure if the bss size is added to the page-aligned .data size or just // TODO(yuriks): Not sure if the bss size is added to the page-aligned .data size or just
@ -91,13 +92,14 @@ ResultStatus AppLoader_NCCH::LoadExec(Kernel::SharedPtr<Kernel::Process>& proces
u32 bss_page_size = (overlay_ncch->exheader_header.codeset_info.bss_size + 0xFFF) & ~0xFFF; u32 bss_page_size = (overlay_ncch->exheader_header.codeset_info.bss_size + 0xFFF) & ~0xFFF;
code.resize(code.size() + bss_page_size, 0); code.resize(code.size() + bss_page_size, 0);
codeset->data.offset = codeset->rodata.offset + codeset->rodata.size; codeset->DataSegment().offset =
codeset->data.addr = overlay_ncch->exheader_header.codeset_info.data.address; codeset->RODataSegment().offset + codeset->RODataSegment().size;
codeset->data.size = codeset->DataSegment().addr = overlay_ncch->exheader_header.codeset_info.data.address;
codeset->DataSegment().size =
overlay_ncch->exheader_header.codeset_info.data.num_max_pages * Memory::PAGE_SIZE + overlay_ncch->exheader_header.codeset_info.data.num_max_pages * Memory::PAGE_SIZE +
bss_page_size; bss_page_size;
codeset->entrypoint = codeset->code.addr; codeset->entrypoint = codeset->CodeSegment().addr;
codeset->memory = std::make_shared<std::vector<u8>>(std::move(code)); codeset->memory = std::make_shared<std::vector<u8>>(std::move(code));
process = Kernel::Process::Create(std::move(codeset)); process = Kernel::Process::Create(std::move(codeset));