aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/include
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2016-07-30 20:37:21 +0200
committerAlex Auvolat <alex@adnab.me>2016-07-30 20:37:21 +0200
commitfa5327d4cc5e47656326b8c0c55d23cd71b04462 (patch)
treee0b9f5a9bf45bedbf8383b8839c98b04c5e44552 /src/kernel/include
parent6466208ec051e58b824cc3c839b6b086ae910fe6 (diff)
downloadkogata-fa5327d4cc5e47656326b8c0c55d23cd71b04462.tar.gz
kogata-fa5327d4cc5e47656326b8c0c55d23cd71b04462.zip
Use elf symbol table instead of map file for kernel
Diffstat (limited to 'src/kernel/include')
-rw-r--r--src/kernel/include/elf.h25
-rw-r--r--src/kernel/include/multiboot.h2
-rw-r--r--src/kernel/include/sys.h4
3 files changed, 29 insertions, 2 deletions
diff --git a/src/kernel/include/elf.h b/src/kernel/include/elf.h
index 6e0c7cb..79ec023 100644
--- a/src/kernel/include/elf.h
+++ b/src/kernel/include/elf.h
@@ -16,6 +16,9 @@
#define PT_PHDR 6
#define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7fffffff
+
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
/* elf_phdr_t :: p_flags : program header entries flags */
#define PF_X (1 << 0)
@@ -52,6 +55,28 @@ typedef struct {
uint32_t p_flags;
uint32_t p_align;
} elf_phdr_t;
+
+typedef struct elf_shdr {
+ uint32_t sh_name;
+ uint32_t sh_type;
+ uint32_t sh_flags;
+ uint32_t sh_addr;
+ uint32_t sh_offset;
+ uint32_t sh_size;
+ uint32_t sh_link;
+ uint32_t sh_info;
+ uint32_t sh_addralign;
+ uint32_t sh_entsize;
+} elf_shdr_t;
+
+typedef struct {
+ uint32_t st_name;
+ uint32_t st_value;
+ uint32_t st_size;
+ uint8_t st_info;
+ uint8_t st_other;
+ uint16_t st_shndx;
+} elf_sym_t;
bool is_elf(fs_handle_t *f);
proc_entry_t elf_load(fs_handle_t *f, process_t *process); //Load an ELF to a process, return entry point
diff --git a/src/kernel/include/multiboot.h b/src/kernel/include/multiboot.h
index f84b626..b340a38 100644
--- a/src/kernel/include/multiboot.h
+++ b/src/kernel/include/multiboot.h
@@ -39,7 +39,7 @@ typedef struct {
union {
struct aout_symbol_table_t aout_sym;
struct elf_section_header_table_t elf_sec;
- } u;
+ };
unsigned long mmap_length;
unsigned long mmap_addr;
} multiboot_info_t;
diff --git a/src/kernel/include/sys.h b/src/kernel/include/sys.h
index 038135b..7d62d9e 100644
--- a/src/kernel/include/sys.h
+++ b/src/kernel/include/sys.h
@@ -3,6 +3,8 @@
#include <debug.h> // common header
#include <config.h>
+typedef struct elf_shdr elf_shdr_t;
+
static inline void outb(uint16_t port, uint8_t value) {
asm volatile("outb %1, %0" : : "dN"(port), "a"(value));
}
@@ -92,7 +94,7 @@ static inline void invlpg(void* addr) {
#define ALIGN4_DOWN(x) (((size_t)x)&MASK4)
-void load_kernel_symbol_map(char* text, size_t len);
+void load_kernel_symbol_table(elf_shdr_t *sym, elf_shdr_t *str);
void kernel_stacktrace(uint32_t ebp, uint32_t eip);
/* vim: set ts=4 sw=4 tw=0 noet :*/