aboutsummaryrefslogtreecommitdiff
path: root/sys/boot
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2012-09-30 13:14:37 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2012-09-30 13:14:37 +0000
commitb3651aad673dcf3e008ec6194f23ef447b7f17b2 (patch)
tree0d6383c7d5e0211535e23f3949d3a4b77eef01b6 /sys/boot
parent95b2c05cf06b562102eeb0cbf2ee33f82bf9a993 (diff)
downloadsrc-b3651aad673dcf3e008ec6194f23ef447b7f17b2.tar.gz
src-b3651aad673dcf3e008ec6194f23ef447b7f17b2.zip
Remember the file format of the last loaded module and try to use it for
next files.
Notes
Notes: svn path=/head/; revision=241069
Diffstat (limited to 'sys/boot')
-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 fed788d3c33e..6203fb2a3473 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? */