diff options
Diffstat (limited to 'stand/common/load_elf_obj.c')
-rw-r--r-- | stand/common/load_elf_obj.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c index ed202e08b780..9e32daa53696 100644 --- a/stand/common/load_elf_obj.c +++ b/stand/common/load_elf_obj.c @@ -26,21 +26,15 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - #include <sys/param.h> #include <sys/exec.h> #include <sys/linker.h> #include <sys/module.h> -#include <stdint.h> -#include <string.h> #include <machine/elf.h> #include <stand.h> -#define FREEBSD_ELF -#include <sys/link_elf.h> #include "bootstrap.h" +#include "modinfo.h" #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) @@ -81,9 +75,6 @@ static int __elfN(obj_parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef); static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx); -const char *__elfN(obj_kerneltype) = "elf kernel"; -const char *__elfN(obj_moduletype) = "elf obj module"; - /* * Attempt to load the file (file) as an ELF module. It will be stored at * (dest), and a pointer to a module structure describing the loaded object @@ -158,7 +149,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, } #endif - kfp = file_findfile(NULL, __elfN(obj_kerneltype)); + kfp = file_findfile(NULL, md_kerntype); if (kfp == NULL) { printf("elf" __XSTRING(__ELF_WORD_SIZE) "_obj_loadfile: can't load module before kernel\n"); @@ -166,10 +157,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, goto oerr; } - if (archsw.arch_loadaddr != NULL) - dest = archsw.arch_loadaddr(LOAD_ELF, hdr, dest); - else - dest = roundup(dest, PAGE_SIZE); + dest = md_align(dest); /* * Ok, we think we should handle this. @@ -182,7 +170,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, goto out; } fp->f_name = strdup(filename); - fp->f_type = strdup(__elfN(obj_moduletype)); + fp->f_type = strdup(md_modtype_obj); if (module_verbose > MODULE_VERBOSE_SILENT) printf("%s ", filename); |