summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/boot/alpha/libalpha/elf_freebsd.c1
-rw-r--r--sys/boot/common/boot.c5
-rw-r--r--sys/boot/common/bootstrap.h2
-rw-r--r--sys/boot/common/misc.c11
-rw-r--r--sys/boot/i386/libi386/aout_freebsd.c1
-rw-r--r--sys/boot/i386/libi386/elf32_freebsd.c1
-rw-r--r--sys/boot/i386/libi386/elf64_freebsd.c1
-rw-r--r--sys/boot/i386/libi386/elf_freebsd.c1
8 files changed, 18 insertions, 5 deletions
diff --git a/sys/boot/alpha/libalpha/elf_freebsd.c b/sys/boot/alpha/libalpha/elf_freebsd.c
index 71849b5..e76741f 100644
--- a/sys/boot/alpha/libalpha/elf_freebsd.c
+++ b/sys/boot/alpha/libalpha/elf_freebsd.c
@@ -152,6 +152,7 @@ elf_exec(struct preloaded_file *fp)
printf("Entering %s at 0x%lx...\n", fp->f_name, hdr->e_entry);
closeall();
+ dev_cleanup();
alpha_pal_imb();
(*(void (*)())hdr->e_entry)(ffp_save, ptbr_save,
BOOTINFO_MAGIC, &bootinfo_v1, 1, 0);
diff --git a/sys/boot/common/boot.c b/sys/boot/common/boot.c
index dfd400c..7c02e56 100644
--- a/sys/boot/common/boot.c
+++ b/sys/boot/common/boot.c
@@ -110,11 +110,6 @@ command_boot(int argc, char *argv[])
if (archsw.arch_autoload() != 0)
return(CMD_ERROR);
- /* Call cleanup routines */
- for (i = 0; devsw[i] != NULL; ++i)
- if (devsw[i]->dv_cleanup != NULL)
- (devsw[i]->dv_cleanup)();
-
/* Call the exec handler from the loader matching the kernel */
file_formats[fp->f_loader]->l_exec(fp);
return(CMD_ERROR);
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h
index 4c38154..67ca502 100644
--- a/sys/boot/common/bootstrap.h
+++ b/sys/boot/common/bootstrap.h
@@ -314,3 +314,5 @@ extern struct arch_switch archsw;
/* This must be provided by the MD code, but should it be in the archsw? */
extern void delay(int delay);
+
+extern void dev_cleanup(void);
diff --git a/sys/boot/common/misc.c b/sys/boot/common/misc.c
index 819d4a4..bc33c53 100644
--- a/sys/boot/common/misc.c
+++ b/sys/boot/common/misc.c
@@ -131,3 +131,14 @@ hexdump(caddr_t region, size_t len)
}
pager_close();
}
+
+void
+dev_cleanup(void)
+{
+ int i;
+
+ /* Call cleanup routines */
+ for (i = 0; devsw[i] != NULL; ++i)
+ if (devsw[i]->dv_cleanup != NULL)
+ (devsw[i]->dv_cleanup)();
+}
diff --git a/sys/boot/i386/libi386/aout_freebsd.c b/sys/boot/i386/libi386/aout_freebsd.c
index 5f720c2..857dc3a4 100644
--- a/sys/boot/i386/libi386/aout_freebsd.c
+++ b/sys/boot/i386/libi386/aout_freebsd.c
@@ -77,6 +77,7 @@ aout_exec(struct preloaded_file *fp)
bi->bi_symtab = ssym; /* XXX this is only the primary kernel symtab */
bi->bi_esymtab = esym;
+ dev_cleanup();
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop);
panic("exec returned");
diff --git a/sys/boot/i386/libi386/elf32_freebsd.c b/sys/boot/i386/libi386/elf32_freebsd.c
index f528d96..a3ad9fb 100644
--- a/sys/boot/i386/libi386/elf32_freebsd.c
+++ b/sys/boot/i386/libi386/elf32_freebsd.c
@@ -84,6 +84,7 @@ elf_exec(struct preloaded_file *fp)
printf("Start @ 0x%lx ...\n", entry);
#endif
+ dev_cleanup();
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop);
panic("exec returned");
diff --git a/sys/boot/i386/libi386/elf64_freebsd.c b/sys/boot/i386/libi386/elf64_freebsd.c
index f528d96..a3ad9fb 100644
--- a/sys/boot/i386/libi386/elf64_freebsd.c
+++ b/sys/boot/i386/libi386/elf64_freebsd.c
@@ -84,6 +84,7 @@ elf_exec(struct preloaded_file *fp)
printf("Start @ 0x%lx ...\n", entry);
#endif
+ dev_cleanup();
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop);
panic("exec returned");
diff --git a/sys/boot/i386/libi386/elf_freebsd.c b/sys/boot/i386/libi386/elf_freebsd.c
index f528d96..a3ad9fb 100644
--- a/sys/boot/i386/libi386/elf_freebsd.c
+++ b/sys/boot/i386/libi386/elf_freebsd.c
@@ -84,6 +84,7 @@ elf_exec(struct preloaded_file *fp)
printf("Start @ 0x%lx ...\n", entry);
#endif
+ dev_cleanup();
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop);
panic("exec returned");
OpenPOWER on IntegriCloud