summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-14 13:35:50 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-17 11:39:55 +0200
commit86f60379f71ec6d0aa3b93eaacc55bc5f453bda5 (patch)
tree395ccb92281d5d198892ba478ffe5dbb0af23f42 /i386
parentffd4f3c8239b41d3fe9fa14403eb063e02b6a222 (diff)
ddb: add support for ELF symbol tables
* ddb/db_elf.c: New file. * ddb/db_elf.h: Likewise. * Makefrag.am (libkernel_a_SOURCES): Add db_elf.{c,h}. * ddb/db_sym.c (dummy_db_sym_init): New stub db_sym_init function. (db_sym_switch): Add ELF functions. * ddb/db_sym.h (SYMTAB_ELF): New macro. (elf_db_sym_init): New declaration. * i386/i386at/model_dep.c (c_boot_entry): Get ELF section header information from the multiboot structure, and call elf_db_sym_init.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386at/model_dep.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 209cfb1..bc34c9b 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -82,7 +82,16 @@
#if MACH_KDB
#include <ddb/db_sym.h>
#include <i386/db_interface.h>
+
+/* a.out symbol table */
static vm_offset_t kern_sym_start, kern_sym_end;
+
+/* ELF section header */
+static unsigned elf_shdr_num;
+static vm_size_t elf_shdr_size;
+static vm_offset_t elf_shdr_addr;
+static unsigned elf_shdr_shndx;
+
#else /* MACH_KDB */
#define kern_sym_start 0
#define kern_sym_end 0
@@ -570,6 +579,17 @@ void c_boot_entry(vm_offset_t bi)
kern_sym_start, kern_sym_end,
symtab_size, strtab_size);
}
+
+ if ((boot_info.flags & MULTIBOOT_ELF_SHDR)
+ && boot_info.syms.e.num)
+ {
+ elf_shdr_num = boot_info.syms.e.num;
+ elf_shdr_size = boot_info.syms.e.size;
+ elf_shdr_addr = (vm_offset_t)phystokv(boot_info.syms.e.addr);
+ elf_shdr_shndx = boot_info.syms.e.shndx;
+
+ printf("ELF section header table at %08lx\n", elf_shdr_addr);
+ }
#endif /* MACH_KDB */
#endif /* MACH_XEN */
@@ -588,6 +608,13 @@ void c_boot_entry(vm_offset_t bi)
{
aout_db_sym_init((char *)kern_sym_start, (char *)kern_sym_end, "mach", (char *)0);
}
+
+ if (elf_shdr_num)
+ {
+ elf_db_sym_init(elf_shdr_num,elf_shdr_size,
+ elf_shdr_addr, elf_shdr_shndx,
+ "mach", NULL);
+ }
#endif /* MACH_KDB */
machine_slot[0].is_cpu = TRUE;