1 /* -*- c -*- ------------------------------------------------------------- *
3 * Copyright 2004-2005 Murali Krishnan Ganapathy - 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., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
17 com32sys_t inreg
, outreg
; // Global registers for this module
21 REG_EAX(inreg
) = 0x00003000;
22 REG_EBX(inreg
) = REG_ECX(inreg
) = REG_EDX(inreg
) = 0xFFFFFFFF;
23 __intcall(0x21, &inreg
, &outreg
);
24 return (REG_EAX(outreg
) == 0x59530000) &&
25 (REG_EBX(outreg
) == 0x4c530000) &&
26 (REG_ECX(outreg
) == 0x4e490000) && (REG_EDX(outreg
) == 0x58550000);
29 void runsyslinuxcmd(const char *cmd
)
31 strcpy(__com32
.cs_bounce
, cmd
);
32 REG_AX(inreg
) = 0x0003; // Run command
33 REG_BX(inreg
) = OFFS(__com32
.cs_bounce
);
34 REG_ES(inreg
) = SEG(__com32
.cs_bounce
);
35 __intcall(0x22, &inreg
, &outreg
);
38 void gototxtmode(void)
40 REG_AX(inreg
) = 0x0005;
41 __intcall(0x22, &inreg
, &outreg
);
44 void syslinux_idle(void)
46 REG_AX(inreg
) = 0x0013;
47 __intcall(0x22, &inreg
, &outreg
);
50 unsigned int getversion(char *deriv
, unsigned int *numfun
)
52 REG_AX(inreg
) = 0x0001;
53 __intcall(0x22, &inreg
, &outreg
);
55 *deriv
= REG_DL(outreg
);
57 *numfun
= REG_AX(outreg
);
58 return REG_CX(outreg
);
61 void runsyslinuximage(const char *cmd
, long ipappend
)
63 unsigned int numfun
= 0;
66 (void)ipappend
; // XXX: Unused?!
68 getversion(NULL
, &numfun
);
69 // Function 16h not supported Fall back to runcommand
72 // Try the Run Kernel Image function
73 // Split command line into
74 strcpy(__com32
.cs_bounce
, cmd
);
75 ptr
= __com32
.cs_bounce
;
76 // serach for first space or end of string
77 while ((*ptr
) && (*ptr
!= ' '))
80 cmdline
= ptr
; // no command line
82 *ptr
++ = '\0'; // terminate kernal name
84 while (*cmdline
!= ' ')
85 cmdline
++; // find first non-space
87 // Now call the interrupt
88 REG_BX(inreg
) = OFFS(cmdline
);
89 REG_ES(inreg
) = SEG(cmdline
);
90 REG_SI(inreg
) = OFFS(__com32
.cs_bounce
);
91 REG_DS(inreg
) = SEG(__com32
.cs_bounce
);
94 __intcall(0x22, &inreg
, &outreg
); // If successful does not return