diff options
author | bp <bp@FreeBSD.org> | 2000-05-01 17:41:25 +0000 |
---|---|---|
committer | bp <bp@FreeBSD.org> | 2000-05-01 17:41:25 +0000 |
commit | 816e92565a65b81ec26724758fea6f694964d18f (patch) | |
tree | 1dc1dbf863d6b27d97804bdaca0c1d05f196c481 /sys/boot/alpha | |
parent | 222439bc50eba6251adfdfbf06fc7474d33911ad (diff) | |
download | FreeBSD-src-816e92565a65b81ec26724758fea6f694964d18f.zip FreeBSD-src-816e92565a65b81ec26724758fea6f694964d18f.tar.gz |
Update loader logic to distinguish modules vs. files.
Add support for module metadata. The old way of dependancy
handling will be supported for a while.
Reviewed by: peter
Diffstat (limited to 'sys/boot/alpha')
-rw-r--r-- | sys/boot/alpha/common/conf.c | 4 | ||||
-rw-r--r-- | sys/boot/alpha/libalpha/bootinfo.c | 38 | ||||
-rw-r--r-- | sys/boot/alpha/libalpha/elf_freebsd.c | 22 |
3 files changed, 32 insertions, 32 deletions
diff --git a/sys/boot/alpha/common/conf.c b/sys/boot/alpha/common/conf.c index 5f2f519..c1f9ea1 100644 --- a/sys/boot/alpha/common/conf.c +++ b/sys/boot/alpha/common/conf.c @@ -81,9 +81,9 @@ struct netif_driver *netif_drivers[] = { * Sort formats so that those that can detect based on arguments * rather than reading the file go first. */ -extern struct module_format alpha_elf; +extern struct file_format alpha_elf; -struct module_format *module_formats[] = { +struct file_format *file_formats[] = { &alpha_elf, NULL }; diff --git a/sys/boot/alpha/libalpha/bootinfo.c b/sys/boot/alpha/libalpha/bootinfo.c index 1e23f51..5a2b681 100644 --- a/sys/boot/alpha/libalpha/bootinfo.c +++ b/sys/boot/alpha/libalpha/bootinfo.c @@ -125,19 +125,19 @@ bi_copyenv(vm_offset_t addr) vm_offset_t bi_copymodules(vm_offset_t addr) { - struct loaded_module *mp; - struct module_metadata *md; + struct preloaded_file *fp; + struct file_metadata *md; /* start with the first module on the list, should be the kernel */ - for (mp = mod_findmodule(NULL, NULL); mp != NULL; mp = mp->m_next) { - - MOD_NAME(addr, mp->m_name); /* this field must come first */ - MOD_TYPE(addr, mp->m_type); - if (mp->m_args) - MOD_ARGS(addr, mp->m_args); - MOD_ADDR(addr, mp->m_addr); - MOD_SIZE(addr, mp->m_size); - for (md = mp->m_metadata; md != NULL; md = md->md_next) + for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) { + + MOD_NAME(addr, fp->f_name); /* this field must come first */ + MOD_TYPE(addr, fp->f_type); + if (fp->f_args) + MOD_ARGS(addr, fp->f_args); + MOD_ADDR(addr, fp->f_addr); + MOD_SIZE(addr, fp->f_size); + for (md = fp->f_metadata; md != NULL; md = md->md_next) if (!(md->md_type & MODINFOMD_NOCOPY)) MOD_METADATA(addr, md); } @@ -153,15 +153,15 @@ bi_copymodules(vm_offset_t addr) */ int bi_load(struct bootinfo_v1 *bi, vm_offset_t *ffp_save, - struct loaded_module *mp) + struct preloaded_file *fp) { char *rootdevname; struct alpha_devdesc *rootdev; - struct loaded_module *xp; + struct preloaded_file *xp; vm_offset_t addr, bootinfo_addr; u_int pad; vm_offset_t ssym, esym; - struct module_metadata *md; + struct file_metadata *md; /* * Allow the environment variable 'rootdev' to override the supplied device @@ -180,9 +180,9 @@ bi_load(struct bootinfo_v1 *bi, vm_offset_t *ffp_save, free(rootdev); ssym = esym = 0; - if ((md = mod_findmetadata(mp, MODINFOMD_SSYM)) != NULL) + if ((md = file_findmetadata(fp, MODINFOMD_SSYM)) != NULL) ssym = *((vm_offset_t *)&(md->md_data)); - if ((md = mod_findmetadata(mp, MODINFOMD_ESYM)) != NULL) + if ((md = file_findmetadata(fp, MODINFOMD_ESYM)) != NULL) esym = *((vm_offset_t *)&(md->md_data)); if (ssym == 0 || esym == 0) ssym = esym = 0; /* sanity */ @@ -192,9 +192,9 @@ bi_load(struct bootinfo_v1 *bi, vm_offset_t *ffp_save, /* find the last module in the chain */ addr = 0; - for (xp = mod_findmodule(NULL, NULL); xp != NULL; xp = xp->m_next) { - if (addr < (xp->m_addr + xp->m_size)) - addr = xp->m_addr + xp->m_size; + for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { + if (addr < (xp->f_addr + xp->f_size)) + addr = xp->f_addr + xp->f_size; } /* pad to a page boundary */ pad = (u_int)addr & PAGE_MASK; diff --git a/sys/boot/alpha/libalpha/elf_freebsd.c b/sys/boot/alpha/libalpha/elf_freebsd.c index 4efd603..71849b5 100644 --- a/sys/boot/alpha/libalpha/elf_freebsd.c +++ b/sys/boot/alpha/libalpha/elf_freebsd.c @@ -90,37 +90,37 @@ #define _KERNEL -static int elf_exec(struct loaded_module *amp); +static int elf_exec(struct preloaded_file *afp); int bi_load(struct bootinfo_v1 *, vm_offset_t *, - struct loaded_module *); + struct preloaded_file *); -struct module_format alpha_elf = { elf_loadmodule, elf_exec }; +struct file_format alpha_elf = { elf_loadfile, elf_exec }; vm_offset_t ffp_save, ptbr_save; static int -elf_exec(struct loaded_module *mp) +elf_exec(struct preloaded_file *fp) { static struct bootinfo_v1 bootinfo_v1; - struct module_metadata *md; + struct file_metadata *md; Elf_Ehdr *hdr; int err; int flen; - if ((md = mod_findmetadata(mp, MODINFOMD_ELFHDR)) == NULL) + if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) return(EFTYPE); /* XXX actually EFUCKUP */ hdr = (Elf_Ehdr *)&(md->md_data); /* XXX ffp_save does not appear to be used in the kernel.. */ bzero(&bootinfo_v1, sizeof(bootinfo_v1)); - err = bi_load(&bootinfo_v1, &ffp_save, mp); + err = bi_load(&bootinfo_v1, &ffp_save, fp); if (err) return(err); /* * Fill in the bootinfo for the kernel. */ - strncpy(bootinfo_v1.booted_kernel, mp->m_name, + strncpy(bootinfo_v1.booted_kernel, fp->f_name, sizeof(bootinfo_v1.booted_kernel)); flen = prom_getenv(PROM_E_BOOTED_OSFLAGS, bootinfo_v1.boot_flags, sizeof(bootinfo_v1.boot_flags)); @@ -133,8 +133,8 @@ elf_exec(struct loaded_module *mp) /* * Append the boot command flags. */ - if (mp->m_args != NULL && *mp->m_args != '\0') { - const char *p = mp->m_args; + if (fp->f_args != NULL && *fp->f_args != '\0') { + const char *p = fp->f_args; do { if (*p == '-') { @@ -150,7 +150,7 @@ elf_exec(struct loaded_module *mp) bootinfo_v1.boot_flags[flen] = '\0'; } - printf("Entering %s at 0x%lx...\n", mp->m_name, hdr->e_entry); + printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry); closeall(); alpha_pal_imb(); (*(void (*)())hdr->e_entry)(ffp_save, ptbr_save, |