1 /* ----------------------------------------------------------------------- *
3 * Copyright 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 * ----------------------------------------------------------------------- */
16 * Invoke the gPXE "sanboot" command, if available.
31 struct s_PXENV_FILE_EXEC
{
33 struct segoff16 Command
;
36 static void sanboot(const char **args
)
39 struct s_PXENV_FILE_EXEC
*fx
;
42 memset(®
, 0, sizeof reg
);
44 fx
= __com32
.cs_bounce
;
48 fx
->Command
.offs
= OFFS(q
);
49 fx
->Command
.seg
= SEG(q
);
51 q
= stpcpy(q
, "sanboot");
59 memset(®
, 0, sizeof reg
);
60 reg
.eax
.w
[0] = 0x0009;
61 reg
.ebx
.w
[0] = 0x00e5; /* PXENV_FILE_EXEC */
62 reg
.edi
.w
[0] = OFFS(fx
);
65 __intcall(0x22, ®
, ®
);
67 /* This should not return... */
70 int main(int argc
, const char *argv
[])
72 openconsole(&dev_null_r
, &dev_stdcon_w
);
75 printf("Usage: sanboot rootpath\n");
80 printf("sanboot: gPXE API not detected\n");
86 /* sanboot() should not return... */
87 printf("SAN boot failed.\n");