Added load_program() function

Builds program image from ELF file in memory
Fixed multiple definition error caused by constant in elf.h:
moved contant to elf.c
This commit is contained in:
2021-04-17 00:56:44 -05:00
parent 2d6fa0d163
commit 9630d0a396
2 changed files with 47 additions and 6 deletions

View File

@@ -1,10 +1,9 @@
#pragma once
#include "pageallocator.h"
#include "types/physaddr.h"
#include <stdint.h>
const uint32_t elf_magic_number = 0x464c457f;
enum elf_endianness_t
{
ELF_LITTLE_ENDIAN = 1,
@@ -107,11 +106,13 @@ struct elf_section_header_t
};
#if defined __i386__
static const elf_isa_t HOST_ISA = ELF_ISA_x86;
static const enum elf_isa_t HOST_ISA = ELF_ISA_x86;
#elif defined __x86_64__
static const elf_isa_t HOST_ISA = ELF_ISA_x86_64;
static const enum elf_isa_t HOST_ISA = ELF_ISA_x86_64;
#elif defined __arm__
static const elf_isa_t HOST_ISA = ELF_ISA_ARM;
static const enum elf_isa_t HOST_ISA = ELF_ISA_ARM;
#elif defined __aarch64__
static const elf_isa_t HOST_ISA = ELF_ISA_AARCH64;
static const enum elf_isa_t HOST_ISA = ELF_ISA_AARCH64;
#endif
int load_program(struct elf_file_header_t *elf, struct page_stack_t *page_stack);