comparison linux/vbelib.c @ 2536:6426007cad63

Fixed broken BIOS workaround
author nick
date Mon, 29 Oct 2001 18:24:29 +0000
parents a3f658d3c98c
children bd734d41a407
comparison
equal deleted inserted replaced
2535:b44113f46c96 2536:6426007cad63
15 #include <sys/io.h> 15 #include <sys/io.h>
16 #include <ctype.h> 16 #include <ctype.h>
17 17
18 static struct VesaProtModeInterface vbe_pm_info; 18 static struct VesaProtModeInterface vbe_pm_info;
19 19
20 static inline int VERR(void *p) 20 static inline int VERR(const void *p)
21 { 21 {
22 register int retval; 22 register int retval;
23 __asm __volatile( 23 __asm __volatile(
24 "xorl %0, %0\n\t" 24 "xorl %0, %0\n\t"
25 "verr %1\n\t" 25 "verr %1\n\t"
29 :"memory"); 29 :"memory");
30 return retval; 30 return retval;
31 } 31 }
32 32
33 #if 0 33 #if 0
34 static inline int VERW(void *p) 34 static inline int VERW(const void *p)
35 { 35 {
36 register int retval; 36 register int retval;
37 __asm __volatile( 37 __asm __volatile(
38 "xorl %0, %0\n\t" 38 "xorl %0, %0\n\t"
39 "verw %1\n\t" 39 "verw %1\n\t"
106 return VBE_OK; 106 return VBE_OK;
107 } 107 }
108 108
109 int vbeDestroy( void ) { return VBE_OK; } 109 int vbeDestroy( void ) { return VBE_OK; }
110 110
111 static int check_str(unsigned char *str) 111 /* Fixme!!! This code is compatible only with mplayer's version of lrmi*/
112 static inline int is_addr_valid(const void *p)
113 {
114 return (p < (const void *)0x502) ||
115 (p >= (const void *)0x10000 && p < (const void *)0x20000) ||
116 (p >= (const void *)0xa0000 && p < (const void *)0x100000);
117 }
118
119 static int check_str(const unsigned char *str)
112 { 120 {
113 size_t i; 121 size_t i;
114 int null_found = 0; 122 int null_found = 0;
115 for(i = 0;i < 256;i++) 123 for(i = 0;i < 256;i++)
116 { 124 {
117 if(VERR(&str[i])) 125 if(is_addr_valid(&str[i]))
118 { 126 {
119 if(!str[i]) { null_found = 1; break; } 127 if(VERR(&str[i]))
128 {
129 if(!str[i]) { null_found = 1; break; }
130 }
131 else break;
120 } 132 }
121 else break; 133 else break;
122 } 134 }
123 return null_found; 135 return null_found;
124 } 136 }
125 137
126 static int check_wrd(unsigned short *str) 138 static int check_wrd(const unsigned short *str)
127 { 139 {
128 size_t i; 140 size_t i;
129 int ffff_found = 0; 141 int ffff_found = 0;
130 for(i = 0;i < 1024;i++) 142 for(i = 0;i < 1024;i++)
131 { 143 {
132 if(VERR(&str[i])) 144 if(is_addr_valid(&str[i]))
133 { 145 {
134 if(str[i] == 0xffff) { ffff_found = 1; break; } 146 if(VERR(&str[i]))
147 {
148 if(str[i] == 0xffff) { ffff_found = 1; break; }
149 }
150 else break;
135 } 151 }
136 else break; 152 else break;
137 } 153 }
138 return ffff_found; 154 return ffff_found;
139 } 155 }