diff options
| author | 2018-08-03 14:33:59 -0400 | |
|---|---|---|
| committer | 2018-08-03 14:45:45 -0400 | |
| commit | 2beda7c2b3d2fe70ff36edf178d9bb2f5b308bf9 (patch) | |
| tree | 8decd2e8d79f579920f1da76190b46a68eac5f88 /src/core/loader | |
| parent | Merge pull request #908 from lioncash/memory (diff) | |
| download | yuzu-2beda7c2b3d2fe70ff36edf178d9bb2f5b308bf9.tar.gz yuzu-2beda7c2b3d2fe70ff36edf178d9bb2f5b308bf9.tar.xz yuzu-2beda7c2b3d2fe70ff36edf178d9bb2f5b308bf9.zip | |
kernel/process: Use accessors instead of class members for referencing segment array
Using member variables for referencing the segments array increases the
size of the class in memory for little benefit. The same behavior can be
achieved through the use of accessors that just return the relevant
segment.
Diffstat (limited to 'src/core/loader')
| -rw-r--r-- | src/core/loader/elf.cpp | 6 | ||||
| -rw-r--r-- | src/core/loader/nro.cpp | 2 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp index 352938dcb..a7133f5a6 100644 --- a/src/core/loader/elf.cpp +++ b/src/core/loader/elf.cpp | |||
| @@ -311,11 +311,11 @@ SharedPtr<CodeSet> ElfReader::LoadInto(u32 vaddr) { | |||
| 311 | CodeSet::Segment* codeset_segment; | 311 | CodeSet::Segment* codeset_segment; |
| 312 | u32 permission_flags = p->p_flags & (PF_R | PF_W | PF_X); | 312 | u32 permission_flags = p->p_flags & (PF_R | PF_W | PF_X); |
| 313 | if (permission_flags == (PF_R | PF_X)) { | 313 | if (permission_flags == (PF_R | PF_X)) { |
| 314 | codeset_segment = &codeset->code; | 314 | codeset_segment = &codeset->CodeSegment(); |
| 315 | } else if (permission_flags == (PF_R)) { | 315 | } else if (permission_flags == (PF_R)) { |
| 316 | codeset_segment = &codeset->rodata; | 316 | codeset_segment = &codeset->RODataSegment(); |
| 317 | } else if (permission_flags == (PF_R | PF_W)) { | 317 | } else if (permission_flags == (PF_R | PF_W)) { |
| 318 | codeset_segment = &codeset->data; | 318 | codeset_segment = &codeset->DataSegment(); |
| 319 | } else { | 319 | } else { |
| 320 | LOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i, | 320 | LOG_ERROR(Loader, "Unexpected ELF PT_LOAD segment id {} with flags {:X}", i, |
| 321 | p->p_flags); | 321 | p->p_flags); |
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 7d3ec2a76..dc053cdad 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp | |||
| @@ -159,7 +159,7 @@ bool AppLoader_NRO::LoadNro(FileSys::VirtualFile file, VAddr load_base) { | |||
| 159 | // Resize program image to include .bss section and page align each section | 159 | // Resize program image to include .bss section and page align each section |
| 160 | bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); | 160 | bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); |
| 161 | } | 161 | } |
| 162 | codeset->data.size += bss_size; | 162 | codeset->DataSegment().size += bss_size; |
| 163 | program_image.resize(static_cast<u32>(program_image.size()) + bss_size); | 163 | program_image.resize(static_cast<u32>(program_image.size()) + bss_size); |
| 164 | 164 | ||
| 165 | // Load codeset for current process | 165 | // Load codeset for current process |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 06b1b33f4..fee7d58c6 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -127,7 +127,7 @@ VAddr AppLoader_NSO::LoadModule(FileSys::VirtualFile file, VAddr load_base) { | |||
| 127 | // Resize program image to include .bss section and page align each section | 127 | // Resize program image to include .bss section and page align each section |
| 128 | bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); | 128 | bss_size = PageAlignSize(mod_header.bss_end_offset - mod_header.bss_start_offset); |
| 129 | } | 129 | } |
| 130 | codeset->data.size += bss_size; | 130 | codeset->DataSegment().size += bss_size; |
| 131 | const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)}; | 131 | const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)}; |
| 132 | program_image.resize(image_size); | 132 | program_image.resize(image_size); |
| 133 | 133 | ||