xfs: Fix inode size attribution
[syslinux.git] / com32 / menu / execute.c
blobc2de7353361fe0504774685c607a505f85ae09fd
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 * Boston MA 02110-1301, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
13 #include <stdlib.h>
14 #include <string.h>
15 #include <com32.h>
16 #include "menu.h"
18 void execute(const char *cmdline, enum kernel_type type)
20 com32sys_t ireg;
21 const char *p, *const *pp;
22 char *q = __com32.cs_bounce;
23 const char *kernel, *args;
25 memset(&ireg, 0, sizeof ireg);
27 kernel = q;
28 p = cmdline;
29 while (*p && !my_isspace(*p)) {
30 *q++ = *p++;
32 *q++ = '\0';
34 args = q;
35 while (*p && my_isspace(*p))
36 p++;
38 strcpy(q, p);
40 if (kernel[0] == '.' && type == KT_NONE) {
41 /* It might be a type specifier */
42 enum kernel_type type = KT_NONE;
43 for (pp = kernel_types; *pp; pp++, type++) {
44 if (!strcmp(kernel + 1, *pp)) {
45 execute(p, type); /* Strip the type specifier and retry */
50 if (type == KT_LOCALBOOT) {
51 ireg.eax.w[0] = 0x0014; /* Local boot */
52 ireg.edx.w[0] = strtoul(kernel, NULL, 0);
53 } else {
54 if (type < KT_KERNEL)
55 type = KT_KERNEL;
57 ireg.eax.w[0] = 0x0016; /* Run kernel image */
58 ireg.esi.w[0] = OFFS(kernel);
59 ireg.ds = SEG(kernel);
60 ireg.ebx.w[0] = OFFS(args);
61 ireg.es = SEG(args);
62 ireg.edx.l = type - KT_KERNEL;
63 /* ireg.ecx.l = 0; *//* We do ipappend "manually" */
66 __intcall(0x22, &ireg, NULL);
68 /* If this returns, something went bad; return to menu */