[syslinux:elflink] graphics: report video mode change from protected-mode code

syslinux-bot for Paulo Alcantara pcacjr at zytor.com
Wed May 16 14:21:08 PDT 2012


Commit-ID:  124902bbde301d54bc4d4f89040222c75366c639
Gitweb:     http://www.syslinux.org/commit/124902bbde301d54bc4d4f89040222c75366c639
Author:     Paulo Alcantara <pcacjr at zytor.com>
AuthorDate: Fri, 4 May 2012 04:43:34 -0300
Committer:  Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Sat, 12 May 2012 00:56:22 -0300

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 <pcacjr at zytor.com>

---
 com32/mboot/initvesa.c             |   19 ++++++++-----------
 core/comboot.inc                   |    2 +-
 core/extern.inc                    |    4 ++--
 core/graphics.c                    |   17 +++++++++++------
 core/include/{pxe.h => graphics.h} |   18 +++++++-----------
 5 files changed, 29 insertions(+), 31 deletions(-)

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 <stdlib.h>
 #include <string.h>
 #include <limits.h>
+#include <graphics.h>
 
 #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/pxe.h b/core/include/graphics.h
similarity index 81%
copy from core/include/pxe.h
copy to core/include/graphics.h
index 86d6cfc..0e4e005 100644
--- a/core/include/pxe.h
+++ b/core/include/graphics.h
@@ -1,6 +1,5 @@
 /* ----------------------------------------------------------------------- *
  *
- *   Copyright 2010 Intel Corporation; author: H. Peter Anvin
  *   Copyright 2012 Paulo Alcantara <pcacjr at zytor.com>
  *
  *   Permission is hereby granted, free of charge, to any person
@@ -26,18 +25,15 @@
  *
  * ----------------------------------------------------------------------- */
 
-#ifndef PXE_H_
-#define PXE_H_
+#ifndef GRAPHICS_H_
+#define GRAPHICS_H_
 
-#include <stdio.h>
-#include <stdint.h>
+extern void using_vga(uint8_t vga, uint16_t pix_cols, uint16_t pix_rows);
 
-extern uint32_t dns_resolv(const char *);
-
-/* Resolve a hostname via DNS */
-static inline uint32_t pxe_dns_resolv(const char *name)
+static inline void graphics_using_vga(uint8_t vga, uint16_t pix_cols,
+                                      uint16_t pix_rows)
 {
-    return dns_resolv(name);
+    using_vga(vga, pix_cols, pix_rows);
 }
 
-#endif /* PXE_H_ */
+#endif /* GRAPHICS_H_ */


More information about the Syslinux-commits mailing list