aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules/vesainfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/modules/vesainfo.c')
-rw-r--r--com32/modules/vesainfo.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/com32/modules/vesainfo.c b/com32/modules/vesainfo.c
index f9b25026..86a43657 100644
--- a/com32/modules/vesainfo.c
+++ b/com32/modules/vesainfo.c
@@ -20,25 +20,31 @@ static void wait_key(void)
static void print_modes(void)
{
- static com32sys_t rm;
- struct vesa_general_info *gi;
- struct vesa_mode_info *mi;
- uint16_t mode, *mode_ptr;
- int lines;
-
- /* Allocate space in the bounce buffer for these structures */
- gi = &((struct vesa_info *)__com32.cs_bounce)->gi;
- mi = &((struct vesa_info *)__com32.cs_bounce)->mi;
-
- gi->signature = VBE2_MAGIC; /* Get VBE2 extended data */
- rm.eax.w[0] = 0x4F00; /* Get SVGA general information */
- rm.edi.w[0] = OFFS(gi);
- rm.es = SEG(gi);
- __intcall(0x10, &rm, &rm);
+ static com32sys_t rm;
+ struct vesa_general_info *gi;
+ struct vesa_mode_info *mi;
+ uint16_t mode, *mode_ptr;
+ int lines;
+
+ struct vesa_info *vesa;
+
+ vesa = lmalloc(sizeof(*vesa));
+ if (!vesa) {
+ printf("vesainfo.c32: fail in lmalloc\n");
+ return;
+ }
+ gi = &vesa->gi;
+ mi = &vesa->mi;
+
+ gi->signature = VBE2_MAGIC; /* Get VBE2 extended data */
+ rm.eax.w[0] = 0x4F00; /* Get SVGA general information */
+ rm.edi.w[0] = OFFS(gi);
+ rm.es = SEG(gi);
+ __intcall(0x10, &rm, &rm);
if (rm.eax.w[0] != 0x004F) {
printf("No VESA BIOS detected\n");
- return;
+ goto exit;
} else if (gi->signature != VESA_MAGIC) {
printf("VESA information structure has bad magic, trying anyway...\n");
}
@@ -71,9 +77,13 @@ static void print_modes(void)
mode, mi->mode_attr, mi->h_res, mi->v_res, mi->bpp,
mi->memory_layout, mi->rpos, mi->gpos, mi->bpos);
}
+
+exit:
+ free(vesa);
+ return;
}
-int main(void)
+int main(int argc, char **argv)
{
print_modes();
return 0;