summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2012-09-30 13:14:37 +0000
committerae <ae@FreeBSD.org>2012-09-30 13:14:37 +0000
commit3cb28a548177dff7e6b3492f6a979ea206029986 (patch)
tree0d6383c7d5e0211535e23f3949d3a4b77eef01b6 /sys/boot/common
parent2441140ba83495471e697d8fdab67934bb301a3b (diff)
downloadFreeBSD-src-3cb28a548177dff7e6b3492f6a979ea206029986.zip
FreeBSD-src-3cb28a548177dff7e6b3492f6a979ea206029986.tar.gz
Remember the file format of the last loaded module and try to use it for
next files.
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/module.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c
index fed788d..6203fb2a 100644
--- a/sys/boot/common/module.c
+++ b/sys/boot/common/module.c
@@ -271,6 +271,7 @@ command_lsmod(int argc, char *argv[])
int
file_load(char *filename, vm_offset_t dest, struct preloaded_file **result)
{
+ static int last_file_format = 0;
struct preloaded_file *fp;
int error;
int i;
@@ -279,12 +280,18 @@ file_load(char *filename, vm_offset_t dest, struct preloaded_file **result)
dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest);
error = EFTYPE;
- for (i = 0, fp = NULL; file_formats[i] && fp == NULL; i++) {
+ for (i = last_file_format, fp = NULL;
+ file_formats[i] && fp == NULL; i++) {
error = (file_formats[i]->l_load)(filename, dest, &fp);
if (error == 0) {
- fp->f_loader = i; /* remember the loader */
+ fp->f_loader = last_file_format = i; /* remember the loader */
*result = fp;
break;
+ } else if (last_file_format == i && i != 0) {
+ /* Restart from the beginning */
+ last_file_format = i = 0;
+ fp = NULL;
+ continue;
}
if (error == EFTYPE)
continue; /* Unknown to this handler? */
OpenPOWER on IntegriCloud