修正复制的段对齐

This commit is contained in:
KAAAsS 2021-05-17 23:48:33 +08:00
parent 872869cf87
commit 4e78127811
Signed by: KAAAsS
GPG Key ID: D56625F3E671882F
2 changed files with 2 additions and 2 deletions

View File

@ -193,7 +193,7 @@ static u64 load_binary(struct process *process,
// 复制段内存
section_data = bin + elf->p_headers[i].p_offset;
alloc_section = (char *) phys_to_virt(pmo->start);
alloc_section = (char *) phys_to_virt(pmo->start) + (p_vaddr & (PAGE_SIZE - 1));
kdebug("Copy segment[%d] from addr %lx -> %lx, len = %d\n", i, section_data, alloc_section, seg_sz);
memcpy(alloc_section, section_data, seg_sz);

View File

@ -207,7 +207,7 @@ static u64 load_binary(struct process *process,
// 复制段内存
section_data = bin + elf->p_headers[i].p_offset;
alloc_section = (char *) phys_to_virt(pmo->start);
alloc_section = (char *) phys_to_virt(pmo->start) + (p_vaddr & (PAGE_SIZE - 1));
kdebug("Copy segment[%d] from addr %lx -> %lx, len = %d\n", i, section_data, alloc_section, seg_sz);
memcpy(alloc_section, section_data, seg_sz);