Problem with multiboot module
Posted: Fri Apr 03, 2020 6:21 pm
Hello,
Currently I am working on an ELF loader for a POSIX compliant operating system named NexNix. I am loading the file as a module with GRUB. However, the e_ident member of the ELF header is 0 for some reason. This is also just a prototype loader and will be greatly improved on. Here is the code for the loader:
Thank you for your help
Currently I am working on an ELF loader for a POSIX compliant operating system named NexNix. I am loading the file as a module with GRUB. However, the e_ident member of the ELF header is 0 for some reason. This is also just a prototype loader and will be greatly improved on. Here is the code for the loader:
Code: Select all
void create_test_process(multiboot_info* bootinfo)
{
elf32_hdr* p_hdr;
elf32_hdr* buffer = (elf32_hdr*)bootinfo->moduleAddress;
p_hdr = (elf32_hdr*)buffer;
if(p_hdr->e_ident[EI_MAG0] == ELFMAG0)
{
int size = 8192;
int entry = p_hdr->e_entry;
for(int i = 0; i < size; i += 4096)
{
void* block = alloc_block();
map_address(get_directory(), 0x08048000 + i, block, PTE_PRESENT | PTE_WRITEABLE | PTE_USER);
memcpy(buffer, 0x08048000 + i, 4096);
}
void (*entry_point) () = (entry);
entry_point();
}
}