aboutsummaryrefslogtreecommitdiffstats
path: root/com32/cmenu/libmenu/syslnx.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2009-03-02 10:51:25 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2009-03-02 10:51:25 -0800
commit37bfb1cb8b4c1d670e0d407b83c5270f7c457389 (patch)
tree81096599d4315dc2debb8c3faa189371d1d15566 /com32/cmenu/libmenu/syslnx.c
parent2b570465a0df2070aca723559a9f309d92530e6a (diff)
downloadsyslinux-37bfb1cb8b4c1d670e0d407b83c5270f7c457389.tar.gz
syslinux-37bfb1cb8b4c1d670e0d407b83c5270f7c457389.tar.xz
syslinux-37bfb1cb8b4c1d670e0d407b83c5270f7c457389.zip
Move complex menu to com32/cmenu; clean up the Makefiles
Move the complex menu system into the com32 directory so it can be sequenced properly with respect to hdt (it needs to be built after com32/lib but before com32/hdt). While we're at it, clean up the Makefiles somewhat.
Diffstat (limited to 'com32/cmenu/libmenu/syslnx.c')
-rw-r--r--com32/cmenu/libmenu/syslnx.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/com32/cmenu/libmenu/syslnx.c b/com32/cmenu/libmenu/syslnx.c
new file mode 100644
index 00000000..d2b0aef4
--- /dev/null
+++ b/com32/cmenu/libmenu/syslnx.c
@@ -0,0 +1,88 @@
+/* -*- c -*- ------------------------------------------------------------- *
+ *
+ * Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <string.h>
+#include <com32.h>
+#include "syslnx.h"
+
+com32sys_t inreg,outreg; // Global registers for this module
+
+char issyslinux(void)
+{
+ REG_EAX(inreg) = 0x00003000;
+ REG_EBX(inreg) = REG_ECX(inreg) = REG_EDX(inreg) = 0xFFFFFFFF;
+ __intcall(0x21,&inreg,&outreg);
+ return (REG_EAX(outreg) == 0x59530000) &&
+ (REG_EBX(outreg) == 0x4c530000) &&
+ (REG_ECX(outreg) == 0x4e490000) &&
+ (REG_EDX(outreg) == 0x58550000);
+}
+
+void runsyslinuxcmd(const char *cmd)
+{
+ strcpy(__com32.cs_bounce, cmd);
+ REG_AX(inreg) = 0x0003; // Run command
+ REG_BX(inreg) = OFFS(__com32.cs_bounce);
+ REG_ES(inreg) = SEG(__com32.cs_bounce);
+ __intcall(0x22, &inreg, &outreg);
+}
+
+void gototxtmode(void)
+{
+ REG_AX(inreg) = 0x0005;
+ __intcall(0x22,&inreg,&outreg);
+}
+
+void syslinux_idle(void)
+{
+ REG_AX(inreg) = 0x0013;
+ __intcall(0x22,&inreg,&outreg);
+}
+
+unsigned int getversion(char *deriv,unsigned int *numfun)
+{
+ REG_AX(inreg) = 0x0001;
+ __intcall(0x22,&inreg,&outreg);
+ if (deriv) *deriv= REG_DL(outreg);
+ if (numfun) *numfun = REG_AX(outreg);
+ return REG_CX(outreg);
+}
+
+void runsyslinuximage(const char*cmd, long ipappend)
+{
+ unsigned int numfun = 0;
+ char *ptr,*cmdline;
+
+ getversion(NULL,&numfun);
+ // Function 16h not supported Fall back to runcommand
+ if (numfun < 0x16) runsyslinuxcmd(cmd);
+ // Try the Run Kernel Image function
+ // Split command line into
+ strcpy(__com32.cs_bounce,cmd);
+ ptr = __com32.cs_bounce;
+ // serach for first space or end of string
+ while ( (*ptr) && (*ptr != ' ')) ptr++;
+ if (!*ptr) cmdline = ptr; // no command line
+ else {
+ *ptr++='\0'; // terminate kernal name
+ cmdline = ptr+1;
+ while (*cmdline != ' ') cmdline++; // find first non-space
+ }
+ // Now call the interrupt
+ REG_BX(inreg) = OFFS(cmdline);
+ REG_ES(inreg) = SEG(cmdline);
+ REG_SI(inreg) = OFFS(__com32.cs_bounce);
+ REG_DS(inreg) = SEG(__com32.cs_bounce);
+ REG_EDX(inreg) = 0;
+
+ __intcall(0x22,&inreg,&outreg); // If successful does not return
+}