aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-07-03 08:50:13 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-07-20 10:20:19 +0100
commit8486142cf30499e1d53d7faf3a168c8ed3163ab2 (patch)
treed8e4e835da8f577d28f847fdd4a25090cdbf340e
parent373a42433c4bea38d4d93ee749bd4d7f19bded51 (diff)
downloadsyslinux-8486142cf30499e1d53d7faf3a168c8ed3163ab2.tar.gz
syslinux-8486142cf30499e1d53d7faf3a168c8ed3163ab2.tar.xz
syslinux-8486142cf30499e1d53d7faf3a168c8ed3163ab2.zip
elflink: Replace __intcall() with direct function calls
There's no reason to use the COMBOOT API at all now that we can have any undefined symbols resolved at runtime - we can just access functions directly. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r--com32/chain/utility.c30
-rw-r--r--com32/cmenu/libmenu/syslnx.c22
-rw-r--r--com32/elflink/ldlinux/ldlinux.c2
-rw-r--r--com32/include/syslinux/config.h5
-rw-r--r--com32/include/syslinux/features.h10
-rw-r--r--com32/lib/Makefile1
-rw-r--r--com32/lib/sys/ansicon_write.c4
-rw-r--r--com32/lib/sys/rawcon_read.c20
-rw-r--r--com32/lib/sys/rawcon_write.c8
-rw-r--r--com32/lib/sys/serial_write.c8
-rw-r--r--com32/lib/sys/stdcon_write.c15
-rw-r--r--com32/lib/sys/xserial_write.c8
-rw-r--r--com32/lib/syslinux/features.c51
-rw-r--r--com32/lib/syslinux/ipappend.c20
-rw-r--r--com32/lib/syslinux/keyboard.c14
-rw-r--r--com32/lib/syslinux/run_command.c9
-rw-r--r--com32/lib/syslinux/run_default.c10
-rw-r--r--com32/lib/syslinux/runimage.c19
-rw-r--r--com32/lib/syslinux/serial.c19
-rw-r--r--com32/lib/syslinux/shuffle.c9
-rw-r--r--com32/lib/syslinux/version.c21
-rw-r--r--com32/lib/syslinux/video/fontquery.c16
-rw-r--r--com32/lib/syslinux/video/reportmode.c11
-rw-r--r--core/comboot.inc1
-rw-r--r--core/console.c7
-rw-r--r--core/diskfs.inc2
-rw-r--r--core/font.c4
-rw-r--r--core/fs/pxe/pxe.c3
-rw-r--r--core/hello.c6
-rw-r--r--core/include/bios.h1
-rw-r--r--core/include/core.h14
-rw-r--r--core/include/graphics.h5
-rw-r--r--core/isolinux.asm2
33 files changed, 134 insertions, 243 deletions
diff --git a/com32/chain/utility.c b/com32/chain/utility.c
index b54e0cd2..cb882722 100644
--- a/com32/chain/utility.c
+++ b/com32/chain/utility.c
@@ -4,7 +4,9 @@
#include <errno.h>
#include <unistd.h>
#include <string.h>
+#include <fs.h>
#include <syslinux/disk.h>
+#include <syslinux/pmapi.h>
#include "utility.h"
static const char *bpbtypes[] = {
@@ -93,14 +95,11 @@ void lba2chs(disk_chs *dst, const struct disk_info *di, uint64_t lba, uint32_t m
uint32_t get_file_lba(const char *filename)
{
- com32sys_t inregs;
+ struct com32_filedata fd;
uint32_t lba = 0;
int size = 65536;
char *buf;
- /* Start with clean registers */
- memset(&inregs, 0, sizeof(com32sys_t));
-
buf = lmalloc(size);
if (!buf)
return 0;
@@ -108,32 +107,15 @@ uint32_t get_file_lba(const char *filename)
/* Put the filename in the bounce buffer */
strlcpy(buf, filename, size);
- /* Call comapi_open() which returns a structure pointer in SI
- * to a structure whose first member happens to be the LBA.
- */
- inregs.eax.w[0] = 0x0006;
- inregs.esi.w[0] = OFFS(buf);
- inregs.es = SEG(buf);
- __com32.cs_intcall(0x22, &inregs, &inregs);
-
- if ((inregs.eflags.l & EFLAGS_CF) || inregs.esi.w[0] == 0) {
+ if (open_file(buf, &fd) <= 0) {
goto fail; /* Filename not found */
}
/* Since the first member is the LBA, we simply cast */
- lba = *((uint32_t *) MK_PTR(inregs.ds, inregs.esi.w[0]));
-
- /* Clean the registers for the next call */
- memset(&inregs, 0, sizeof(com32sys_t));
-
- /* Put the filename in the bounce buffer */
- strlcpy(buf, filename, size);
+ lba = *((uint32_t *) MK_PTR(0, fd.handle));
/* Call comapi_close() to free the structure */
- inregs.eax.w[0] = 0x0008;
- inregs.esi.w[0] = OFFS(buf);
- inregs.es = SEG(buf);
- __com32.cs_intcall(0x22, &inregs, &inregs);
+ close_file(fd.handle);
fail:
lfree(buf);
diff --git a/com32/cmenu/libmenu/syslnx.c b/com32/cmenu/libmenu/syslnx.c
index 27823df8..c681f585 100644
--- a/com32/cmenu/libmenu/syslnx.c
+++ b/com32/cmenu/libmenu/syslnx.c
@@ -12,7 +12,10 @@
#include <string.h>
#include <com32.h>
+#include <core.h>
+#include <graphics.h>
#include "syslnx.h"
+#include <syslinux/config.h>
com32sys_t inreg, outreg; // Global registers for this module
@@ -35,33 +38,26 @@ void runsyslinuxcmd(const char *cmd)
return;
strcpy(bounce, cmd);
- REG_AX(inreg) = 0x0003; // Run command
- REG_BX(inreg) = OFFS(bounce);
- REG_ES(inreg) = SEG(bounce);
- __intcall(0x22, &inreg, &outreg);
+ load_kernel(bounce);
}
void gototxtmode(void)
{
- REG_AX(inreg) = 0x0005;
- __intcall(0x22, &inreg, &outreg);
+ syslinux_force_text_mode();
}
void syslinux_idle(void)
{
- REG_AX(inreg) = 0x0013;
- __intcall(0x22, &inreg, &outreg);
+ __idle();
}
unsigned int getversion(char *deriv, unsigned int *numfun)
{
- REG_AX(inreg) = 0x0001;
- __intcall(0x22, &inreg, &outreg);
if (deriv)
- *deriv = REG_DL(outreg);
+ *deriv = __syslinux_version.filesystem;
if (numfun)
- *numfun = REG_AX(outreg);
- return REG_CX(outreg);
+ *numfun = __syslinux_version.max_api;
+ return __syslinux_version.version;
}
void runsyslinuximage(const char *cmd, long ipappend)
diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c
index 8879d2a0..073f1116 100644
--- a/com32/elflink/ldlinux/ldlinux.c
+++ b/com32/elflink/ldlinux/ldlinux.c
@@ -137,7 +137,7 @@ static const char *apply_extension(const char *kernel, const char *ext)
* the the kernel. If we return the caller should call enter_cmdline()
* so that the user can help us out.
*/
-static void load_kernel(const char *command_line)
+void load_kernel(const char *command_line)
{
struct menu_entry *me;
const char *cmdline;
diff --git a/com32/include/syslinux/config.h b/com32/include/syslinux/config.h
index 50bd52f5..7bdcdd6b 100644
--- a/com32/include/syslinux/config.h
+++ b/com32/include/syslinux/config.h
@@ -181,4 +181,9 @@ static inline const struct syslinux_ipappend_strings
return &__syslinux_ipappend_strings;
}
+static inline enum syslinux_filesystem syslinux_filesystem(void)
+{
+ return syslinux_derivative_info()->c.filesystem;
+}
+
#endif /* _SYSLINUX_CONFIG_H */
diff --git a/com32/include/syslinux/features.h b/com32/include/syslinux/features.h
index 4bebda49..d25d08d5 100644
--- a/com32/include/syslinux/features.h
+++ b/com32/include/syslinux/features.h
@@ -31,18 +31,16 @@
#define SYSLINUX_FEATURE_LOCAL_BOOT (0*8+0)
#define SYSLINUX_FEATURE_NOOP_IDLE (0*8+1)
-extern struct __syslinux_feature_flags {
- unsigned int len;
- const unsigned char *ptr;
-} __syslinux_feature_flags;
+extern uint8_t feature_flags;
+extern uint8_t feature_flags_len;
static inline int syslinux_has_feature(unsigned int __flag)
{
unsigned int __byte = __flag >> 3;
unsigned int __bit = __flag & 7;
- if (__byte <= __syslinux_feature_flags.len)
- return (__syslinux_feature_flags.ptr[__byte] >> __bit) & 1;
+ if (__byte <= feature_flags_len)
+ return (feature_flags[__byte] >> __bit) & 1;
else
return 0;
}
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index b83ae6be..5d270a49 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -46,7 +46,6 @@ LIBPCI_OBJS = \
LIBSYSLINUX_OBJS = \
syslinux/reboot.o syslinux/keyboard.o \
- syslinux/features.o \
syslinux/version.o \
syslinux/pxe_get_cached.o syslinux/pxe_get_nic.o \
syslinux/pxe_dns.o \
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index b25f2d2e..e5483fbc 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -42,6 +42,7 @@
#include <syslinux/config.h>
#include "file.h"
#include "ansi.h"
+#include "graphics.h"
static void ansicon_erase(const struct term_state *, int, int, int, int);
static void ansicon_write_char(int, int, uint8_t, const struct term_state *);
@@ -90,8 +91,7 @@ int __ansicon_open(struct file_info *fp)
ti.cols = 80;
} else {
/* Force text mode */
- ireg.eax.w[0] = 0x0005;
- __intcall(0x22, &ireg, NULL);
+ syslinux_force_text_mode();
/* Initial state */
ti.rows = BIOS_ROWS ? BIOS_ROWS + 1 : 25;
diff --git a/com32/lib/sys/rawcon_read.c b/com32/lib/sys/rawcon_read.c
index fbcd9364..7eae95f1 100644
--- a/com32/lib/sys/rawcon_read.c
+++ b/com32/lib/sys/rawcon_read.c
@@ -35,31 +35,33 @@
#include <errno.h>
#include <string.h>
#include <com32.h>
+#include <core.h>
#include <minmax.h>
#include "file.h"
/* Global, since it's used by stdcon_read */
ssize_t __rawcon_read(struct file_info *fp, void *buf, size_t count)
{
- com32sys_t ireg, oreg;
char *bufp = buf;
size_t n = 0;
+ char hi = 0;
(void)fp;
- memset(&ireg, 0, sizeof ireg);
-
while (n < count) {
+ if (hi) {
+ *bufp++ = hi;
+ n++;
+ hi = 0;
+ continue;
+ }
+
/* Poll */
- ireg.eax.b[1] = 0x0B;
- __intcall(0x21, &ireg, &oreg);
- if (!oreg.eax.b[0])
+ if (!pollchar())
break;
/* We have data, go get it */
- ireg.eax.b[1] = 0x08;
- __intcall(0x21, &ireg, &oreg);
- *bufp++ = oreg.eax.b[0];
+ *bufp++ = getchar(&hi);
n++;
}
diff --git a/com32/lib/sys/rawcon_write.c b/com32/lib/sys/rawcon_write.c
index 2d45a7b2..1f7920b2 100644
--- a/com32/lib/sys/rawcon_write.c
+++ b/com32/lib/sys/rawcon_write.c
@@ -34,24 +34,20 @@
#include <errno.h>
#include <string.h>
#include <com32.h>
+#include <core.h>
#include <minmax.h>
#include "file.h"
static ssize_t __rawcon_write(struct file_info *fp, const void *buf,
size_t count)
{
- com32sys_t ireg;
const char *bufp = buf;
size_t n = 0;
(void)fp;
- memset(&ireg, 0, sizeof ireg);
- ireg.eax.b[1] = 0x02;
-
while (count--) {
- ireg.edx.b[0] = *bufp++;
- __intcall(0x21, &ireg, NULL);
+ writechr(*bufp++);
n++;
}
diff --git a/com32/lib/sys/serial_write.c b/com32/lib/sys/serial_write.c
index fa0f4f4d..3f949fb7 100644
--- a/com32/lib/sys/serial_write.c
+++ b/com32/lib/sys/serial_write.c
@@ -34,13 +34,13 @@
#include <errno.h>
#include <string.h>
#include <com32.h>
+#include <core.h>
#include <minmax.h>
#include <syslinux/config.h>
#include "file.h"
ssize_t __serial_write(struct file_info *fp, const void *buf, size_t count)
{
- com32sys_t ireg;
const char *bufp = buf;
size_t n = 0;
@@ -49,12 +49,8 @@ ssize_t __serial_write(struct file_info *fp, const void *buf, size_t count)
if (!syslinux_serial_console_info()->iobase)
return count; /* Nothing to do */
- memset(&ireg, 0, sizeof ireg);
- ireg.eax.b[1] = 0x04;
-
while (count--) {
- ireg.edx.b[0] = *bufp++;
- __intcall(0x21, &ireg, NULL);
+ write_serial(*bufp++);
n++;
}
diff --git a/com32/lib/sys/stdcon_write.c b/com32/lib/sys/stdcon_write.c
index 9cb2f7db..9bd225f9 100644
--- a/com32/lib/sys/stdcon_write.c
+++ b/com32/lib/sys/stdcon_write.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <string.h>
#include <com32.h>
+#include <core.h>
#include <minmax.h>
#include "file.h"
@@ -57,22 +58,16 @@ static int __stdcon_open(struct file_info *fp)
static ssize_t __stdcon_write(struct file_info *fp, const void *buf,
size_t count)
{
- com32sys_t ireg;
const char *bufp = buf;
size_t n = 0;
(void)fp;
- memset(&ireg, 0, sizeof ireg);
- ireg.eax.b[1] = 0x02;
-
while (count--) {
- if (*bufp == '\n') {
- ireg.edx.b[0] = '\r';
- __intcall(0x21, &ireg, NULL);
- }
- ireg.edx.b[0] = *bufp++;
- __intcall(0x21, &ireg, NULL);
+ if (*bufp == '\n')
+ writechr('\r');
+
+ writechr(*bufp++);
n++;
}
diff --git a/com32/lib/sys/xserial_write.c b/com32/lib/sys/xserial_write.c
index e399f5fc..8a4fb9e0 100644
--- a/com32/lib/sys/xserial_write.c
+++ b/com32/lib/sys/xserial_write.c
@@ -35,6 +35,7 @@
#include <errno.h>
#include <string.h>
#include <com32.h>
+#include <core.h>
#include <minmax.h>
#include <colortbl.h>
#include <syslinux/config.h>
@@ -42,12 +43,7 @@
static void emit(char ch)
{
- static com32sys_t ireg; /* Zeroed with the BSS */
-
- ireg.eax.b[1] = 0x04;
- ireg.edx.b[0] = ch;
-
- __intcall(0x21, &ireg, NULL);
+ write_serial(ch);
}
ssize_t __xserial_write(struct file_info *fp, const void *buf, size_t count)
diff --git a/com32/lib/syslinux/features.c b/com32/lib/syslinux/features.c
deleted file mode 100644
index c88aef30..00000000
--- a/com32/lib/syslinux/features.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall
- * be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * syslinux/features.c
- *
- * SYSLINUX feature flag query
- */
-
-#include <klibc/compiler.h>
-#include <syslinux/features.h>
-#include <string.h>
-#include <com32.h>
-
-struct __syslinux_feature_flags __syslinux_feature_flags;
-
-void __constructor __syslinux_detect_features(void)
-{
- static com32sys_t reg;
-
- memset(&reg, 0, sizeof reg);
- reg.eax.w[0] = 0x0015;
- __intcall(0x22, &reg, &reg);
-
- __syslinux_feature_flags.len = reg.ecx.w[0];
- __syslinux_feature_flags.ptr = MK_PTR(reg.es, reg.ebx.w[0]);
-}
diff --git a/com32/lib/syslinux/ipappend.c b/com32/lib/syslinux/ipappend.c
index bd000920..3eda48cf 100644
--- a/com32/lib/syslinux/ipappend.c
+++ b/com32/lib/syslinux/ipappend.c
@@ -33,26 +33,18 @@
#include <syslinux/config.h>
#include <klibc/compiler.h>
-#include <com32.h>
+#include <core.h>
struct syslinux_ipappend_strings __syslinux_ipappend_strings;
static const char *syslinux_ipappend_string_list[32];
void __constructor __syslinux_get_ipappend_strings(void)
{
- static com32sys_t reg;
- int i;
+ unsigned int i;
- reg.eax.w[0] = 0x000f;
- __intcall(0x22, &reg, &reg);
+ __syslinux_ipappend_strings.count = (size_t)numIPAppends;
+ __syslinux_ipappend_strings.ptr = syslinux_ipappend_string_list;
- if (!(reg.eflags.l & EFLAGS_CF)) {
- __syslinux_ipappend_strings.count = reg.ecx.w[0];
- __syslinux_ipappend_strings.ptr = syslinux_ipappend_string_list;
- for (i = 0; i < reg.ecx.w[0]; i++) {
- syslinux_ipappend_string_list[i] =
- MK_PTR(reg.es,
- *(uint16_t *) MK_PTR(reg.es, reg.ebx.w[0] + i * 2));
- }
- }
+ for (i = 0; i < (size_t)numIPAppends; i++)
+ syslinux_ipappend_string_list[i] = (const char *)(size_t)IPAppends[i];
}
diff --git a/com32/lib/syslinux/keyboard.c b/com32/lib/syslinux/keyboard.c
index feafde0d..03bd216a 100644
--- a/com32/lib/syslinux/keyboard.c
+++ b/com32/lib/syslinux/keyboard.c
@@ -26,19 +26,13 @@
* ----------------------------------------------------------------------- */
#include <syslinux/keyboard.h>
-#include <com32.h>
+#include <core.h>
struct syslinux_keyboard_map __syslinux_keyboard_map;
void __constructor __syslinux_get_keyboard_map(void)
{
- static com32sys_t reg;
-
- reg.eax.w[0] = 0x001e;
- __intcall(0x22, &reg, &reg);
- if (!(reg.eflags.l & EFLAGS_CF)) {
- __syslinux_keyboard_map.version = reg.eax.w[0];
- __syslinux_keyboard_map.length = reg.ecx.w[0];
- __syslinux_keyboard_map.map = MK_PTR(reg.es, reg.ebx.w[0]);
- }
+ __syslinux_keyboard_map.version = 1;
+ __syslinux_keyboard_map.length = sizeof(KbdMap);
+ __syslinux_keyboard_map.map = (void *)KbdMap;
}
diff --git a/com32/lib/syslinux/run_command.c b/com32/lib/syslinux/run_command.c
index a0ac9a0d..0efb61f2 100644
--- a/com32/lib/syslinux/run_command.c
+++ b/com32/lib/syslinux/run_command.c
@@ -28,21 +28,16 @@
#include <syslinux/boot.h>
#include <stddef.h>
#include <string.h>
-#include <com32.h>
+#include <core.h>
int syslinux_run_command(const char *command)
{
- static com32sys_t ireg;
char *lm_command = lstrdup(command);
if (!lm_command)
return -1;
- ireg.eax.w[0] = 0x0003;
- ireg.es = SEG(lm_command);
- /* ireg.ebx.w[0] = OFFS(lm_command); */
-
- __intcall(0x22, &ireg, NULL);
+ create_args_and_load(lm_command);
/* Should not return even on failure, but in case... */
lfree(lm_command);
diff --git a/com32/lib/syslinux/run_default.c b/com32/lib/syslinux/run_default.c
index 8dc9fbe4..0cfa5470 100644
--- a/com32/lib/syslinux/run_default.c
+++ b/com32/lib/syslinux/run_default.c
@@ -26,16 +26,14 @@
* ----------------------------------------------------------------------- */
#include <syslinux/boot.h>
+#include <core.h>
#include <stddef.h>
-#include <com32.h>
+
+extern const char *default_cmd;
__noreturn syslinux_run_default(void)
{
- static com32sys_t ireg;
-
- ireg.eax.w[0] = 0x0004;
- __intcall(0x22, &ireg, NULL);
-
+ load_kernel(default_cmd);
/* Should not return even on failure */
for (;;) ;
}
diff --git a/com32/lib/syslinux/runimage.c b/com32/lib/syslinux/runimage.c
index d5cdbc62..4391114c 100644
--- a/com32/lib/syslinux/runimage.c
+++ b/com32/lib/syslinux/runimage.c
@@ -34,15 +34,18 @@
#include <stdlib.h>
#include <string.h>
#include <syslinux/boot.h>
-#include <com32.h>
+#include <syslinux/config.h>
+#include <core.h>
+
+extern unsigned int ipappend;
void syslinux_run_kernel_image(const char *filename, const char *cmdline,
uint32_t ipappend_flags, uint32_t type)
{
- static com32sys_t ireg;
char *bbfilename = NULL;
char *bbcmdline = NULL;
+
bbfilename = lstrdup(filename);
if (!bbfilename)
goto fail;
@@ -51,16 +54,10 @@ void syslinux_run_kernel_image(const char *filename, const char *cmdline,
if (!bbcmdline)
goto fail;
+ if (syslinux_filesystem() == SYSLINUX_FS_PXELINUX)
+ ipappend = ipappend_flags;
- ireg.eax.w[0] = 0x0016;
- ireg.ds = SEG(bbfilename);
- /* ireg.esi.w[0] = OFFS(bbfilename); */
- ireg.es = SEG(bbcmdline);
- /* ireg.ebx.w[0] = OFFS(bbcmdline); */
- ireg.ecx.l = ipappend_flags;
- ireg.edx.l = type;
-
- __intcall(0x22, &ireg, 0);
+ execute(bbfilename, type);
fail:
if (bbcmdline)
diff --git a/com32/lib/syslinux/serial.c b/com32/lib/syslinux/serial.c
index f06e8c8e..bb92222f 100644
--- a/com32/lib/syslinux/serial.c
+++ b/com32/lib/syslinux/serial.c
@@ -34,19 +34,22 @@
#include <klibc/compiler.h>
#include <syslinux/config.h>
#include <string.h>
-#include <com32.h>
+#include <bios.h>
+#include <core.h>
struct syslinux_serial_console_info __syslinux_serial_console_info;
void __constructor __syslinux_get_serial_console_info(void)
{
- static com32sys_t reg;
+ uint16_t flowctl;
- memset(&reg, 0, sizeof reg);
- reg.eax.w[0] = 0x000b;
- __intcall(0x22, &reg, &reg);
+ __syslinux_serial_console_info.iobase = SerialPort;
+ __syslinux_serial_console_info.divisor = BaudDivisor;
- __syslinux_serial_console_info.iobase = reg.edx.w[0];
- __syslinux_serial_console_info.divisor = reg.ecx.w[0];
- __syslinux_serial_console_info.flowctl = reg.ebx.w[0];
+ flowctl = FlowOutput | FlowInput | (FlowIgnore << 4);
+
+ if (!DisplayCon)
+ flowctl |= (0x80 << 8);
+
+ __syslinux_serial_console_info.flowctl = flowctl;
}
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index e9ee6aad..544915a3 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -38,6 +38,7 @@
#include <string.h>
#include <inttypes.h>
#include <com32.h>
+#include <core.h>
#include <minmax.h>
#include <dprintf.h>
#include <syslinux/movebits.h>
@@ -51,12 +52,8 @@ static int shuffler_size;
static void __constructor __syslinux_get_shuffer_size(void)
{
- static com32sys_t reg;
-
- reg.eax.w[0] = 0x0023;
- __intcall(0x22, &reg, &reg);
-
- shuffler_size = (reg.eflags.l & EFLAGS_CF) ? 2048 : reg.ecx.w[0];
+ /* +15 padding is to guarantee alignment */
+ shuffler_size = __bcopyxx_len + 15;
}
/*
diff --git a/com32/lib/syslinux/version.c b/com32/lib/syslinux/version.c
index 15b617b0..1cd2efd3 100644
--- a/com32/lib/syslinux/version.c
+++ b/com32/lib/syslinux/version.c
@@ -27,20 +27,23 @@
#include <syslinux/config.h>
#include <klibc/compiler.h>
-#include <com32.h>
+#include <core.h>
+#include <../../../version.h>
struct syslinux_version __syslinux_version;
void __constructor __syslinux_get_version(void)
{
- static com32sys_t reg;
+ __syslinux_version.version = (VERSION_MAJOR << 8) + VERSION_MINOR;
- reg.eax.w[0] = 0x0001;
- __intcall(0x22, &reg, &reg);
+ /* We no longer support the COMBOOT API */
+ __syslinux_version.max_api = 0xffff;
- __syslinux_version.version = reg.ecx.w[0];
- __syslinux_version.max_api = reg.eax.w[0];
- __syslinux_version.filesystem = reg.edx.b[0];
- __syslinux_version.version_string = MK_PTR(reg.es, reg.esi.w[0]);
- __syslinux_version.copyright_string = MK_PTR(reg.es, reg.edi.w[0]);
+ __syslinux_version.filesystem = syslinux_filesystem();
+
+ /* Skip leading CR LF */
+ __syslinux_version.version_string = &syslinux_banner[2];
+
+ /* Skip leading space */
+ __syslinux_version.copyright_string = &copyright_str[1];
}
diff --git a/com32/lib/syslinux/video/fontquery.c b/com32/lib/syslinux/video/fontquery.c
index dd5d86e3..ac1fab3f 100644
--- a/com32/lib/syslinux/video/fontquery.c
+++ b/com32/lib/syslinux/video/fontquery.c
@@ -31,24 +31,18 @@
*/
#include <syslinux/video.h>
-#include <com32.h>
+#include <graphics.h>
/*
* Returns height of font or zero if no custom font loaded
*/
int syslinux_font_query(uint8_t **font)
{
- static com32sys_t ireg;
- com32sys_t oreg;
- int height;
+ if (!UserFont)
+ return 0;
- ireg.eax.w[0] = 0x0018;
- __intcall(0x22, &ireg, &oreg);
+ *font = (uint8_t *)fontbuf;
- height = !(oreg.eflags.l & EFLAGS_CF) ? oreg.eax.b[0] : 0;
- if (height)
- *font = MK_PTR(oreg.es, oreg.ebx.w[0]);
-
- return height;
+ return VGAFontSize;
}
diff --git a/com32/lib/syslinux/video/reportmode.c b/com32/lib/syslinux/video/reportmode.c
index 57fd6fdc..2a2c5770 100644
--- a/com32/lib/syslinux/video/reportmode.c
+++ b/com32/lib/syslinux/video/reportmode.c
@@ -31,15 +31,12 @@
*/
#include <syslinux/video.h>
-#include <com32.h>
+#include <graphics.h>
void syslinux_report_video_mode(uint16_t flags, uint16_t xsize, uint16_t ysize)
{
- static com32sys_t ireg;
+ if (flags > 0x0f)
+ return;
- ireg.eax.w[0] = 0x0017;
- ireg.ebx.w[0] = flags;
- ireg.ecx.w[0] = xsize;
- ireg.edx.w[0] = ysize;
- __intcall(0x22, &ireg, NULL);
+ using_vga(flags, xsize, ysize);
}
diff --git a/core/comboot.inc b/core/comboot.inc
index 1e19d288..175c50c9 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -842,6 +842,7 @@ zero_string db 0 ; Empty, null-terminated string
; Note: PXELINUX clears the idle is noop flag if appropriate
; in pxe_detect_nic_type
;
+ global feature_flags, feature_flags_len
feature_flags:
db 1 ; Have local boot, idle is not noop
feature_flags_len equ ($-feature_flags)
diff --git a/core/console.c b/core/console.c
index 282c57f5..3b545bbd 100644
--- a/core/console.c
+++ b/core/console.c
@@ -1,18 +1,15 @@
#include <stddef.h>
#include <com32.h>
+#include <core.h>
#include <stdio.h>
#include <string.h>
void myputchar(int c)
{
- static com32sys_t ireg;
-
if (c == '\n')
myputchar('\r');
- ireg.eax.b[1] = 0x02;
- ireg.edx.b[0] = c;
- __intcall(0x21, &ireg, NULL);
+ writechr(c);
}
void myputs(const char *str)
diff --git a/core/diskfs.inc b/core/diskfs.inc
index 02382cc6..dcbc924a 100644
--- a/core/diskfs.inc
+++ b/core/diskfs.inc
@@ -109,9 +109,9 @@ PXERetry dw 0 ; Extra PXE retries
section .data16
global SerialNotice
SerialNotice db 1 ; Only print this once
+ global IPAppends, numIPAppends
%if IS_PXELINUX
extern IPOption
- global IPAppends, numIPAppends
alignz 2
IPAppends dw IPOption
numIPAppends equ ($-IPAppends)/2
diff --git a/core/font.c b/core/font.c
index 31fb29e7..9e7aa8f2 100644
--- a/core/font.c
+++ b/core/font.c
@@ -26,9 +26,7 @@
#include "graphics.h"
#include "core.h"
-static __lowmem char fontbuf[8192];
-
-extern uint8_t UserFont;
+__lowmem char fontbuf[8192];
uint16_t GXPixCols = 1; /* Graphics mode pixel columns */
uint16_t GXPixRows = 1; /* Graphics mode pixel rows */
diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 8c956235..1e64b583 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -1187,9 +1187,6 @@ static void ip_init(void)
/*
* Print the IPAPPEND strings, in order
*/
-extern const uint16_t IPAppends[];
-extern const char numIPAppends[];
-
static void print_ipappend(void)
{
size_t i;
diff --git a/core/hello.c b/core/hello.c
index 5b224784..d30fc3b9 100644
--- a/core/hello.c
+++ b/core/hello.c
@@ -9,14 +9,10 @@
void myputchar(int c)
{
- static com32sys_t ireg;
-
if (c == '\n')
myputchar('\r');
- ireg.eax.b[1] = 0x02;
- ireg.edx.b[0] = c;
- __intcall(0x21, &ireg, NULL);
+ writechr(c);
}
void myputs(const char *str)
diff --git a/core/include/bios.h b/core/include/bios.h
index 4bf6bc43..42a9768c 100644
--- a/core/include/bios.h
+++ b/core/include/bios.h
@@ -74,7 +74,6 @@ extern union screen _screensize;
#define VidRows _screensize.b.row
/* font.c */
-extern uint16_t VGAFontSize;
extern void use_font(void);
extern void bios_adjust_screen(void);
diff --git a/core/include/core.h b/core/include/core.h
index 6604a5bc..da94dbf4 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -25,9 +25,19 @@ extern char ConfigFile[];
extern char syslinux_banner[];
extern char copyright_str[];
extern char StackBuf[];
+extern unsigned int __bcopyxx_len;
extern uint8_t KbdMap[256];
+extern const uint16_t IPAppends[];
+extern const char numIPAppends[];
+
+extern uint16_t SerialPort;
+extern uint16_t BaudDivisor;
+extern uint8_t FlowOutput;
+extern uint8_t FlowInput;
+extern uint8_t FlowIgnore;
+
/* diskstart.inc isolinux.asm*/
extern void getlinsec(void);
@@ -101,16 +111,20 @@ static inline void set_flags(com32sys_t *regs, uint32_t flags)
}
extern int start_ldlinux(char **argv);
+extern int create_args_and_load(char *);
extern void write_serial(char data);
extern void writestr(char *str);
extern void writechr(char data);
extern void crlf(void);
+extern int pollchar(void);
+extern char getchar(char *hi);
extern void cleanup_hardware(void);
extern void sirq_cleanup(void);
extern void adjust_screen(void);
extern void execute(const char *cmdline, uint32_t type);
+extern void load_kernel(const char *cmdline);
#endif /* CORE_H */
diff --git a/core/include/graphics.h b/core/include/graphics.h
index 897103e5..814ffe7d 100644
--- a/core/include/graphics.h
+++ b/core/include/graphics.h
@@ -44,6 +44,11 @@ extern uint16_t VGAPos;
extern uint16_t *VGAFilePtr;
extern char VGAFileBuf[VGA_FILE_BUF_SIZE];
extern char VGAFileMBuf[];
+extern uint16_t VGAFontSize;
+
+extern uint8_t UserFont;
+
+extern __lowmem char fontbuf[8192];
extern void syslinux_force_text_mode(void);
extern void vgadisplayfile(FILE *_fd);
diff --git a/core/isolinux.asm b/core/isolinux.asm
index 4790887c..5930a1ee 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -1219,9 +1219,9 @@ PXERetry dw 0 ; Extra PXE retries
section .data16
global SerialNotice
SerialNotice db 1 ; Only print this once
+ global IPAppends, numIPAppends
%if IS_PXELINUX
extern IPOption
- global IPAppends, numIPAppends
alignz 2
IPAppends dw IPOption
numIPAppends equ ($-IPAppends)/2