From 124902bbde301d54bc4d4f89040222c75366c639 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Fri, 4 May 2012 04:43:34 -0300 Subject: [PATCH] graphics: report video mode change from protected-mode code Syslinux used to call __intcall() for calling routines of the old COMBOOT API to report video mode change (INT 22h, AX=0x0017) that seemed pointless, since INT 22h, AX=0x0017 does call the protected-mode function pm_using_vga() already when calling INT 22h, AX=0x0017. So for reporting video mode changes (VGA in this case) we must call graphics_using_vga() instead for now. Signed-off-by: Paulo Alcantara --- com32/mboot/initvesa.c | 19 ++++++++----------- core/comboot.inc | 2 +- core/extern.inc | 4 ++-- core/graphics.c | 17 +++++++++++------ core/include/graphics.h | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 core/include/graphics.h diff --git a/com32/mboot/initvesa.c b/com32/mboot/initvesa.c index cf2707d..bb3a846 100644 --- a/com32/mboot/initvesa.c +++ b/com32/mboot/initvesa.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "vesa.h" #include "mboot.h" @@ -211,16 +212,12 @@ void set_graphics_mode(const struct multiboot_header *mbh, mbi->vbe_interface_len = rm.ecx.w[0]; } - /* 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; - - 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] = vesa_info.mi.h_res; - rm.edx.w[0] = vesa_info.mi.v_res; - __intcall(0x22, &rm, NULL); + * + * UsingVga = (mi->mode_attr & 4) ? 0x0007 : 0x000f; + * + * However, that would assume all systems that claim to handle text + * output in VESA modes actually do that... + */ + graphics_using_vga(0x0F, vesa_info.mi.h_res, vesa_info.mi.v_res); } diff --git a/core/comboot.inc b/core/comboot.inc index 35cc91c..83f0c03 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -654,7 +654,7 @@ comapi_usingvga: ja .error mov cx,P_CX mov dx,P_DX - pm_call pm_usingvga + pm_call pm_using_vga clc ret .error: diff --git a/core/extern.inc b/core/extern.inc index da3d894..f6ec0ae 100644 --- a/core/extern.inc +++ b/core/extern.inc @@ -64,13 +64,13 @@ extern pm_writehex2, pm_writehex4, pm_writehex8 ; graphics.c - extern vgaclearmode, vgashowcursor, vgahidecursor + extern vgaclearmode, vgashowcursor, vgahidecursor, pm_using_vga ; conio.c extern pm_pollchar, pm_write_serial, pm_serialcfg ; font.c - extern pm_getchar, pm_adjust_screen, pm_usingvga, pm_userfont + extern pm_getchar, pm_adjust_screen, pm_userfont ; localboot.c extern pm_local_boot diff --git a/core/graphics.c b/core/graphics.c index 42ff6ec..080efa1 100644 --- a/core/graphics.c +++ b/core/graphics.c @@ -354,12 +354,17 @@ void vgashowcursor(void) vgacursorcommon('_'); } -void pm_usingvga(com32sys_t *regs) +void using_vga(uint8_t vga, uint16_t pix_cols, uint16_t pix_rows) { - UsingVGA = regs->eax.b[0]; - GXPixCols = regs->ecx.w[0]; - GXPixRows = regs->edx.w[0]; + UsingVGA = vga; + GXPixCols = pix_cols; + GXPixRows = pix_rows; - if (!(UsingVGA & 0x08)) - adjust_screen(); + if (!(UsingVGA & 0x08)) + adjust_screen(); +} + +void pm_using_vga(com32sys_t *regs) +{ + using_vga(regs->eax.b[0], regs->ecx.w[0], regs->edx.w[0]); } diff --git a/core/include/graphics.h b/core/include/graphics.h new file mode 100644 index 0000000..0e4e005 --- /dev/null +++ b/core/include/graphics.h @@ -0,0 +1,39 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 2012 Paulo Alcantara + * + * 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. + * + * ----------------------------------------------------------------------- */ + +#ifndef GRAPHICS_H_ +#define GRAPHICS_H_ + +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, + uint16_t pix_rows) +{ + using_vga(vga, pix_cols, pix_rows); +} + +#endif /* GRAPHICS_H_ */ -- 2.7.4