aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--com32/include/syslinux/video.h2
-rw-r--r--com32/lib/Makefile5
-rw-r--r--com32/lib/sys/vesa/initvesa.c19
-rw-r--r--com32/lib/syslinux/video/fontquery.c54
-rw-r--r--com32/lib/syslinux/video/forcetext.c42
-rw-r--r--com32/lib/syslinux/video/reportmode.c45
6 files changed, 153 insertions, 14 deletions
diff --git a/com32/include/syslinux/video.h b/com32/include/syslinux/video.h
index 737c742b..93df2a06 100644
--- a/com32/include/syslinux/video.h
+++ b/com32/include/syslinux/video.h
@@ -38,6 +38,6 @@
void syslinux_force_text_mode(void);
int syslinux_report_video_mode(uint16_t flags, uint16_t xsize, uint16_t ysize);
-int syslinux_font_query(void **font);
+int syslinux_font_query(uint8_t **font);
#endif /* _SYSLINUX_API_H */
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index ad77bcd6..ff5887b0 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -110,7 +110,10 @@ LIBOBJS = \
syslinux/pxe_get_cached.o syslinux/pxe_get_nic.o \
\
syslinux/adv.o syslinux/advwrite.o syslinux/getadv.o \
- syslinux/setadv.o
+ syslinux/setadv.o \
+ \
+ syslinux/video/fontquery.o syslinux/video/forcetext.o \
+ syslinux/video/reportmode.o
BINDIR = /usr/bin
LIBDIR = /usr/lib
diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c
index 0221fcf7..f1224a17 100644
--- a/com32/lib/sys/vesa/initvesa.c
+++ b/com32/lib/sys/vesa/initvesa.c
@@ -37,6 +37,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/fpu.h>
+#include <syslinux/video.h>
#include "vesa.h"
#include "video.h"
#include "fill.h"
@@ -240,12 +241,10 @@ static int vesacon_set_mode(int x, int y)
__vesacon_format_pixels = __vesacon_format_pixels_list[bestpxf];
/* Download the SYSLINUX- or BIOS-provided font */
- rm.eax.w[0] = 0x0018; /* Query custom font */
- __intcall(0x22, &rm, &rm);
- if (!(rm.eflags.l & EFLAGS_CF) && rm.eax.b[0]) {
- __vesacon_font_height = rm.eax.b[0];
- rom_font = MK_PTR(rm.es, rm.ebx.w[0]);
- } else {
+ __vesacon_font_height = syslinux_font_query(&rom_font);
+ if (!__vesacon_font_height) {
+ /* Get BIOS 8x16 font */
+
rm.eax.w[0] = 0x1130; /* Get Font Information */
rm.ebx.w[0] = 0x0600; /* Get 8x16 ROM font */
__intcall(0x10, &rm, &rm);
@@ -270,17 +269,13 @@ static int vesacon_set_mode(int x, int y)
__vesacon_init_copy_to_screen();
/* Tell syslinux we changed video mode */
- rm.eax.w[0] = 0x0017; /* Report video mode change */
/* In theory this should be:
- rm.ebx.w[0] = (mi->mode_attr & 4) ? 0x0007 : 0x000f;
+ flags = (mi->mode_attr & 4) ? 0x0007 : 0x000f;
However, that would assume all systems that claim to handle text
output in VESA modes actually do that... */
- rm.ebx.w[0] = 0x000f;
- rm.ecx.w[0] = mi->h_res;
- rm.edx.w[0] = mi->v_res;
- __intcall(0x22, &rm, NULL);
+ syslinux_report_video_mode(0x000f, mi->h_res, mi->v_res);
__vesacon_pixel_format = bestpxf;
diff --git a/com32/lib/syslinux/video/fontquery.c b/com32/lib/syslinux/video/fontquery.c
new file mode 100644
index 00000000..dd5d86e3
--- /dev/null
+++ b/com32/lib/syslinux/video/fontquery.c
@@ -0,0 +1,54 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ * 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/video/forcetext.c
+ */
+
+#include <syslinux/video.h>
+#include <com32.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;
+
+ ireg.eax.w[0] = 0x0018;
+ __intcall(0x22, &ireg, &oreg);
+
+ height = !(oreg.eflags.l & EFLAGS_CF) ? oreg.eax.b[0] : 0;
+ if (height)
+ *font = MK_PTR(oreg.es, oreg.ebx.w[0]);
+
+ return height;
+}
+
diff --git a/com32/lib/syslinux/video/forcetext.c b/com32/lib/syslinux/video/forcetext.c
new file mode 100644
index 00000000..136cb279
--- /dev/null
+++ b/com32/lib/syslinux/video/forcetext.c
@@ -0,0 +1,42 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ * 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/video/forcetext.c
+ */
+
+#include <syslinux/video.h>
+#include <com32.h>
+
+void syslinux_force_text_mode(void)
+{
+ static com32sys_t ireg;
+
+ ireg.eax.w[0] = 0x0005;
+ __intcall(0x22, &ireg, NULL);
+}
diff --git a/com32/lib/syslinux/video/reportmode.c b/com32/lib/syslinux/video/reportmode.c
new file mode 100644
index 00000000..6e100f15
--- /dev/null
+++ b/com32/lib/syslinux/video/reportmode.c
@@ -0,0 +1,45 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *
+ * 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/video/reportmode.c
+ */
+
+#include <syslinux/video.h>
+#include <com32.h>
+
+int syslinux_report_video_mode(uint16_t flags, uint16_t xsize, uint16_t ysize)
+{
+ static com32sys_t ireg;
+
+ ireg.eax.w[0] = 0x0017;
+ ireg.ebx.w[0] = flags;
+ ireg.ecx.w[0] = xsize;
+ ireg.edx.w[0] = ysize;
+ __intcall(0x22, &ireg, NULL);
+}