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) &&
27 (REG_EDX(outreg
) == 0x58550000);
30 void runsyslinuxcmd(const char *cmd
)
32 strcpy(__com32
.cs_bounce
, cmd
);
33 REG_AX(inreg
) = 0x0003; // Run command
34 REG_BX(inreg
) = OFFS(__com32
.cs_bounce
);
35 REG_ES(inreg
) = SEG(__com32
.cs_bounce
);
36 __intcall(0x22, &inreg
, &outreg
);
39 void gototxtmode(void)
41 REG_AX(inreg
) = 0x0005;
42 __intcall(0x22,&inreg
,&outreg
);
45 void syslinux_idle(void)
47 REG_AX(inreg
) = 0x0013;
48 __intcall(0x22,&inreg
,&outreg
);
51 unsigned int getversion(char *deriv
,unsigned int *numfun
)
53 REG_AX(inreg
) = 0x0001;
54 __intcall(0x22,&inreg
,&outreg
);
55 if (deriv
) *deriv
= REG_DL(outreg
);
56 if (numfun
) *numfun
= REG_AX(outreg
);
57 return REG_CX(outreg
);
60 void runsyslinuximage(const char*cmd
, long ipappend
)
62 unsigned int numfun
= 0;
65 getversion(NULL
,&numfun
);
66 // Function 16h not supported Fall back to runcommand
67 if (numfun
< 0x16) runsyslinuxcmd(cmd
);
68 // Try the Run Kernel Image function
69 // Split command line into
70 strcpy(__com32
.cs_bounce
,cmd
);
71 ptr
= __com32
.cs_bounce
;
72 // serach for first space or end of string
73 while ( (*ptr
) && (*ptr
!= ' ')) ptr
++;
74 if (!*ptr
) cmdline
= ptr
; // no command line
76 *ptr
++='\0'; // terminate kernal name
78 while (*cmdline
!= ' ') cmdline
++; // find first non-space
80 // Now call the interrupt
81 REG_BX(inreg
) = OFFS(cmdline
);
82 REG_ES(inreg
) = SEG(cmdline
);
83 REG_SI(inreg
) = OFFS(__com32
.cs_bounce
);
84 REG_DS(inreg
) = SEG(__com32
.cs_bounce
);
87 __intcall(0x22,&inreg
,&outreg
); // If successful does not return