diff options
Diffstat (limited to 'com32/lib')
-rw-r--r-- | com32/lib/Makefile | 1 | ||||
-rw-r--r-- | com32/lib/sys/ansicon_write.c | 4 | ||||
-rw-r--r-- | com32/lib/sys/rawcon_read.c | 20 | ||||
-rw-r--r-- | com32/lib/sys/rawcon_write.c | 8 | ||||
-rw-r--r-- | com32/lib/sys/serial_write.c | 8 | ||||
-rw-r--r-- | com32/lib/sys/stdcon_write.c | 15 | ||||
-rw-r--r-- | com32/lib/sys/xserial_write.c | 8 | ||||
-rw-r--r-- | com32/lib/syslinux/features.c | 51 | ||||
-rw-r--r-- | com32/lib/syslinux/ipappend.c | 20 | ||||
-rw-r--r-- | com32/lib/syslinux/keyboard.c | 14 | ||||
-rw-r--r-- | com32/lib/syslinux/run_command.c | 9 | ||||
-rw-r--r-- | com32/lib/syslinux/run_default.c | 10 | ||||
-rw-r--r-- | com32/lib/syslinux/runimage.c | 19 | ||||
-rw-r--r-- | com32/lib/syslinux/serial.c | 19 | ||||
-rw-r--r-- | com32/lib/syslinux/shuffle.c | 9 | ||||
-rw-r--r-- | com32/lib/syslinux/version.c | 21 | ||||
-rw-r--r-- | com32/lib/syslinux/video/fontquery.c | 16 | ||||
-rw-r--r-- | com32/lib/syslinux/video/reportmode.c | 11 |
18 files changed, 83 insertions, 180 deletions
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(®, 0, sizeof reg); - reg.eax.w[0] = 0x0015; - __intcall(0x22, ®, ®); - - __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, ®, ®); + __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, ®, ®); - 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(®, 0, sizeof reg); - reg.eax.w[0] = 0x000b; - __intcall(0x22, ®, ®); + __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, ®, ®); - - 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, ®, ®); + /* 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 = ©right_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); } |