> compile NEMU

221220000 张三
Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
 19:46:31 up 6 days, 14:52,  1 user,  load average: 0.60, 0.60, 0.47
This commit is contained in:
tracer-ics2023
2024-09-23 19:46:34 +08:00
committed by zzy
parent 8a610f144e
commit b5556ac6e7

View File

@ -22,13 +22,10 @@ static uintptr_t loader(PCB *pcb, const char *filename) {
// assert(*(uint32_t *)ehdr.e_ident == 0x7f454746);
Elf_Phdr phdr[ehdr.e_phnum];
printf("phdr num is %d, %d, %d\n", ehdr.e_phnum, sizeof(Elf_Phdr), ehdr.e_phentsize);
assert(ehdr.e_phentsize % ehdr.e_phnum == 0);
ret = ramdisk_read(phdr, ehdr.e_phoff, sizeof(phdr));
assert(ret == ehdr.e_phentsize);
assert(ret == ehdr.e_phentsize * ehdr.e_phnum);
for (int i = 0; i < ehdr.e_phnum; i ++) {
printf("phdr [%d] type %d : [%x, %x)\n", i, phdr[i].p_type, phdr[i].p_offset, phdr[i].p_filesz);
if (phdr[i].p_type != PT_LOAD) {
continue;
}