From bd4f84ebd61ce50b1cdf5ab81a06ceb29c3c0d99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Januszewski?= Date: Mon, 22 Oct 2007 23:04:18 +0200 Subject: [PATCH] Update testvbe to display basic information about the Video BIOS. --- ChangeLog | 11 +++++++++- testvbe.c | 36 +++++++++++++++++++++++++------- testvbe.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 111 insertions(+), 8 deletions(-) create mode 100644 testvbe.h diff --git a/ChangeLog b/ChangeLog index 25fe7ee..971257d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ +2007-10-22 * 0.1.1 + +- LRMI bugfix: map the IVTBDA as shared memory. +- Update testvbe to display basic information about the Video BIOS. + +2007-09-04 * 0.1 + +- No changes since 0.1-rc5. + 2007-08-07 * 0.1-rc5 -- Change the v86 memory access functions so that they no longer require +- Change the v86 memory access functions so that they no longer require mapping files into the first 1 MB of the address space. diff --git a/testvbe.c b/testvbe.c index 76e7a99..8f6468d 100644 --- a/testvbe.c +++ b/testvbe.c @@ -7,25 +7,47 @@ #include #include "v86.h" +#include "testvbe.h" int main(int argc, char *argv[]) { struct uvesafb_task tsk; + struct vbe_ib ib; + u16 *s; u8 *t; - u8 buf[4096]; if (v86_init()) return -1; tsk.regs.eax = 0x4f00; tsk.flags = TF_VBEIB; - tsk.buf_len = sizeof(struct vbe_ib); - strncpy(&(((struct vbe_ib*)buf)->vbe_signature), "VBE2", 4); + tsk.buf_len = sizeof(ib); + strncpy(&ib.vbe_signature, "VBE2", 4); - v86_task(&tsk, buf); + v86_task(&tsk, &ib); + + t = &ib; + + printf("VBE Version: %x\n", ib.vbe_version); + printf("OEM String: %s\n", ib.oem_string_ptr + t); + printf("OEM Vendor Name: %s\n", ib.oem_vendor_name_ptr + t); + printf("OEM Prod. Name: %s\n", ib.oem_product_name_ptr + t); + printf("OEM Prod. Rev: %s\n", ib.oem_product_rev_ptr + t); + + for (s = ib.mode_list_ptr + t; *s != 0xffff; s++) { + struct vbe_mode_ib mib; + + tsk.regs.eax = 0x4f01; + tsk.regs.ecx = *s; + tsk.flags = TF_BUF_RET | TF_BUF_ESDI; + tsk.buf_len = sizeof(mib); + + v86_task(&tsk, &mib); - printf("%s\n", ((struct vbe_ib*)buf)->oem_vendor_name_ptr + buf); + printf("%6.4x %6.4x %dx%d-%d\n", *s, mib.mode_attr, + mib.x_res, mib.y_res, mib.bits_per_pixel); + } - tsk.regs.eax = 0x4f02; +/* tsk.regs.eax = 0x4f02; tsk.regs.ebx = 0xc161; tsk.buf_len = 0; tsk.flags = 0; @@ -33,7 +55,7 @@ int main(int argc, char *argv[]) v86_task(&tsk, buf); printf("got eax = %x\n", tsk.regs.eax); - +*/ v86_cleanup(); return 0; diff --git a/testvbe.h b/testvbe.h new file mode 100644 index 0000000..3828927 --- /dev/null +++ b/testvbe.h @@ -0,0 +1,72 @@ +#ifndef __H_TESTVBE +#define __H_TESTVBE + +#define VBE_MODE_VGACOMPAT 0x20 +#define VBE_MODE_COLOR 0x08 +#define VBE_MODE_SUPPORTEDHW 0x01 +#define VBE_MODE_GRAPHICS 0x10 +#define VBE_MODE_LFB 0x80 + +#define VBE_MODE_MASK (VBE_MODE_COLOR | VBE_MODE_SUPPORTEDHW | \ + VBE_MODE_GRAPHICS | VBE_MODE_LFB) + +/* VBE Mode Info Block */ +struct vbe_mode_ib { + /* for all VBE revisions */ + u16 mode_attr; + u8 winA_attr; + u8 winB_attr; + u16 win_granularity; + u16 win_size; + u16 winA_seg; + u16 winB_seg; + u32 win_func_ptr; + u16 bytes_per_scan_line; + + /* for VBE 1.2+ */ + u16 x_res; + u16 y_res; + u8 x_char_size; + u8 y_char_size; + u8 planes; + u8 bits_per_pixel; + u8 banks; + u8 memory_model; + u8 bank_size; + u8 image_pages; + u8 reserved1; + + /* Direct color fields for direct/6 and YUV/7 memory models. */ + /* Offsets are bit positions of lsb in the mask. */ + u8 red_len; + u8 red_off; + u8 green_len; + u8 green_off; + u8 blue_len; + u8 blue_off; + u8 rsvd_len; + u8 rsvd_off; + u8 direct_color_info; /* direct color mode attributes */ + + /* for VBE 2.0+ */ + u32 phys_base_ptr; + u8 reserved2[6]; + + /* for VBE 3.0+ */ + u16 lin_bytes_per_scan_line; + u8 bnk_image_pages; + u8 lin_image_pages; + u8 lin_red_len; + u8 lin_red_off; + u8 lin_green_len; + u8 lin_green_off; + u8 lin_blue_len; + u8 lin_blue_off; + u8 lin_rsvd_len; + u8 lin_rsvd_off; + u32 max_pixel_clock; + u16 mode_id; + u8 depth; +} __attribute__ ((packed)); + +#endif /* __H_TESTVBE */ -- 2.11.4.GIT