changeset 2254:6e5b548790c9

Fixed bug of 32-bit mode interface detection and save-restore mechanism
author nick
date Thu, 18 Oct 2001 15:48:51 +0000
parents 0cc88042ff21
children 98c2bfc87825
files linux/vbelib.c linux/vbelib.h
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/linux/vbelib.c	Thu Oct 18 15:43:35 2001 +0000
+++ b/linux/vbelib.c	Thu Oct 18 15:48:51 2001 +0000
@@ -153,7 +153,7 @@
   r.edx = 0x01;
   r.ecx = 0x0f;
   r.es  = VirtToPhysSeg(rm_space);
-  r.edi = VirtToPhysOff(rm_space);
+  r.ebx = VirtToPhysOff(rm_space);
   if(!LRMI_int(0x10,&r))
   {
     LRMI_free_real(rm_space);
@@ -179,7 +179,7 @@
   r.edx = 0x02;
   r.ecx = 0x0f;
   r.es  = VirtToPhysSeg(data);
-  r.edi = VirtToPhysOff(data);
+  r.ebx = VirtToPhysOff(data);
   retval = LRMI_int(0x10,&r);
   LRMI_free_real(data);
   if(!retval) return VBE_VM86_FAIL;
@@ -208,7 +208,6 @@
 int vbeSetWindow(unsigned win_num,unsigned win_gran)
 {
   int retval;
-#if 0
   if(vbe_pm_info.SetWindowCall)
   {
      /* 32-bit function call is much better of int 10h */
@@ -217,10 +216,10 @@
 	"movl	%1, %%ebx\n"
 	::"a"(0x4f05),"S"(win_num & 0x0f),"d"(win_gran):"memory");
     (*vbe_pm_info.SetWindowCall)();
-    __asm __volatile("popl	%%ebx":"=a"(retval)::"memory");
+    __asm __volatile("popl	%%ebx":::"memory");
+    retval = VBE_OK;
   }
   else
-#endif
   {
     struct LRMI_regs r;
     memset(&r,0,sizeof(struct LRMI_regs));
@@ -229,8 +228,8 @@
     r.edx = win_gran;
     if(!LRMI_int(0x10,&r)) return VBE_VM86_FAIL;
     retval = r.eax & 0xffff;
+    if(retval == 0x4f) retval = VBE_OK;
   }
-  if(retval == 0x4f) retval = VBE_OK;
   return retval;
 }
 
@@ -246,6 +245,7 @@
 {
   struct LRMI_regs r;
   int retval;
+  unsigned info_offset;
   struct realVesaProtModeInterface *rm_info;
   memset(&r,0,sizeof(struct LRMI_regs));
   r.eax = 0x4f0a;
@@ -254,11 +254,12 @@
   retval = r.eax & 0xffff;
   if(retval == 0x4f)
   {
-    rm_info = PhysToVirtSO(r.es,r.edi&0xffff);
-    pm_info->SetWindowCall   = PhysToVirtSO(r.es,rm_info->SetWindowCall);
-    pm_info->SetDisplayStart = PhysToVirtSO(r.es,rm_info->SetDisplayStart);
-    pm_info->SetPaletteData  = PhysToVirtSO(r.es,rm_info->SetPaletteData);
-    pm_info->iopl_ports      = PhysToVirtSO(r.es,rm_info->iopl_ports);
+    info_offset = r.edi&0xffff;
+    rm_info = PhysToVirtSO(r.es,info_offset);
+    pm_info->SetWindowCall   = PhysToVirtSO(r.es,info_offset+rm_info->SetWindowCall);
+    pm_info->SetDisplayStart = PhysToVirtSO(r.es,info_offset+rm_info->SetDisplayStart);
+    pm_info->SetPaletteData  = PhysToVirtSO(r.es,info_offset+rm_info->SetPaletteData);
+    pm_info->iopl_ports      = PhysToVirtSO(r.es,info_offset+rm_info->iopl_ports);
     retval = VBE_OK;
   }
   return retval;
--- a/linux/vbelib.h	Thu Oct 18 15:43:35 2001 +0000
+++ b/linux/vbelib.h	Thu Oct 18 15:48:51 2001 +0000
@@ -16,6 +16,12 @@
   unsigned short seg;
 }FarPtr;
 
+#define VBE_DAC_8BIT       (1 << 0)
+#define VBE_NONVGA_CRTC    (1 << 1)
+#define VBE_SNOWED_RAMDAC  (1 << 2)
+#define VBE_STEREOSCOPIC   (1 << 3)
+#define VBE_STEREO_EVC     (1 << 4)
+
 struct VbeInfoBlock {
   char          VESASignature[4]; /* 'VESA' 4 byte signature */
   short         VESAVersion;      /* VBE version number */
@@ -23,7 +29,7 @@
   long          Capabilities;     /* Capabilities of video card */
   unsigned short* VideoModePtr;   /* Pointer to supported modes */
   short         TotalMemory;      /* Number of 64kb memory blocks */
-  /* VBE 3.0 and above */
+  /* VBE 2.0 and above */
   short         OemSoftwareRev;
   char *        OemVendorNamePtr;
   char *        OemProductNamePtr;
@@ -170,7 +176,7 @@
   void (*SetDisplayStart)(void);
   void (*SetPaletteData)(void);
   unsigned short * iopl_ports;
-}__attribute__ ((packed));
+};
 
 /*
   All functions below return:
@@ -183,8 +189,8 @@
 #define VBE_VM86_FAIL         -1
 #define VBE_OUT_OF_DOS_MEM    -2
 #define VBE_OUT_OF_MEM        -3
-#define VBE_VESA_ERROR_MASK   0x4f00
-#define VBE_VESA_ERRCODE_MASK 0xff
+#define VBE_VESA_ERROR_MASK   0x004f
+#define VBE_VESA_ERRCODE_MASK 0xff00
 
 extern int vbeInit( void );
 extern int vbeDetroy( void );