- Timestamp:
- Nov 19, 2010 3:02:11 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67946
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/fakedri_drv.c
r34198 r34204 174 174 } 175 175 176 #ifdef RT_ARCH_AMD64 177 # define FAKEDRI_JMP64_PATCH_SIZE 13 178 #endif 176 #define FAKEDRI_JMP64_PATCH_SIZE 13 179 177 180 178 static void … … 186 184 void *alPatch; 187 185 void *pMesaEntry; 188 char patch[ 5];186 char patch[FAKEDRI_JMP64_PATCH_SIZE]; 189 187 void *shift; 190 188 … … 237 235 #endif 238 236 { 237 #ifdef RT_ARCH_AMD64 238 int64_t offset; 239 #endif 239 240 /* Try to insert 5 bytes jmp/jmpq to our stub code */ 240 241 … … 243 244 if (crStrcmp(psFuncName, "glXCreateGLXPixmapMESA")) 244 245 { 245 crError("Can't patch size too small.(%s)", psFuncName);246 crError("Can't patch size is too small.(%s)", psFuncName); 246 247 } 247 248 return; … … 249 250 250 251 shift = (void*)((intptr_t)pStart-((intptr_t)dlip.dli_saddr+5)); 251 #ifndef VBOX_NO_MESA_PATCH_REPORTS252 crDebug("Inserting jmp[q] with shift %p instead", shift);253 #endif254 255 252 #ifdef RT_ARCH_AMD64 256 { 257 int64_t offset = (intptr_t)shift; 258 259 if (offset>INT32_MAX || offset<INT32_MIN) 253 offset = (intptr_t)shift; 254 if (offset>INT32_MAX || offset<INT32_MIN) 255 { 256 /*try to insert 64bit abs jmp*/ 257 if (sym->st_size>=FAKEDRI_JMP64_PATCH_SIZE) 258 { 259 # ifndef VBOX_NO_MESA_PATCH_REPORTS 260 crDebug("Inserting movq/jmp instead"); 261 # endif 262 /*add 64bit abs jmp*/ 263 patch[0] = 0x49; /*movq %r11,imm64*/ 264 patch[1] = 0xBB; 265 crMemcpy(&patch[2], &pStart, 8); 266 patch[10] = 0x41; /*jmp *%r11*/ 267 patch[11] = 0xFF; 268 patch[12] = 0xE3; 269 pStart = &patch[0]; 270 pEnd = &patch[FAKEDRI_JMP64_PATCH_SIZE]; 271 } 272 else 260 273 { 261 274 FAKEDRI_PatchNode *pNode; … … 280 293 } 281 294 } 282 #endif 283 284 patch[0] = 0xE9; 285 crMemcpy(&patch[1], &shift, 4); 295 else 296 #endif 297 { 286 298 #ifndef VBOX_NO_MESA_PATCH_REPORTS 287 crDebug("Patch: E9 %x", *((int*)&patch[1])); 288 #endif 289 pStart = &patch[0]; 290 pEnd = &patch[5]; 299 crDebug("Inserting jmp[q] with shift %p instead", shift); 300 #endif 301 patch[0] = 0xE9; 302 crMemcpy(&patch[1], &shift, 4); 303 pStart = &patch[0]; 304 pEnd = &patch[5]; 305 } 291 306 } 292 307
Note:
See TracChangeset
for help on using the changeset viewer.