diff options
author | Paulo Alcantara <pcacjr@zytor.com> | 2012-05-19 01:58:03 -0300 |
---|---|---|
committer | Paulo Alcantara <pcacjr@zytor.com> | 2012-05-19 02:05:38 -0300 |
commit | 4fc3fd1e14f4c1b9208ef262e5b6aef853e9fce4 (patch) | |
tree | 4c51d9d8472e35fbbf7494250554e99f952d9c72 | |
parent | f631d78263f17436bda5ae27d7e4eff75981e31f (diff) | |
download | syslinux-4fc3fd1e14f4c1b9208ef262e5b6aef853e9fce4.tar.gz syslinux-4fc3fd1e14f4c1b9208ef262e5b6aef853e9fce4.tar.xz syslinux-4fc3fd1e14f4c1b9208ef262e5b6aef853e9fce4.zip |
graphics: make use of syslinux_force_text_mode()
The syslinux_force_text_mode() function used in library
space made unnecessary INT 0x22 call that could be simply
used with vgaclearmode() function.
This patche renames vgaclearmode() to
syslinux_force_text_mode() as this naming is generally more
carefully considered and gets rid of "forcetext.c" source
file.
Also all the VGA-related functions and variables that were
exported in core/include/bios.h have been moved out to
core/include/graphics.h which makes more sense actually.
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
-rw-r--r-- | com32/lib/Makefile | 3 | ||||
-rw-r--r-- | com32/lib/syslinux/load_linux.c | 10 | ||||
-rw-r--r-- | com32/lib/syslinux/video/forcetext.c | 42 | ||||
-rw-r--r-- | core/comboot.inc | 2 | ||||
-rw-r--r-- | core/conio.c | 7 | ||||
-rw-r--r-- | core/diskfs.inc | 4 | ||||
-rw-r--r-- | core/extern.inc | 2 | ||||
-rw-r--r-- | core/font.c | 6 | ||||
-rw-r--r-- | core/graphics.c | 6 | ||||
-rw-r--r-- | core/include/bios.h | 15 | ||||
-rw-r--r-- | core/include/graphics.h | 19 | ||||
-rw-r--r-- | core/localboot.c | 3 | ||||
-rw-r--r-- | core/plaincon.c | 12 | ||||
-rw-r--r-- | core/rawcon.c | 4 |
14 files changed, 53 insertions, 82 deletions
diff --git a/com32/lib/Makefile b/com32/lib/Makefile index 8e6a73aa..a0ddb9d6 100644 --- a/com32/lib/Makefile +++ b/com32/lib/Makefile @@ -49,8 +49,7 @@ LIBSYSLINUX_OBJS = \ syslinux/features.o syslinux/config.o \ syslinux/dsinfo.o syslinux/version.o \ syslinux/pxe_get_cached.o syslinux/pxe_get_nic.o \ - syslinux/video/fontquery.o syslinux/video/forcetext.o \ - syslinux/video/reportmode.o + syslinux/video/fontquery.o syslinux/video/reportmode.o LIBLOAD_OBJS = \ syslinux/addlist.o syslinux/freelist.o syslinux/memmap.o \ diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c index e5fd3333..1c0c19ee 100644 --- a/com32/lib/syslinux/load_linux.c +++ b/com32/lib/syslinux/load_linux.c @@ -39,11 +39,13 @@ #include <string.h> #include <minmax.h> #include <suffix_number.h> +#include <graphics.h> +#include <dprintf.h> + #include <syslinux/align.h> #include <syslinux/linux.h> #include <syslinux/bootrm.h> #include <syslinux/movebits.h> -#include <dprintf.h> struct linux_header { uint8_t boot_sector_1[0x0020]; @@ -471,10 +473,10 @@ int syslinux_boot_linux(void *kernel_buf, size_t kernel_size, * video_mode is not "current", so if we are in graphics mode we * need to revert to text mode... */ - dprintf("*** Calling vgaclearmode()...\n"); - vgaclearmode(); + dprintf("*** Calling syslinux_force_text_mode()...\n"); + syslinux_force_text_mode(); } else { - dprintf("*** vga=current, not calling vgaclearmode()...\n"); + dprintf("*** vga=current, not calling syslinux_force_text_mode()...\n"); } syslinux_shuffle_boot_rm(fraglist, mmap, 0, ®s); diff --git a/com32/lib/syslinux/video/forcetext.c b/com32/lib/syslinux/video/forcetext.c deleted file mode 100644 index 136cb279..00000000 --- a/com32/lib/syslinux/video/forcetext.c +++ /dev/null @@ -1,42 +0,0 @@ -/* ----------------------------------------------------------------------- * - * - * 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/core/comboot.inc b/core/comboot.inc index 83f0c030..1e19d288 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -429,7 +429,7 @@ comapi_run_default: ; Puts the video in standard text mode ; comapi_textmode: - pm_call vgaclearmode + pm_call syslinux_force_text_mode clc ret diff --git a/core/conio.c b/core/conio.c index dd18ecfd..421dabfd 100644 --- a/core/conio.c +++ b/core/conio.c @@ -24,12 +24,13 @@ #include <stddef.h> #include <stdio.h> #include <string.h> - #include <fs.h> -#include "bios.h" #include <com32.h> #include <sys/cpu.h> +#include "bios.h" +#include "graphics.h" + union screen _cursor; union screen _screensize; @@ -434,7 +435,7 @@ static void msg_formfeed(void) static void msg_novga(void) { - vgaclearmode(); + syslinux_force_text_mode(); msg_initvars(); } diff --git a/core/diskfs.inc b/core/diskfs.inc index f62d80ec..02382cc6 100644 --- a/core/diskfs.inc +++ b/core/diskfs.inc @@ -151,11 +151,11 @@ kaboom2: cmp byte [kaboom.again+1],18h ; INT 18h version? je .int18 pm_call pm_getchar - pm_call vgaclearmode + pm_call syslinux_force_text_mode int 19h ; And try once more to boot... .norge: jmp short .norge ; If int 19h returned; this is the end .int18: - pm_call vgaclearmode + pm_call syslinux_force_text_mode int 18h .noreg: jmp short .noreg ; Nynorsk diff --git a/core/extern.inc b/core/extern.inc index f6ec0aec..3cde2863 100644 --- a/core/extern.inc +++ b/core/extern.inc @@ -64,7 +64,7 @@ extern pm_writehex2, pm_writehex4, pm_writehex8 ; graphics.c - extern vgaclearmode, vgashowcursor, vgahidecursor, pm_using_vga + extern syslinux_force_text_mode, vgashowcursor, vgahidecursor, pm_using_vga ; conio.c extern pm_pollchar, pm_write_serial, pm_serialcfg diff --git a/core/font.c b/core/font.c index 1fcbbe83..3533d80b 100644 --- a/core/font.c +++ b/core/font.c @@ -21,13 +21,14 @@ #include <sys/io.h> #include <stdio.h> #include <fs.h> + #include "bios.h" +#include "graphics.h" #include "core.h" char fontbuf[8192]; char serial[serial_buf_size]; -extern uint16_t VGAFontSize; extern uint8_t UserFont; uint16_t GXPixCols = 1; /* Graphics mode pixel columns */ @@ -107,10 +108,9 @@ void use_font(void) com32sys_t ireg, oreg; uint8_t bytes = VGAFontSize; - /* Nonstandard mode? */ if (UsingVGA & ~0x3) - vgaclearmode(); + syslinux_force_text_mode(); memset(&ireg, 0, sizeof(ireg)); diff --git a/core/graphics.c b/core/graphics.c index 080efa11..bdf48a85 100644 --- a/core/graphics.c +++ b/core/graphics.c @@ -21,7 +21,9 @@ #include <sys/io.h> #include <hw/vga.h> #include "fs.h" + #include "bios.h" +#include "graphics.h" uint8_t UsingVGA = 0; uint16_t VGAPos; /* Pointer into VGA memory */ @@ -238,7 +240,7 @@ void vgadisplayfile(FILE *_fd) * This is a cheap and easy way to make sure the screen is * cleared in case we were in graphics mode aready. */ - vgaclearmode(); + syslinux_force_text_mode(); vgasetmode(); size = 4+2*2+16*3; @@ -302,7 +304,7 @@ void vgadisplayfile(FILE *_fd) /* * Disable VGA graphics. */ -void vgaclearmode(void) +void syslinux_force_text_mode(void) { com32sys_t ireg, oreg; diff --git a/core/include/bios.h b/core/include/bios.h index 2b4b029e..4bf6bc43 100644 --- a/core/include/bios.h +++ b/core/include/bios.h @@ -78,21 +78,6 @@ extern uint16_t VGAFontSize; extern void use_font(void); extern void bios_adjust_screen(void); -/* graphics.c */ -#ifdef IS_SYSLINUX -#define VGA_FILE_BUF_SIZE (FILENAME_MAX + 2) -#else -#define VGA_FILE_BUF_SIZE FILENAME_MAX -#endif - -extern uint8_t UsingVGA; -extern uint16_t VGAPos; -extern uint16_t *VGAFilePtr; -extern char VGAFileBuf[VGA_FILE_BUF_SIZE]; -extern char VGAFileMBuf[]; -extern void vgaclearmode(void); -extern void vgadisplayfile(FILE *fd); - /* serirq.c */ extern char *SerialHead; extern char *SerialTail; diff --git a/core/include/graphics.h b/core/include/graphics.h index 0e4e005d..897103e5 100644 --- a/core/include/graphics.h +++ b/core/include/graphics.h @@ -28,6 +28,25 @@ #ifndef GRAPHICS_H_ #define GRAPHICS_H_ +#include <stddef.h> + +#include "core.h" +#include "fs.h" + +#ifdef IS_SYSLINUX +#define VGA_FILE_BUF_SIZE (FILENAME_MAX + 2) +#else +#define VGA_FILE_BUF_SIZE FILENAME_MAX +#endif + +extern uint8_t UsingVGA; +extern uint16_t VGAPos; +extern uint16_t *VGAFilePtr; +extern char VGAFileBuf[VGA_FILE_BUF_SIZE]; +extern char VGAFileMBuf[]; + +extern void syslinux_force_text_mode(void); +extern void vgadisplayfile(FILE *_fd); extern void using_vga(uint8_t vga, uint16_t pix_cols, uint16_t pix_rows); static inline void graphics_using_vga(uint8_t vga, uint16_t pix_cols, diff --git a/core/localboot.c b/core/localboot.c index 0104047f..03ac866d 100644 --- a/core/localboot.c +++ b/core/localboot.c @@ -16,6 +16,7 @@ #include <core.h> #include <fs.h> #include <bios.h> +#include <graphics.h> /* * localboot.c @@ -38,7 +39,7 @@ void local_boot(int16_t ax) com32sys_t ireg, oreg; int i; - vgaclearmode(); + syslinux_force_text_mode(); writestr(LOCALBOOT_MSG); crlf(); diff --git a/core/plaincon.c b/core/plaincon.c index a12d551a..dfeb9784 100644 --- a/core/plaincon.c +++ b/core/plaincon.c @@ -1,12 +1,14 @@ -/* - * writechr: Write a single character in AL to the console without - * mangling any registers; handle video pages correctly. - */ #include <sys/io.h> #include <fs.h> #include <com32.h> + #include "bios.h" +#include "graphics.h" +/* + * Write a single character in AL to the console without + * mangling any registers; handle video pages correctly. + */ void writechr(char data) { com32sys_t ireg, oreg; @@ -14,7 +16,7 @@ void writechr(char data) write_serial(data); /* write to serial port if needed */ if (UsingVGA & 0x8) - vgaclearmode(); + syslinux_force_text_mode(); if (!(DisplayCon & 0x1)) return; diff --git a/core/rawcon.c b/core/rawcon.c index d28113b8..1a52c954 100644 --- a/core/rawcon.c +++ b/core/rawcon.c @@ -6,12 +6,14 @@ #include <sys/io.h> #include <fs.h> #include <com32.h> + #include "bios.h" +#include "graphics.h" void writechr(char data) { if (UsingVGA & 0x08) - vgaclearmode(); + syslinux_force_text_mode(); write_serial(data); /* write to serial port if needed */ |