Changeset 4010 for branches/GRACE/src/win32k/dev32/d32init.c
- Timestamp:
- Aug 14, 2000, 10:57:07 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GRACE/src/win32k/dev32/d32init.c
r3834 r4010 1 /* $Id: d32init.c,v 1.19.4. 1 2000-07-16 22:42:03bird Exp $1 /* $Id: d32init.c,v 1.19.4.2 2000-08-14 08:57:04 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. … … 44 44 #include "ldrCalls.h" 45 45 #include "macros.h" 46 #include "errors.h" 46 47 47 48 #ifdef R3TST … … 471 472 for (i = 0; i < 2 && pKrnlInfo->ulBuild == 0; i++) 472 473 { 473 #ifndef R3TST474 474 const char *psz = (const char*)pKrnlOTE[i].ote_base; 475 475 const char *pszEnd = psz + pKrnlOTE[i].ote_size - 50; /* Last possible search position. */ 476 #else477 extern const char *pszInternalRevision; /* defined in win32ktst.c */478 const char *psz = pszInternalRevision;479 const char *pszEnd = psz + 3;480 #endif481 476 482 477 while (psz < pszEnd) … … 524 519 525 520 /* Check if its a debug kernel (look for DEBUG at start of object 3-5) */ 526 #ifndef R3TST527 521 j = 3; 528 522 while (j < 5) … … 541 535 j++; 542 536 } 543 #else544 NOREF(j);545 #endif546 537 547 538 /* Display info */ … … 598 589 || ((bModRM & 0xc0) == 0 && (bModRM & 0x07) == 5)) /* ex. mov ebp,[0ff231234h] */ 599 590 { /* 32-bit displacement */ 600 return 5 ;591 return 5 + ((bModRM & 0x7) == 0x4); // + SIB 601 592 } 602 593 else if ((bModRM & 0xc0) == 0x40) /* ex. mov ecx,[esi]+4fh */ 603 594 { /* 8-bit displacement */ 604 return 2 ;595 return 2 + ((bModRM & 0x7) == 0x4); // + SIB 605 596 } 606 597 /* no displacement (only /r byte) */ … … 670 661 * push ebp 671 662 * or 663 * mov ecx, r/m32 664 * or 665 * jmp dword 666 * or 667 * sub esp, imm8 668 * or 672 669 * mov eax, msoff32 673 670 * 674 671 */ 675 if ((pach[0] == 0x55 && (pach[1] == 0x8b || pach[1] == 0xa1)) /* t wo first prologs */672 if ((pach[0] == 0x55 && (pach[1] == 0x8b || pach[1] == 0xa1)) /* the two first prologs */ 676 673 || 677 (pach[0] == 0xB8 && (pach[5] == 0xEB || pach[5] == 0x55 ) && !fOverload) /* two next prologs */ 674 (pach[0] == 0xB8 && (pach[5] == 0xEB || pach[5] == 0x55) && !fOverload) /* the two next prologs */ 675 || 676 (pach[0] == 0x8B && !fOverload) /* the next prolog */ 677 || 678 (pach[0] == 0xFF && !fOverload) /* the next prolog */ 679 || 680 (pach[0] == 0x83 && !fOverload) /* the next prolog */ 678 681 || 679 682 (pach[0] == 0xa1 && !fOverload) /* last prolog */ … … 762 765 case 0x8b: /* mov /r */ 763 766 case 0x8d: /* lea /r */ 764 if ((pach[1] & 0x7) == 4 && (pach[1] & 0xc0) != 0xc0) /* invalid instruction!?! */765 return -1;766 767 cb += cb2 = ModR_M_32bit(pach[1]); 767 768 pach += cb2; … … 801 802 break; 802 803 804 /* 805 * jmp /digit 806 */ 807 case 0xff: 808 cb += cb2 = 4 + ModR_M_32bit(pach[1]); /* 4 is the size of the imm32 */ 809 pach += cb2; 810 break; 811 803 812 default: 804 813 kprintf(("interpretFunctionProlog32: unknown instruction 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); … … 811 820 else 812 821 { 813 kprintf(("interpretFunctionProlog32: unknown prolog start. 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 822 kprintf(("interpretFunctionProlog32: unknown prolog start. 0x%x 0x%x 0x%x 0x%x 0x%x\n", 823 pach[0], pach[1], pach[2], pach[3], pach[4])); 814 824 cb = 0; 815 825 } … … 947 957 else 948 958 { 949 kprintf(("interpretFunctionProlog 32: unknown instruction (-3) 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2]));959 kprintf(("interpretFunctionProlog16: unknown instruction (-3) 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 950 960 return -3; 951 961 } … … 986 996 pulTKSSBase32 = (PULONG)_TKSSBase16; 987 997 988 #ifdef R3TST989 R3TstFixImportTab();990 #endif991 992 998 /* Check that pKrnlOTE is set */ 993 999 usRc = GetKernelInfo32(NULL); … … 1014 1020 } 1015 1021 1016 #ifndef R3TST1017 1022 /* Verify read/writeable. */ 1018 1023 if (_aImportTab[i].iObject >= pKrnlSMTE->smte_objcnt /* object index valid? */ … … 1032 1037 1033 1038 1034 1039 #ifndef R3TST 1035 1040 if (_aImportTab[i].ulAddress < 0xffe00000UL) 1036 1041 { … … 1039 1044 return STATUS_DONE | STERR | ERROR_D32_INVALID_ADDRESS; 1040 1045 } 1041 #endif1046 #endif 1042 1047 1043 1048 switch (_aImportTab[i].fType & ~EPT_BIT_MASK) … … 1066 1071 if (cb <= 0 || cb + cbmin >= MAXSIZE_PROLOG) 1067 1072 { /* failed, too small or too large. */ 1068 kprintf(("VerifyImportTab32: verify failed for procedure no.%d (c d=%d)\n", i, cb));1073 kprintf(("VerifyImportTab32: verify failed for procedure no.%d (cb=%d)\n", i, cb)); 1069 1074 return STATUS_DONE | STERR | ERROR_D32_TOO_INVALID_PROLOG; 1070 1075 } … … 1200 1205 else 1201 1206 { /* !fatal! - this could never happen really... */ 1202 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n", i));1207 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n", i)); 1203 1208 Int3(); /* ipe - later! */ 1204 1209 return ERROR_D32_VERIFY_FAILED; … … 1245 1250 else 1246 1251 { /* !fatal! - this could never happen really... */ 1247 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n", i));1252 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when rehooking it!\n", i)); 1248 1253 Int3(); /* ipe - later! */ 1249 1254 return ERROR_D32_VERIFY_FAILED; … … 1273 1278 else 1274 1279 { /* !fatal! - this should never really happen... */ 1275 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n", i));1280 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n", i)); 1276 1281 Int3(); /* ipe - later! */ 1277 1282 return ERROR_D32_VERIFY_FAILED; … … 1301 1306 else 1302 1307 { /* !fatal! - this should never really happen... */ 1303 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n", i));1308 kprintf(("ImportTabInit: FATAL verify failed for procedure no.%d when importing it!\n", i)); 1304 1309 Int3(); /* ipe - later! */ 1305 1310 return ERROR_D32_VERIFY_FAILED; … … 1350 1355 static MTE KrnlMTE; 1351 1356 static SMTE KrnlSMTE; 1352 static OTE aKrnlOTE[17];1353 1354 extern int cObjectsFake; /* defined in win32ktst.c */1355 1357 1356 1358 KrnlMTE.mte_swapmte = &KrnlSMTE; 1357 1359 KrnlSMTE.smte_objtab = &aKrnlOTE[0]; 1358 1360 KrnlSMTE.smte_objcnt = cObjectsFake; 1359 1360 aKrnlOTE[0].ote_size = 0x00000FB4;1361 aKrnlOTE[0].ote_base = 0xffe10000;1362 aKrnlOTE[0].ote_flags = 0x80001063;1363 aKrnlOTE[0].ote_pagemap = 1;1364 aKrnlOTE[0].ote_mapsize = 1;1365 aKrnlOTE[0].ote_sel = 0;1366 aKrnlOTE[0].ote_hob = 0;1367 1368 aKrnlOTE[1].ote_size = 0x0000A7CD;1369 aKrnlOTE[1].ote_base = 0xffe20000;1370 aKrnlOTE[1].ote_flags = 0x80001063;1371 aKrnlOTE[1].ote_pagemap = 0x00000002;1372 aKrnlOTE[1].ote_mapsize = 0x0000000B;1373 aKrnlOTE[1].ote_sel = 0x0;1374 aKrnlOTE[1].ote_hob = 0x0;1375 1376 aKrnlOTE[2].ote_size = 0x000084C9;1377 aKrnlOTE[2].ote_base = 0xffe30000;1378 aKrnlOTE[2].ote_flags = 0x80001045;1379 aKrnlOTE[2].ote_pagemap = 0x0000000D;1380 aKrnlOTE[2].ote_mapsize = 0x00000009;1381 aKrnlOTE[2].ote_sel = 0x0;1382 aKrnlOTE[2].ote_hob = 0x0;1383 1384 aKrnlOTE[3].ote_size = 0x00010000;1385 aKrnlOTE[3].ote_base = 0xffe40000;1386 aKrnlOTE[3].ote_flags = 0x800090A3;1387 aKrnlOTE[3].ote_pagemap = 0x00000016;1388 aKrnlOTE[3].ote_mapsize = 0x00000010;1389 aKrnlOTE[3].ote_sel = 0x0;1390 aKrnlOTE[3].ote_hob = 0x0;1391 1392 aKrnlOTE[4].ote_size = 0x00002A80;1393 aKrnlOTE[4].ote_base = 0xffe50000;1394 aKrnlOTE[4].ote_flags = 0x80009023;1395 aKrnlOTE[4].ote_pagemap = 0x00000026;1396 aKrnlOTE[4].ote_mapsize = 0x00000003;1397 aKrnlOTE[4].ote_sel = 0x0;1398 aKrnlOTE[4].ote_hob = 0x0;1399 1400 aKrnlOTE[5].ote_size = 0x00005734;1401 aKrnlOTE[5].ote_base = 0xffe60000;1402 aKrnlOTE[5].ote_flags = 0x80001023;1403 aKrnlOTE[5].ote_pagemap = 0x00000029;1404 aKrnlOTE[5].ote_mapsize = 0x00000003;1405 aKrnlOTE[5].ote_sel = 0x0;1406 aKrnlOTE[5].ote_hob = 0x0;1407 1408 aKrnlOTE[6].ote_size = 0x00002833;1409 aKrnlOTE[6].ote_base = 0xffe70000;1410 aKrnlOTE[6].ote_flags = 0x80001015;1411 aKrnlOTE[6].ote_pagemap = 0x0000002C;1412 aKrnlOTE[6].ote_mapsize = 0x00000003;1413 aKrnlOTE[6].ote_sel = 0x0;1414 aKrnlOTE[6].ote_hob = 0x0;1415 1416 aKrnlOTE[7].ote_size = 0x000001B0;1417 aKrnlOTE[7].ote_base = 0xffe80000;1418 aKrnlOTE[7].ote_flags = 0x80002213;1419 aKrnlOTE[7].ote_pagemap = 0x0000002F;1420 aKrnlOTE[7].ote_mapsize = 0x00000001;1421 aKrnlOTE[7].ote_sel = 0x0;1422 aKrnlOTE[7].ote_hob = 0x0;1423 1424 aKrnlOTE[8].ote_size = 0x000027CC;1425 aKrnlOTE[8].ote_base = 0xffe90000;1426 aKrnlOTE[8].ote_flags = 0x80002013;1427 aKrnlOTE[8].ote_pagemap = 0x00000030;1428 aKrnlOTE[8].ote_mapsize = 0x00000003;1429 aKrnlOTE[8].ote_sel = 0x0;1430 aKrnlOTE[8].ote_hob = 0x0;1431 1432 aKrnlOTE[9].ote_size = 0x0000FDA8;1433 aKrnlOTE[9].ote_base = 0xffeA0000;1434 aKrnlOTE[9].ote_flags = 0x80002033;1435 aKrnlOTE[9].ote_pagemap = 0x00000033;1436 aKrnlOTE[9].ote_mapsize = 0x0000000D;1437 aKrnlOTE[9].ote_sel = 0x0;1438 aKrnlOTE[9].ote_hob = 0x0;1439 1440 aKrnlOTE[10].ote_size = 0x0000ECD6;1441 aKrnlOTE[10].ote_base = 0xffeB0000;1442 aKrnlOTE[10].ote_flags = 0x80001015;1443 aKrnlOTE[10].ote_pagemap = 0x00000040;1444 aKrnlOTE[10].ote_mapsize = 0x0000000F;1445 aKrnlOTE[10].ote_sel = 0x0;1446 aKrnlOTE[10].ote_hob = 0x0;1447 1448 aKrnlOTE[11].ote_size = 0x0000EAF4;1449 aKrnlOTE[11].ote_base = 0xffeC0000;1450 aKrnlOTE[11].ote_flags = 0x80001015;1451 aKrnlOTE[11].ote_pagemap = 0x0000004F;1452 aKrnlOTE[11].ote_mapsize = 0x0000000F;1453 aKrnlOTE[11].ote_sel = 0x0;1454 aKrnlOTE[11].ote_hob = 0x0;1455 1456 aKrnlOTE[12].ote_size = 0x0000D900;1457 aKrnlOTE[12].ote_base = 0xffeD0000;1458 aKrnlOTE[12].ote_flags = 0x80001015;1459 aKrnlOTE[12].ote_pagemap = 0x0000005E;1460 aKrnlOTE[12].ote_mapsize = 0x0000000E;1461 aKrnlOTE[12].ote_sel = 0x0;1462 aKrnlOTE[12].ote_hob = 0x0;1463 1464 aKrnlOTE[13].ote_size = 0x0000D6DC;1465 aKrnlOTE[13].ote_base = 0xffeE0000;1466 aKrnlOTE[13].ote_flags = 0x80001015;1467 aKrnlOTE[13].ote_pagemap = 0x0000006C;1468 aKrnlOTE[13].ote_mapsize = 0x0000000E;1469 aKrnlOTE[13].ote_sel = 0x0;1470 aKrnlOTE[13].ote_hob = 0x0;1471 1472 aKrnlOTE[14].ote_size = 0x000B684B;1473 aKrnlOTE[14].ote_base = 0xffeF0000;1474 aKrnlOTE[14].ote_flags = 0x80002015;1475 aKrnlOTE[14].ote_pagemap = 0x0000007A;1476 aKrnlOTE[14].ote_mapsize = 0x000000B7;1477 aKrnlOTE[14].ote_sel = 0x0;1478 aKrnlOTE[14].ote_hob = 0x0;1479 1480 aKrnlOTE[15].ote_size = 0x000B684B;1481 aKrnlOTE[15].ote_base = 0xffeF0000;1482 aKrnlOTE[15].ote_flags = 0x80002015;1483 aKrnlOTE[15].ote_pagemap = 0x0000007A;1484 aKrnlOTE[15].ote_mapsize = 0x000000B7;1485 aKrnlOTE[15].ote_sel = 0x0;1486 aKrnlOTE[15].ote_hob = 0x0;1487 1488 aKrnlOTE[16].ote_size = 0x000B684B;1489 aKrnlOTE[16].ote_base = 0xffeF0000;1490 aKrnlOTE[16].ote_flags = 0x80002015;1491 aKrnlOTE[16].ote_pagemap = 0x0000007A;1492 aKrnlOTE[16].ote_mapsize = 0x000000B7;1493 aKrnlOTE[16].ote_sel = 0x0;1494 aKrnlOTE[16].ote_hob = 0x0;1495 1361 1496 1362 return &KrnlMTE;
Note:
See TracChangeset
for help on using the changeset viewer.