summaryrefslogtreecommitdiff
path: root/core/sysappend.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-04-25 20:08:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2011-04-25 20:25:02 -0700
commit3953ca3532ca3281cc248f9985d9276c6f8486f0 (patch)
treea03065fdb9d42e0d60867136b7abe25bbea99732 /core/sysappend.c
parent57b7af7df6599a8cdb318d7adeda1cd6fb981626 (diff)
downloadsyslinux-3953ca3532ca3281cc248f9985d9276c6f8486f0.tar.gz
Generalize ipappend handling as "sysappend", and move to PM code
Generalize the ipappend handling to cover all the derivatives, and rename it "sysappend" ("ipappend" is a valid alias for all derivatives.) Move all the string handling to protected mode. Currently only pxelinux exports strings, but the plan is to change that in the future. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/sysappend.c')
-rw-r--r--core/sysappend.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/core/sysappend.c b/core/sysappend.c
new file mode 100644
index 00000000..ac35b226
--- /dev/null
+++ b/core/sysappend.c
@@ -0,0 +1,61 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2011 Intel Corporation; author: H. Peter Anvin
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston MA 02110-1301, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <string.h>
+#include <stdio.h>
+#include "core.h"
+
+/*
+ * sysappend.c
+ *
+ */
+
+extern uint32_t SysAppends; /* Configuration variable */
+const char *sysappend_strings[SYSAPPEND_MAX];
+
+/*
+ * Handle sysappend strings for the old real-mode command line generator...
+ * this code should be replaced when all that code is coverted to C.
+ *
+ * Writes the output to ES:DI with a space after each option,
+ * and updates DI to point to the final null.
+ */
+void do_sysappend(com32sys_t *regs)
+{
+ char *q = MK_PTR(regs->es, regs->ebx.w[0]);
+ int i;
+ uint32_t mask = SysAppends;
+
+ for (i = 0; i < SYSAPPEND_MAX; i++) {
+ if (mask & 1) {
+ q = stpcpy(q, sysappend_strings[i]);
+ *q++ = ' ';
+ }
+ mask >>= 1;
+ }
+ *q = '\0';
+
+ regs->ebx.w[0] = OFFS_WRT(q, regs->es);
+}
+
+/*
+ * Print the sysappend strings, in order
+ */
+void print_sysappend(void)
+{
+ int i;
+
+ for (i = 0; i < SYSAPPEND_MAX; i++) {
+ if (sysappend_strings[i])
+ printf("%s\n", sysappend_strings[i]);
+ }
+}