aboutsummaryrefslogtreecommitdiffstats
path: root/com32/sysdump/vesa.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-06 17:43:11 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-06 17:44:29 -0800
commit177148d253c6ca986ef94aa9b22ae377ddee828a (patch)
tree5d17f72138a66d8dc6b1005fc6beecce14d0b9c8 /com32/sysdump/vesa.c
parent0f4c904b628adb906a3d534b5efa031071ec6b5e (diff)
downloadsyslinux-177148d253c6ca986ef94aa9b22ae377ddee828a.tar.gz
syslinux-177148d253c6ca986ef94aa9b22ae377ddee828a.tar.xz
syslinux-177148d253c6ca986ef94aa9b22ae377ddee828a.zip
sysdump: dump vesa modes, generate usable timestamps
Dump all the VESA modes; give functional timestamps for the cpio members. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/sysdump/vesa.c')
-rw-r--r--com32/sysdump/vesa.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/com32/sysdump/vesa.c b/com32/sysdump/vesa.c
new file mode 100644
index 00000000..3d72093a
--- /dev/null
+++ b/com32/sysdump/vesa.c
@@ -0,0 +1,56 @@
+#include <string.h>
+#include <stdio.h>
+#include "../lib/sys/vesa/vesa.h"
+#include "backend.h"
+#include "sysdump.h"
+
+void dump_vesa_tables(struct backend *be)
+{
+ com32sys_t rm;
+ struct vesa_general_info *gip, gi;
+ struct vesa_mode_info *mip, mi;
+ uint16_t mode, *mode_ptr;
+ char modefile[64];
+
+ /* Allocate space in the bounce buffer for these structures */
+ gip = &((struct vesa_info *)__com32.cs_bounce)->gi;
+ mip = &((struct vesa_info *)__com32.cs_bounce)->mi;
+
+ memset(&rm, 0, sizeof rm);
+ memset(gip, 0, sizeof *gip);
+
+ gip->signature = VBE2_MAGIC; /* Get VBE2 extended data */
+ rm.eax.w[0] = 0x4F00; /* Get SVGA general information */
+ rm.edi.w[0] = OFFS(gip);
+ rm.es = SEG(gip);
+ __intcall(0x10, &rm, &rm);
+ memcpy(&gi, gip, sizeof gi);
+
+ if (rm.eax.w[0] != 0x004F)
+ return; /* Function call failed */
+ if (gi.signature != VESA_MAGIC)
+ return; /* No magic */
+
+ cpio_mkdir(be, "vesa");
+
+ cpio_writefile(be, "vesa/global.bin", &gi, sizeof gi);
+
+ mode_ptr = GET_PTR(gi.video_mode_ptr);
+ while ((mode = *mode_ptr++) != 0xFFFF) {
+ memset(mip, 0, sizeof *mip);
+ rm.eax.w[0] = 0x4F01; /* Get SVGA mode information */
+ rm.ecx.w[0] = mode;
+ rm.edi.w[0] = OFFS(mip);
+ rm.es = SEG(mip);
+ __intcall(0x10, &rm, &rm);
+
+ /* Must be a supported mode */
+ if (rm.eax.w[0] != 0x004f)
+ continue;
+
+ memcpy(&mi, mip, sizeof mi);
+
+ sprintf(modefile, "vesa/mode%04x.bin", mode);
+ cpio_writefile(be, modefile, &mi, sizeof mi);
+ }
+}