fix (ELF): removed field alignment from 'elf_mapping_T'

This commit is contained in:
antifallobst 2023-03-02 18:31:36 +01:00
parent adb457de01
commit 6d41f659d3
3 changed files with 3 additions and 4 deletions

View File

@ -32,7 +32,6 @@ typedef struct {
uint64_t offset_virtual;
uint64_t length_file;
uint64_t length_virtual;
uint64_t alignment;
} elf_mapping_T;
void elf_mappings_apply(elf_mapping_T* mappings, uint64_t num_mappings, uint8_t* buffer, void* base, page_map_T* page_map);

View File

@ -169,8 +169,7 @@ elf_executable_T* elf_executable_create(uint8_t* buffer) {
.offset_file = segments[i].offset,
.offset_virtual = segments[i].address_virtual,
.length_file = segments[i].length_file,
.length_virtual = segments[i].length_memory,
.alignment = segments[i].align
.length_virtual = segments[i].length_memory
};
mappings_index++;
break;

View File

@ -41,7 +41,8 @@ void elf_mapping_apply(elf_mapping_T* mapping, uint8_t* buffer, void* base, page
}
if (mapping->length_virtual > mapping->length_file) {
memory_set(virtual_address + mapping->length_file, 0, mapping->length_virtual - mapping->length_file);
log(LOG_INFO, " zeroing out area: 0x%x <--> 0x%x", virtual_address + mapping->length_file, virtual_address + mapping->length_virtual);
memory_set(virtual_address + mapping->length_file, 0, mapping->length_virtual - mapping->length_file-1);
}
log(LOG_INFO, "Copying data 0x%x --[%d]-> 0x%x", &buffer[mapping->offset_file], mapping->length_file, virtual_address);