Changeset 2898 for trunk/src/win32k/dev32
- Timestamp:
- Feb 25, 2000, 7:19:24 PM (26 years ago)
- Location:
- trunk/src/win32k/dev32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/dev32/d32globals.c
r2849 r2898 1 /* $Id: d32globals.c,v 1. 4 2000-02-21 15:59:20bird Exp $1 /* $Id: d32globals.c,v 1.5 2000-02-25 18:15:03 bird Exp $ 2 2 * 3 3 * d32globals - global data (32-bit) … … 18 18 *******************************************************************************/ 19 19 #include <os2.h> 20 #include "options.h"21 20 22 21 /******************************************************************************* … … 24 23 *******************************************************************************/ 25 24 PULONG pulTKSSBase32; 26 #ifdef DEBUG27 char szStartOfOptions[] = "START-OF-OPTIONS";28 #endif29 struct options options = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};30 #ifdef DEBUG31 char szEndOfOptions[] = "END-OF-OPTIONS";32 #endif33 25 -
trunk/src/win32k/dev32/d32init.c
r2878 r2898 1 /* $Id: d32init.c,v 1.1 5 2000-02-23 23:01:00bird Exp $1 /* $Id: d32init.c,v 1.16 2000-02-25 18:15:03 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. … … 15 15 /* the one used in calltab.asm. */ 16 16 #define static /* just to make all symbols visible in the kernel debugger. */ 17 #if 0 /* Enable this to have extra debug logging. */ 18 #define kprintf2(a) kprintf 19 #else 20 #define kprintf2(a) (void)0 21 #endif 17 22 18 23 … … 49 54 static char * apszInfoLevel[] = {"INFOLEVEL_QUIET", "INFOLEVEL_ERROR", "INFOLEVEL_WARNING", "INFOLEVEL_INFO", "INFOLEVEL_INFOALL", "!invalid!"}; 50 55 #endif 56 static PMTE pKrnlMTE = NULL; 57 static PSMTE pKrnlSMTE = NULL; 58 static POTE pKrnlOTE = NULL; 59 51 60 52 61 /******************************************************************************* … … 70 79 /* extern(s) located in mytkExecPgm.asm */ 71 80 extern char mytkExecPgm; 72 extern char CODE32START;73 extern char CODE32END;74 extern char CONST32_ROEND;75 extern char DATA16START;76 extern char DATA16_CONSTEND;77 81 78 82 … … 94 98 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit) 95 99 { 96 char *pszTmp2; 97 char *pszTmp; 98 ULONG ul; 99 APIRET rc; 100 LOCKHANDLE lhData16={0,0,0,0, 0,0,0,0, 0,0,0,0}; 101 LOCKHANDLE lhData = {0,0,0,0, 0,0,0,0, 0,0,0,0}; 102 LOCKHANDLE lhCode = {0,0,0,0, 0,0,0,0, 0,0,0,0}; 100 char * pszTmp2; 101 char * pszTmp; 102 ULONG ul; 103 APIRET rc; 104 LOCKHANDLE lockhandle; 103 105 104 106 pulTKSSBase32 = (PULONG)_TKSSBase16; 105 106 SET_OPTIONS_TO_DEFAULT(options);107 107 108 108 /*---------------------*/ … … 273 273 274 274 /* Transfer version and build number from 16-bit probkrnl.c */ 275 options.ulBuild = _u lBuild;275 options.ulBuild = _usBuild; 276 276 options.usVerMajor = _usVerMajor; 277 277 options.usVerMinor = _usVerMinor; 278 278 279 /* log option summary - FIXME */ 279 /* Log option summary */ 280 #ifdef DEBUG 280 281 kprintf(("Options - Summary - Start\n")); 281 282 if (options.fQuiet) … … 306 307 options.cbSwpHeapInit, options.cbSwpHeapMax)); 307 308 kprintf(("Options - Summary - End\n")); 309 #endif /* debug */ 308 310 /* end option summary */ 309 311 … … 331 333 */ 332 334 /* 32-bit code segment */ 335 memset(SSToDS(&lockhandle), 0, sizeof(lockhandle)); 333 336 rc = D32Hlp_VMLock2(&CODE32START, 334 337 ((unsigned)&CODE32END & ~0xFFF) - (unsigned)&CODE32START, /* Round down so we don't overlap with the next request. */ 335 338 VMDHL_LONG, 336 SSToDS(&l hCode));339 SSToDS(&lockhandle)); 337 340 if (rc != NO_ERROR) 338 341 kprintf(("code segment lock failed with with rc=%d\n", rc)); 339 342 340 343 /* 32-bit data segment */ 344 memset(SSToDS(&lockhandle), 0, sizeof(lockhandle)); 341 345 rc = D32Hlp_VMLock2(callTab, 342 346 &CONST32_ROEND - (char*)callTab, 343 347 VMDHL_LONG | VMDHL_WRITE, 344 SSToDS(&l hData));348 SSToDS(&lockhandle)); 345 349 if (rc != NO_ERROR) 346 350 kprintf(("data segment lock failed with with rc=%d\n", rc)); 347 351 348 /* 16-bit data segment */ 352 /* 16-bit data segment - is this necessary? */ 353 memset(SSToDS(&lockhandle), 0, sizeof(lockhandle)); 349 354 rc = D32Hlp_VMLock2(&DATA16START, 350 &DATA16 _CONSTEND - &DATA16START,355 &DATA16END - &DATA16START, 351 356 VMDHL_LONG | VMDHL_WRITE, 352 SSToDS(&l hData16));357 SSToDS(&lockhandle)); 353 358 if (rc != NO_ERROR) 354 kprintf((" data segment lock failed with with rc=%d\n", rc));359 kprintf(("16-bit data segment lock failed with with rc=%d\n", rc)); 355 360 356 361 return STATUS_DONE; … … 371 376 int i = 0; 372 377 378 /* determin ulBase */ 373 379 if (*pszNum == '0') 374 380 if (pszNum[1] == 'x' || pszNum[1] == 'X') … … 403 409 /** 404 410 * Get kernel OTEs 411 * This function set pKrnlMTE, pKrnlSMTE and pKrnlOTE. 405 412 * @returns Strategy return code: 406 413 * STATUS_DONE on success. 407 414 * STATUS_DONE | STERR | errorcode on failure. 408 * @param pOTEBuf Pointer to output buffer. 415 * @param pKrnlInfo Pointer to output buffer. 416 * If NULL only the three global variables are set. 409 417 * @status completely implemented and tested. 410 418 * @author knut st. osmundsen 411 419 * @remark Called from IOCtl. 420 * WARNING! This function is called before the initroutine (R0INIT)! 412 421 */ 413 USHORT _loadds _Far32 _Pascal Get OTEs32(PKRNLOBJTABLE pOTEBuf)422 USHORT _loadds _Far32 _Pascal GetKernelInfo32(PKRNLINFO pKrnlInfo) 414 423 { 415 PMTE pMTE;416 PSMTE pSMTE;417 POTE pOTE;418 424 int i; 419 425 USHORT usRc; 420 426 421 pMTE = GetOS2KrnlMTE(); 422 if (pMTE != NULL) 427 /* VerifyImporTab32 is called before the initroutine! */ 428 pulTKSSBase32 = (PULONG)_TKSSBase16; 429 430 /* Find the kernel OTE table */ 431 pKrnlMTE = GetOS2KrnlMTE(); 432 if (pKrnlMTE != NULL) 423 433 { 424 p SMTE = pMTE->mte_swapmte;425 if (p SMTE != NULL)434 pKrnlSMTE = pKrnlMTE->mte_swapmte; 435 if (pKrnlSMTE != NULL) 426 436 { 427 pOTEBuf->cObjects = (unsigned char)pSMTE->smte_objcnt; 428 if (pSMTE->smte_objcnt <= MAXKRNLOBJECTS) 437 if (pKrnlSMTE->smte_objcnt <= MAXKRNLOBJECTS) 429 438 { 430 p OTE = pSMTE->smte_objtab;431 if (p OTE != NULL)439 pKrnlOTE = pKrnlSMTE->smte_objtab; 440 if (pKrnlOTE != NULL) 432 441 { 433 /* Copy OTEs */ 434 for (i = 0; i < pOTEBuf->cObjects; i++) 435 memcpy((void*)&pOTEBuf->aObjects[i], &pOTE[i], sizeof(OTE)); 442 /* 443 * Thats all? 444 */ 445 if (pKrnlInfo == NULL) 446 return NO_ERROR; 447 448 pKrnlInfo->cObjects = (unsigned char)pKrnlSMTE->smte_objcnt; 449 450 /* 451 * Copy OTEs 452 */ 453 for (i = 0; i < pKrnlInfo->cObjects; i++) 454 { 455 memcpy((void*)&pKrnlInfo->aObjects[i], &pKrnlOTE[i], sizeof(OTE)); 456 kprintf2(("GetKernelInfo32: %d base=0x%08x size=0x%08x flags=0x%08x\n", 457 i, pKrnlOTE[i].ote_base, pKrnlOTE[i].ote_size, pKrnlOTE[i].ote_flags)); 458 } 436 459 usRc = 0; 437 460 … … 439 462 * Search for internal revision stuff in the two first objects. 440 463 */ 441 #if 0442 for (i = 0; i < 2 ; i++)464 pKrnlInfo->usBuild = 0; 465 for (i = 0; i < 2 && pKrnlInfo->usBuild == 0; i++) 443 466 { 444 const char *psz = (const char*)p OTE[i].ote_base;445 const char *pszEnd = psz + p OTE[i].ote_size;467 const char *psz = (const char*)pKrnlOTE[i].ote_base; 468 const char *pszEnd = psz + pKrnlOTE[i].ote_size; 446 469 447 470 while (psz + 100 < pszEnd) 448 471 { 449 strncmp(psz, "Internal revision"); 472 if (strncmp(psz, "Internal revision ", 18) == 0 && (psz[18] >= '0' && psz[18] <= '9')) 473 { 474 int j; 475 kprintf2(("GetOTEs32: found internal revision: '%s'\n", psz)); 476 477 /* skip to end of "Internal revision " string. */ 478 psz += 18; 479 480 /* Read number*/ 481 while ((*psz >= '0' && *psz <= '9') || *psz == '.') 482 { 483 if (*psz != '.') 484 pKrnlInfo->usBuild = (unsigned short)(pKrnlInfo->usBuild * 10 + (*psz - '0')); 485 psz++; 486 } 487 488 /* Check if build number seems valid. */ 489 if ( !(pKrnlInfo->usBuild >= 8254 && pKrnlInfo->usBuild < 8383) /* Warp 3 fp 32 -> fp 60 */ 490 && !(pKrnlInfo->usBuild >= 9023 && pKrnlInfo->usBuild < 9063) /* Warp 4 GA -> fp 40 */ 491 && !(pKrnlInfo->usBuild >= 14039 && pKrnlInfo->usBuild < 14080) /* Warp 4.5 GA -> fp 40 */ 492 ) 493 { 494 kprintf(("GetOTEs32: info summary: Build %d is invalid - invalid fixpack?\n", pKrnlInfo->usBuild)); 495 usRc = 6; 496 break; 497 } 498 499 /* If this is an Aurora or Warp 3 kernel there is more info! */ 500 pKrnlInfo->fSMP = (char)(*psz != ',' 501 && ( (psz[1] == '_' && (psz[2] == 'S' || psz[2] == 's')) /* F_SMP */ 502 || (psz[2] == '_' && (psz[1] == 'S' || psz[1] == 's'))));/* _SMP */ 503 504 /* Check if its a debug kernel (look for DEBUG at start of object 3-5) */ 505 j = 3; 506 pKrnlInfo->fDebug = FALSE; 507 while (j < 5) 508 { 509 510 /* There should be no iopl object preceding the debugger data object. */ 511 if ((pKrnlOTE[j].ote_flags & OBJIOPL) != 0) 512 break; 513 /* Is this is? */ 514 if ((pKrnlOTE[j].ote_flags & OBJINVALID) == 0 515 && (pKrnlOTE[j].ote_flags & (OBJREAD | OBJWRITE)) == (OBJREAD | OBJWRITE) 516 && strncmp((char*)pKrnlOTE[j].ote_base, "DEBUG", 5) == 0) 517 { 518 pKrnlInfo->fDebug = TRUE; 519 break; 520 } 521 j++; 522 } 523 524 /* Display info */ 525 kprintf(("GetOTEs32: info summary: Build %d, fSMP=%d, fDebug=%d\n", 526 pKrnlInfo->usBuild, pKrnlInfo->fSMP, pKrnlInfo->fDebug)); 527 528 /* Break out */ 529 break; 530 } 450 531 451 532 /* next */ 452 533 psz++; 453 } 534 } /* while loop searching for "Internal revision " */ 535 } /* for loop on objects 0-1. */ 536 537 /* Set error code if not found */ 538 if (pKrnlInfo->usBuild == 0) 539 { 540 usRc = 5; 541 kprintf(("GetOTEs32: Internal revision was not found!\n")); 454 542 } 455 #endif456 543 } 457 544 else … … 466 553 else 467 554 usRc = 1; 555 468 556 469 557 if (usRc != 0) … … 515 603 int cb = -3; 516 604 517 kprintf (("interpretFunctionProlog32(0x%08x, %d):\n"518 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n"519 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n",520 pach, fOverload,521 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7],522 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15]));605 kprintf2(("interpretFunctionProlog32(0x%08x, %d):\n" 606 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n" 607 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n", 608 pach, fOverload, 609 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7], 610 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15])); 523 611 524 612 /* … … 699 787 int cb = -7; 700 788 701 kprintf (("interpretFunctionProlog16(0x%08x, %d):\n"702 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n"703 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n",704 pach, fOverload,705 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7],706 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15]));789 kprintf2(("interpretFunctionProlog16(0x%08x, %d):\n" 790 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n" 791 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n", 792 pach, fOverload, 793 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7], 794 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15])); 707 795 /* 708 796 * Check for the well known prolog (the only that is supported now) … … 817 905 * @returns 0 if ok. !0 if not ok. 818 906 * @remark Called from IOCtl. 819 * WARNING! VerifyImporTab32 is called before the initroutine!907 * WARNING! This function is called before the initroutine (R0INIT)! 820 908 */ 821 909 USHORT _loadds _Far32 _Pascal VerifyImportTab32(void) … … 828 916 pulTKSSBase32 = (PULONG)_TKSSBase16; 829 917 830 /* verify */ 918 /* Check that pKrnlOTE is set */ 919 if (GetKernelInfo32(NULL) != NO_ERROR) 920 return STATUS_DONE | STERR | 1; 921 922 /* 923 * Verify aImportTab. 924 */ 831 925 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 832 926 { 833 /* verify that it is found */ 927 /* 928 * Debug info 929 */ 930 kprintf2(("VerifyImportTab32: procedure no.%d is being checked: %s addr=0x%08x iObj=%d offObj=%d\n", 931 i, &_aImportTab[i].achName[0], _aImportTab[i].ulAddress, 932 _aImportTab[i].iObject, _aImportTab[i].offObject)); 933 934 /* Verify that it is found */ 834 935 if (!_aImportTab[i].fFound) 835 936 { 836 kprintf(("VerifyImportTab32: procedure no.%d was not f ound!\n", i));837 return STATUS_DONE | STERR | 1;937 kprintf(("VerifyImportTab32: procedure no.%d was not fFound!\n", i)); 938 return STATUS_DONE | STERR | 2; 838 939 } 839 940 840 /* verify read/writeable. - FIXME */ 941 /* Verify read/writeable. */ 942 if (_aImportTab[i].iObject >= pKrnlSMTE->smte_objcnt /* object index valid? */ 943 || _aImportTab[i].ulAddress < pKrnlOTE[_aImportTab[i].iObject].ote_base /* address valid? */ 944 || _aImportTab[i].ulAddress + 16 > (pKrnlOTE[_aImportTab[i].iObject].ote_base + 945 pKrnlOTE[_aImportTab[i].iObject].ote_size) /* address valid? */ 946 || _aImportTab[i].ulAddress - _aImportTab[i].offObject 947 != pKrnlOTE[_aImportTab[i].iObject].ote_base /* offObject ok? */ 948 ) 949 { 950 kprintf(("VerifyImportTab32: procedure no.%d has an invalid address or object number.!\n" 951 " %s addr=0x%08x iObj=%d offObj=%d\n", 952 i, &_aImportTab[i].achName[0], _aImportTab[i].ulAddress, 953 _aImportTab[i].iObject, _aImportTab[i].offObject)); 954 return STATUS_DONE | STERR | 3; 955 } 956 957 958 841 959 if (_aImportTab[i].ulAddress < 0xffe00000UL) 842 960 { 843 kprintf(("VerifyImportTab32: procedure no.%d has an inv lalid address, %#08x!\n",961 kprintf(("VerifyImportTab32: procedure no.%d has an invalid address, %#08x!\n", 844 962 i, _aImportTab[i].ulAddress)); 845 return STATUS_DONE | STERR | 2;963 return STATUS_DONE | STERR | 4; 846 964 } 847 965 … … 855 973 if (EPT32BitEntry(_aImportTab[i])) 856 974 { 857 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC32); 975 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, 976 _aImportTab[i].fType == EPT_PROC32); 858 977 cbmin = 5; /* Size of the jump instruction */ 859 978 } 860 979 else 861 980 { 862 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC16); 981 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, 982 _aImportTab[i].fType == EPT_PROC16); 863 983 cbmin = 7; /* Size of the far jump instruction */ 864 984 } … … 870 990 { /* failed, too small or too large. */ 871 991 kprintf(("VerifyImportTab32: verify failed for procedure no.%d (cd=%d)\n", i, cb)); 872 return STATUS_DONE | STERR | 3;992 return STATUS_DONE | STERR | 5; 873 993 } 874 994 break; … … 881 1001 kprintf(("VerifyImportTab32: only EPT_PROC is implemented\n",i)); 882 1002 Int3(); /* temporary fix! */ 883 return STATUS_DONE | STERR | 4;1003 return STATUS_DONE | STERR | 6; 884 1004 } 885 1005 } -
trunk/src/win32k/dev32/devfirst.asm
r2836 r2898 1 ; $Id: devfirst.asm,v 1. 4 2000-02-21 04:45:46bird Exp $1 ; $Id: devfirst.asm,v 1.5 2000-02-25 18:15:03 bird Exp $ 2 2 ; 3 3 ; DevFirst - entrypoint and segment definitions … … 28 28 public BSS32START 29 29 public CONST32_ROSTART 30 public _VFTSTART 31 public EH_DATASTART 32 30 33 31 34 public _strategyAsm0 32 35 public _strategyAsm1 33 public _CallGet OTEs3236 public _CallGetKernelInfo32 34 37 public _CallElfIOCtl 35 38 public _CallWin32kIOCtl … … 42 45 ; 43 46 extrn _TKSSBase16:dword 44 extrn GET OTES32:FAR47 extrn GETKERNELINFO32:FAR 45 48 extrn ELFIOCTL:FAR 46 49 extrn WIN32KIOCTL:FAR … … 86 89 ;; 87 90 ; Thunk procedure for R0Init32. 88 ; @cproto USHORT NEAR CallGet OTEs32(ULONG addressOTEBuf);89 ; @returns Same as Get OTEs32.90 ; @param address of OTEBuf 32-bit pointer to request data.91 ; @status completely implemented. 92 ; @author knut st. osmundsen 93 _CallGet OTEs32 PROC NEAR91 ; @cproto USHORT NEAR CallGetKernelInfo32(ULONG addressKrnlInfoBuf); 92 ; @returns Same as GetKernelInfo32. 93 ; @param addressKrnlInfoBuf 32-bit pointer to request data on stack. 94 ; @status completely implemented. 95 ; @author knut st. osmundsen 96 _CallGetKernelInfo32 PROC NEAR 94 97 ASSUME CS:CODE16 95 98 push ds 96 99 push word ptr [esp+6] ; push high word. 97 100 push word ptr [esp+6] ; push low word. 98 call far ptr FLAT:GET OTES32101 call far ptr FLAT:GETKERNELINFO32 99 102 pop ds 100 103 retn 101 _CallGet OTEs32 ENDP104 _CallGetKernelInfo32 ENDP 102 105 103 106 -
trunk/src/win32k/dev32/devlast.asm
r2836 r2898 1 ; $Id: devlast.asm,v 1. 4 2000-02-21 04:45:46bird Exp $1 ; $Id: devlast.asm,v 1.5 2000-02-25 18:15:03 bird Exp $ 2 2 ; 3 3 ; DevLast - the object file termintating the resident part of the objects. … … 30 30 public BSS32END 31 31 public CONST32_ROEND 32 public _VFTEND 33 public EH_DATAEND 32 34 public _CallR0Init32 33 35 public _CallVerifyImportTab32 … … 93 95 94 96 CODE32 segment 95 CODE32END db ?97 CODE32END LABEL BYTE 96 98 CODE32 ends 97 99 98 100 DATA32 segment 99 DATA32END db ?101 DATA32END LABEL BYTE 100 102 DATA32 ends 101 103
Note:
See TracChangeset
for help on using the changeset viewer.