0.0.2d: Added BGA support, graphics!
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
#define ALIGN_UP(x) (((x) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
|
||||
|
||||
elf_executable_t* load_elf32(void* elf_data)
|
||||
int load_elf32(void* elf_data, elf_executable_t** ptr)
|
||||
{
|
||||
Elf32_Ehdr* ehdr = (Elf32_Ehdr*)elf_data;
|
||||
|
||||
@ -19,13 +19,13 @@ elf_executable_t* load_elf32(void* elf_data)
|
||||
if (memcmp(ehdr->e_ident, (uint8_t*)("\x7F""ELF"), 4) != 0)
|
||||
{
|
||||
printf("Invalid ELF file\n");
|
||||
return NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ehdr->e_machine != 3 || ehdr->e_type != 2)
|
||||
{
|
||||
printf("Unsupported ELF type or architecture\n");
|
||||
return NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Elf32_Phdr* phdrs = (Elf32_Phdr*)((uint8_t*)elf_data + ehdr->e_phoff);
|
||||
@ -60,10 +60,17 @@ elf_executable_t* load_elf32(void* elf_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
elf_executable_t* result = malloc(sizeof(elf_executable_t));
|
||||
result->entry_point = (elf_entry_t)(uintptr_t)ehdr->e_entry;
|
||||
return result;
|
||||
*ptr = malloc(sizeof(elf_executable_t));
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
(*ptr)->entry_point = (elf_entry_t)(uintptr_t) ehdr->e_entry;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
/*
|
||||
elf_executable_t* result = malloc(sizeof(elf_executable_t));
|
||||
result->entry_point = (elf_entry_t)(uintptr_t)ehdr->e_entry;*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user