ldlinux: Make the default execute type KT_KERNEL
authorMatt Fleming <matt.fleming@intel.com>
Tue, 13 Mar 2012 09:39:14 +0000 (09:39 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Fri, 23 Mar 2012 16:56:16 +0000 (16:56 +0000)
Default to trying to boot a linux kernel image, which was the
behaviour of the old asm image file loader.

Note that we don't need to go through __intcall() to load a kernel as
the dynamic linker will fixup any references to the kernel load
functions for us at runtime. Furthermore, modules invoking execute()
could be located anywhere in the 32-bit address space and may not be
able to represent their pointer arguments with SEG() and OFFS(), so
using the comboot API may not even work.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
com32/elflink/ldlinux/execute.c

index b3ed958..269b74d 100644 (file)
@@ -86,10 +86,6 @@ void execute(const char *cmdline, enum kernel_type type)
                /* new entry for elf format c32 */
                lfree(kernel);
                create_args_and_load(cmdline);
-       } else if (type == KT_KERNEL) {
-               /* Need add one item for kernel load, as we don't use
-               * the assembly runkernel.inc any more */
-               new_linux_kernel(kernel, cmdline);
        } else if (type == KT_CONFIG) {
                char *argv[] = { "ldlinux.c32", NULL };
 
@@ -101,22 +97,15 @@ void execute(const char *cmdline, enum kernel_type type)
                        mangle_name(config_cwd, args);
 
                start_ldlinux("ldlinux.c32", 1, argv);
-       } else {
+       } else if (type == KT_LOCALBOOT) {
                /* process the image need int 22 support */
-               if (type == KT_LOCALBOOT) {
-                       ireg.eax.w[0] = 0x0014; /* Local boot */
-                       ireg.edx.w[0] = strtoul(kernel, NULL, 0);
-               } else {
-                       ireg.eax.w[0] = 0x0016; /* Run kernel image */
-                       ireg.esi.w[0] = OFFS(kernel);
-                       ireg.ds = SEG(kernel);
-                       ireg.ebx.w[0] = OFFS(args);
-                       ireg.es = SEG(args);
-                       ireg.edx.l = type - KT_KERNEL;
-                       /* ireg.ecx.l    = 0; *//* We do ipappend "manually" */
-               }
-
+               ireg.eax.w[0] = 0x0014; /* Local boot */
+               ireg.edx.w[0] = strtoul(kernel, NULL, 0);
                __intcall(0x22, &ireg, NULL);
+       } else {
+               /* Need add one item for kernel load, as we don't use
+               * the assembly runkernel.inc any more */
+               new_linux_kernel(kernel, cmdline);
        }
 
        lfree(kernel);