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 * ----------------------------------------------------------------------- */
18 void execute(const char *cmdline
, enum kernel_type type
)
21 const char *p
, *const *pp
;
22 char *q
= __com32
.cs_bounce
;
23 const char *kernel
, *args
;
25 memset(&ireg
, 0, sizeof ireg
);
29 while (*p
&& !my_isspace(*p
)) {
35 while (*p
&& my_isspace(*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);
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
);
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 */