add additional error messages
This commit is contained in:
parent
d2a3137749
commit
20b074d81c
1 changed files with 13 additions and 1 deletions
|
@ -419,6 +419,7 @@ static int load_task(load_args_t* largs)
|
|||
//elf_section_header_t sec_header;
|
||||
vfs_node_t* node;
|
||||
task_t* curr_task = per_core(current_task);
|
||||
int err;
|
||||
|
||||
if (!largs)
|
||||
return -EINVAL;
|
||||
|
@ -427,7 +428,12 @@ static int load_task(load_args_t* largs)
|
|||
if (!node)
|
||||
return -EINVAL;
|
||||
|
||||
read_fs(node, (uint8_t*)&header, sizeof(elf_header_t), 0);
|
||||
err = read_fs(node, (uint8_t*)&header, sizeof(elf_header_t), 0);
|
||||
if (err < 0) {
|
||||
kprintf("read_fs failed: %d\n", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (BUILTIN_EXPECT(header.ident.magic != ELF_MAGIC, 0))
|
||||
goto invalid;
|
||||
|
||||
|
@ -595,6 +601,12 @@ static int load_task(load_args_t* largs)
|
|||
|
||||
invalid:
|
||||
kprintf("Invalid executable!\n");
|
||||
kprintf("magic number 0x%x\n", (uint32_t) header.ident.magic);
|
||||
kprintf("header type 0x%x\n", (uint32_t) header.type);
|
||||
kprintf("machine type 0x%x\n", (uint32_t) header.machine);
|
||||
kprintf("elf ident class 0x%x\n", (uint32_t) header.ident._class);
|
||||
kprintf("elf identdata !0x%x\n", header.ident.data);
|
||||
kprintf("program entry point 0x%x\n", (size_t) header.entry);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue