> 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
 16:54:21 up 6 days, 11:59,  1 user,  load average: 1.31, 0.74, 0.52
This commit is contained in:
tracer-ics2023
2024-09-23 16:54:24 +08:00
committed by zzy
parent e23464e959
commit 930aee289a

View File

@ -17,13 +17,13 @@ static uintptr_t loader(PCB *pcb, const char *filename) {
size_t ramdisk_read(void *buf, size_t offset, size_t len);
ret = ramdisk_read(&ehdr, 0, sizeof(ehdr));
assert(ret == sizeof(ehdr));
// assert(ehdr.e_ident[0] == 0x7f && ehdr.e_ident[1] == 'E' && ehdr.e_ident[2] == 'L' && ehdr.e_ident[3] == 'F');
assert(memcpy(ehdr.e_ident, ELFMAG, SELFMAG) == 0);
//assert(*(uint32_t *)ehdr.e_ident == 0x7f454746);
assert(ehdr.e_ident[0] == 0x7f && ehdr.e_ident[1] == 'E' && ehdr.e_ident[2] == 'L' && ehdr.e_ident[3] == 'F');
// assert(memcpy(ehdr.e_ident, ELFMAG, SELFMAG) == 0);
// assert(*(uint32_t *)ehdr.e_ident == 0x7f454746);
Elf_Phdr phdr[ehdr.e_phnum];
assert(ehdr.e_phentsize % sizeof(Elf_Phdr) == ehdr.e_phnum);
ret = ramdisk_read(&phdr, ehdr.e_phoff, ehdr.e_phentsize);
ret = ramdisk_read(phdr, ehdr.e_phoff, ehdr.e_phentsize);
assert(ret == sizeof(phdr));
for (int i = 0; i < ehdr.e_phnum; i ++) {