Changeset 13416
- Timestamp:
- Feb 21, 2000, 5:45:47 AM (25 years ago)
- Location:
- tags/trunk/src/win32k
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/win32k/dev16/d16init.c ¶
r12264 r13416 1 /* $Id: d16init.c,v 1. 4 1999-11-10 01:45:30bird Exp $1 /* $Id: d16init.c,v 1.5 2000-02-21 04:45:45 bird Exp $ 2 2 * 3 3 * d16init - init routines for both drivers. … … 48 48 * @remark pRpIn and pRpOut points to the same memory. 49 49 */ 50 USHORT _neardev0Init(PRPINITIN pRpIn, PRPINITOUT pRpOut)50 USHORT NEAR dev0Init(PRPINITIN pRpIn, PRPINITOUT pRpOut) 51 51 { 52 52 Device_Help = pRpIn->DevHlpEP; … … 70 70 * @remark pRpIn and pRpOut points to the same memory. 71 71 */ 72 USHORT _neardev1Init(PRPINITIN pRpIn, PRPINITOUT pRpOut)72 USHORT NEAR dev1Init(PRPINITIN pRpIn, PRPINITOUT pRpOut) 73 73 { 74 74 APIRET rc; … … 103 103 } 104 104 else 105 npszErrMsg = "DosDevIOCtl failed.\n\r"; 105 { 106 APIRET rc2 = rc; 107 NPSZ npsz; 108 /*0123456789012345678901234567890 1*/ 109 npszErrMsg = "DosDevIOCtl failed. rc= \n\r"; 110 111 npsz = &npszErrMsg[29]; 112 do 113 { 114 *npsz-- = (char)((rc2 % 10) + '0'); 115 rc2 = rc2/10; 116 } while (rc2 > 0); 117 } 118 106 119 DosClose(hDev0); 107 120 } … … 133 146 * @param pRp Generic IO Control request packet. 134 147 */ 135 USHORT R0Init16(PRP_GENIOCTL pRp)148 USHORT NEAR R0Init16(PRP_GENIOCTL pRp) 136 149 { 137 150 USHORT usRc = STATUS_DONE; 138 151 APIRET rc; 139 PDOSTABLE pDT;140 PDOSTABLE2 pDT2;141 152 142 153 /* First we're to get the DosTable2 stuff. */ 143 rc = DevHelp_GetDOSVar(9, 0, &pDT);154 rc = initGetDosTableData(); 144 155 if (rc == NO_ERROR) 145 156 { … … 150 161 ULONG ulLinData; 151 162 152 pDT2 = (PDOSTABLE2)((char FAR *)pDT + pDT->cul*4 + 1);153 TKSSBase16 = (ULONG)pDT2->pTKSSBase;154 R0FlatCS16 = (USHORT)pDT2->R0FlatCS;155 R0FlatDS16 = (USHORT)pDT2->R0FlatDS;156 163 if (!DevHelp_VirtToLin(SELECTOROF(pRp->ParmPacket), OFFSETOF(pRp->ParmPacket), &ulLinParm) 157 164 && … … 159 166 ) 160 167 { 161 if (!(rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE | VMDHL_VERIFY,168 if (!(rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE, 162 169 ulLinParm, sizeof(D16R0INITPARAM), 163 170 (LIN)~0UL, SSToDS_16(&hLockParm[0]), &cPages)) 164 171 && 165 !DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE | VMDHL_VERIFY,172 !DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE, 166 173 ulLinData, sizeof(D16R0INITDATA), 167 174 (LIN)~0UL, SSToDS_16(&hLockData[0]), &cPages) … … 215 222 return usRc; 216 223 } 224 225 226 227 /** 228 * Gets the data we need from the DosTables. 229 * This data is TKSSBase16, R0FlatCS16 and R0FlatDS16. 230 * @returns Same as DevHelp_GetDosVar. 231 * @status completely implemented. 232 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 233 * @remark If you are not sure if TKSSBase16 is set or not, call this. 234 * After R0Init16 is called TKSSBase16 _is_ set. 235 * IMPORTANT! This function must _not_ be called after the initiation of the second device driver!!! 236 */ 237 USHORT NEAR initGetDosTableData(void) 238 { 239 APIRET rc; 240 PDOSTABLE pDT; 241 PDOSTABLE2 pDT2; 242 243 if (TKSSBase16 != 0) 244 return NO_ERROR; 245 246 /* First we're to get the DosTable2 stuff. */ 247 rc = DevHelp_GetDOSVar(9, 0, &pDT); 248 if (rc == NO_ERROR) 249 { 250 pDT2 = (PDOSTABLE2)((char FAR *)pDT + pDT->cul*4 + 1); 251 TKSSBase16 = (ULONG)pDT2->pTKSSBase; 252 R0FlatCS16 = (USHORT)pDT2->R0FlatCS; 253 R0FlatDS16 = (USHORT)pDT2->R0FlatDS; 254 } 255 return rc; 256 } -
TabularUnified tags/trunk/src/win32k/dev16/d16strat.c ¶
r13412 r13416 1 /* $Id: d16strat.c,v 1. 5 2000-02-20 04:27:22bird Exp $1 /* $Id: d16strat.c,v 1.6 2000-02-21 04:45:45 bird Exp $ 2 2 * 3 3 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr) … … 145 145 { 146 146 ULONG ulLin; 147 if (fInitTime && TKSSBase16 == 0) 148 initGetDosTableData(); 147 149 if (DevHelp_VirtToLin(SELECTOROF(pRp->DataPacket), OFFSETOF(pRp->DataPacket), 148 150 &ulLin) != NO_ERROR) … … 153 155 case D16_IOCTL_VERIFYPROCTAB: 154 156 if (fInitTime) 157 { 158 if (TKSSBase16 == 0) 159 initGetDosTableData(); 155 160 return CallVerifyImportTab32(); 161 } 156 162 break; 157 163 } -
TabularUnified tags/trunk/src/win32k/dev16/probkrnl.c ¶
r13412 r13416 1 /* $Id: probkrnl.c,v 1.1 2 2000-02-20 04:27:23bird Exp $1 /* $Id: probkrnl.c,v 1.13 2000-02-21 04:45:45 bird Exp $ 2 2 * 3 3 * Description: Autoprobes the os2krnl file and os2krnl[*].sym files. … … 157 157 * Internal Functions * 158 158 *******************************************************************************/ 159 /* File an output replacements */ 159 160 static HFILE fopen(const char * pszFilename, const char * pszIgnored); 160 161 static int fread(void * pvBuffer, USHORT cbBlock, USHORT cBlock, HFILE hFile); … … 163 164 static void puts(char *psz); 164 165 166 /* C-library replacements. */ 165 167 static void kmemcpy(char *psz1, const char *psz2, int cch); 166 168 static char * kstrstr(const char *psz1, const char *psz2); 167 169 static int kstrcmp(const char *psz1, const char *psz2); 168 170 static int kstrncmp(const char *psz1, const char *psz2, int cch); 171 static int kstrnicmp(const char *psz1, const char *psz2, int cch); 169 172 static int kstrlen(const char *psz); 170 173 static int kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen); 171 174 175 /* Workers */ 172 176 static int VerifyPrologs(void); 173 177 static int ProbeSymFile(char *pszFilename); … … 177 181 static int GetKernelOTEs(void); 178 182 183 /* Ouput */ 179 184 static void ShowDecNumber(unsigned long ul); 180 185 static void ShowHexNumber(unsigned long ul); … … 338 343 339 344 340 341 345 /** 342 346 * kstrncmp - String 'n' compare. … … 360 364 361 365 366 #if 0 /* not in use */ 367 /** 368 * kstrnicmp - String 'n' compare, case-insensitive. 369 * @returns 0 - equal else !0 370 * @param p1 String 1 371 * @param p2 String 2 372 * @param len length 373 */ 374 static int kstrnicmp(const char *psz1, const char *psz2, int cch) 375 { 376 register char ch1, ch2; 377 378 do 379 { 380 ch1 = *psz1++; 381 if (ch1 >= 'A' && ch1 <= 'Z') 382 ch1 += 'a' - 'A'; /* to lower case */ 383 ch2 = *psz2++; 384 if (ch2 >= 'A' && ch2 <= 'Z') 385 ch2 += 'a' - 'A'; /* to lower case */ 386 } while (--cch > 0 && ch1 == ch2 && ch1 != '\0' && ch2 != '\0'); 387 388 return ch1 - ch2; 389 } 390 #endif 391 392 362 393 /** 363 394 * kstrlen - String length. … … 431 462 432 463 /******************************************************************************* 433 * Implementation Of The Important Function 464 * Implementation Of The Important Functions * 434 465 *******************************************************************************/ 435 466 … … 727 758 * @param filename Filename of the OS/2 kernel. 728 759 * @result ulBuild is set. 760 * @remark This step will be eliminated by searching thru the DOSGROUP datasegment 761 * in the kernel memory. This segment have a string "Internal revision 9.034[smp|uni]" 762 * This would be much faster than reading the kernel file. It will also give us a more precise 763 * answer to the question! This is currently a TODO issue. !FIXME! 729 764 */ 730 765 static int ReadOS2Krnl(char * pszFilename) … … 1117 1152 case 'S': /* Symbol file */ 1118 1153 i++; 1119 i += kargncpy(szUsrSym, &pReqPack->InitArgs[i], sizeof(szUsrSym)); 1154 if (pReqPack->InitArgs[i] == 'Y' || pReqPack->InitArgs[i] == 'y') 1155 i += kargncpy(szUsrSym, &pReqPack->InitArgs[i], sizeof(szUsrSym)); 1120 1156 break; 1121 1157 -
TabularUnified tags/trunk/src/win32k/dev32/d32init.c ¶
r13412 r13416 1 /* $Id: d32init.c,v 1.1 2 2000-02-20 04:27:23bird Exp $1 /* $Id: d32init.c,v 1.13 2000-02-21 04:45:46 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. … … 12 12 * Defined Constants * 13 13 *******************************************************************************/ 14 #define MAXSIZE_PROLOG 0x1 0/* Note that this must be synced with */14 #define MAXSIZE_PROLOG 0x18 /* Note that this must be synced with */ 15 15 /* the one used in calltab.asm. */ 16 16 #define static /* just to make all symbols visible in the kernel debugger. */ … … 32 32 #include "dev1632.h" 33 33 #include "dev32.h" 34 #include "dev32hlp.h" 34 35 #include "probkrnl.h" 35 36 #include "log.h" … … 38 39 #include "ldr.h" 39 40 #include "ldrCalls.h" 40 41 #include "macros.h" 42 43 /******************************************************************************* 44 * Global Variables * 45 *******************************************************************************/ 46 #ifdef DEBUG 47 static char * apszPE[] = {"FLAGS_PE_NOT", "FLAGS_PE_PE2LX", "FLAGS_PE_PE", "FLAGS_PE_MIXED", "!invalid!"}; 48 static char * apszInfoLevel[] = {"INFOLEVEL_QUIET", "INFOLEVEL_ERROR", "INFOLEVEL_WARNING", "INFOLEVEL_INFO", "INFOLEVEL_INFOALL", "!invalid!"}; 49 #endif 41 50 42 51 /******************************************************************************* 43 52 * Internal Functions * 44 53 *******************************************************************************/ 45 static ULONG readnum(const char *pszNum); 46 static signed char interpretFunctionProlog32(char *pach, BOOL fOverload); 47 static signed char interpretFunctionProlog16(char *pach, BOOL fOverload); 48 static int ImportTabInit(void); 54 static ULONG readnum(const char *pszNum); 55 _Inline int ModR_M_32bit(char bModRM); 56 static int interpretFunctionProlog32(char *pach, BOOL fOverload); 57 static int interpretFunctionProlog16(char *pach, BOOL fOverload); 58 static int ImportTabInit(void); 49 59 50 60 … … 59 69 /* extern(s) located in mytkExecPgm.asm */ 60 70 extern char mytkExecPgm; 61 71 extern char CODE32START; 72 extern char CODE32END; 73 extern char CONST32_ROEND; 74 extern char DATA16START; 75 extern char DATA16_CONSTEND; 62 76 63 77 … … 81 95 char *pszTmp; 82 96 ULONG ul; 97 APIRET rc; 98 LOCKHANDLE lhData16={0,0,0,0, 0,0,0,0, 0,0,0,0}; 99 LOCKHANDLE lhData = {0,0,0,0, 0,0,0,0, 0,0,0,0}; 100 LOCKHANDLE lhCode = {0,0,0,0, 0,0,0,0, 0,0,0,0}; 83 101 84 102 pulTKSSBase32 = (PULONG)_TKSSBase16; … … 258 276 259 277 /* log option summary - FIXME */ 260 kprintf(("Options - Summary\n")); 278 kprintf(("Options - Summary - Start\n")); 279 if (options.fQuiet) 280 kprintf(("\tQuiet init\n")); 281 else 282 kprintf(("\tVerbose init\n")); 283 284 if (options.fLogging) 285 kprintf(("\tlogging enabled\n")); 286 else 287 kprintf(("\tlogging disabled\n")); 288 kprintf(("\tCom port no.%d\n", options.usCom)); 289 261 290 kprintf(("\tKernel: ver%d.%d build %d type %s\n", 262 291 options.usVerMajor, … … 265 294 (options.fKernel & KF_SMP) ? "SMP" : "UNI" 266 295 )); 267 kprintf(("\tCom port no.%d\n", options.usCom)); 268 if (options.fQuiet) 269 kprintf(("\tQuiet init\n")); 270 else 271 kprintf(("\tVerbose init\n")); 272 if (options.fLogging) 273 kprintf(("\tlogging enabled\n")); 274 else 275 kprintf(("\tlogging disabled\n")); 296 kprintf(("\tfPE=%d (%s)\n", options.fPE, apszPE[MIN(options.fPE, 5)])); 297 kprintf(("\tulInfoLevel=%d (%s)\n", options.ulInfoLevel, apszInfoLevel[MIN(options.ulInfoLevel, 5)])); 298 kprintf(("\tfElf=%d\n", options.fElf)); 299 kprintf(("\tfScript=%d\n", options.fScript)); 300 kprintf(("\tfNoLoader=%d\n", options.fNoLoader)); 301 kprintf(("\tcbSwpHeapInit=0x%08x cbSwpHeapMax=0x%08x\n", 302 options.cbSwpHeapInit, options.cbSwpHeapMax)); 303 kprintf(("\tcbResHeapInit=0x%08x cbResHeapMax=0x%08x\n", 304 options.cbSwpHeapInit, options.cbSwpHeapMax)); 305 kprintf(("Options - Summary - End\n")); 276 306 /* end option summary */ 277 307 … … 294 324 if (ImportTabInit() != NO_ERROR) 295 325 return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 326 327 /* 328 * Lock the 32-bit objects/segments and 16-bit datasegment in memory 329 */ 330 /* 32-bit code segment */ 331 rc = D32Hlp_VMLock2(&CODE32START, 332 ((unsigned)&CODE32END & ~0xFFF) - (unsigned)&CODE32START, /* Round down so we don't overlap with the next request. */ 333 VMDHL_LONG, 334 SSToDS(&lhCode)); 335 if (rc != NO_ERROR) 336 kprintf(("code segment lock failed with with rc=%d\n", rc)); 337 338 /* 32-bit data segment */ 339 rc = D32Hlp_VMLock2(callTab, 340 &CONST32_ROEND - (char*)callTab, 341 VMDHL_LONG | VMDHL_WRITE, 342 SSToDS(&lhData)); 343 if (rc != NO_ERROR) 344 kprintf(("data segment lock failed with with rc=%d\n", rc)); 345 346 /* 16-bit data segment */ 347 rc = D32Hlp_VMLock2(&DATA16START, 348 &DATA16_CONSTEND - &DATA16START, 349 VMDHL_LONG | VMDHL_WRITE, 350 SSToDS(&lhData16)); 351 if (rc != NO_ERROR) 352 kprintf(("data segment lock failed with with rc=%d\n", rc)); 296 353 297 354 return STATUS_DONE; … … 395 452 396 453 454 455 /** 456 * Functions which cacluates the instructionsize given a ModR/M byte. 457 * @returns Number of bytes to add to cb and pach. 458 * @param bModRM ModR/M byte. 459 * @status completely implemented. 460 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 461 */ 462 _Inline int ModR_M_32bit(char bModRM) 463 { 464 if ((bModRM & 0xc0) == 0x80 /* ex. mov ax,[ebp+11145543h] */ 465 || ((bModRM & 0xc0) == 0 && (bModRM & 0x07) == 5)) /* ex. mov ebp,[0ff231234h] */ 466 { /* 32-bit displacement */ 467 return 5; 468 } 469 else if ((bModRM & 0xc0) == 0x40) /* ex. mov ecx,[esi]+4fh */ 470 { /* 8-bit displacement */ 471 return 2; 472 } 473 /* no displacement (only /r byte) */ 474 return 1; 475 } 476 477 478 479 480 397 481 /** 398 482 * 32-bit! Interpret function prolog to find where to jmp back. … … 404 488 * FALSE: Function is to be imported. 405 489 */ 406 static signed charinterpretFunctionProlog32(char *pach, BOOL fOverload)490 static int interpretFunctionProlog32(char *pach, BOOL fOverload) 407 491 { 408 int cb; 492 int cb = -3; 493 494 kprintf(("interpretFunctionProlog32(0x%08x, %d):\n" 495 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n" 496 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n", 497 pach, fOverload, 498 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7], 499 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15])); 409 500 410 501 /* … … 416 507 * push ebp 417 508 * mov ecx, dword ptr [xxxxxxxx] 509 * 510 * These are allowed when not overloading: 511 * mov eax, imm32 512 * jmp short 513 * or 514 * mov eax, imm32 515 * push ebp 418 516 */ 419 420 if (pach[0] == 0x55 && pach[1] == 0x8b) 517 if ((pach[0] == 0x55 && (pach[1] == 0x8b || pach[1] == 0xa1)) /* two first prologs */ 518 || 519 (pach[0] == 0xB8 && (pach[5] == 0xEB || pach[5] == 0x55) && !fOverload) /* two last prologs */ 520 ) 421 521 { 422 if (pach[2] == 0xec) 423 cb = 3; 424 else 425 cb = 1; 426 while (cb < 5) 427 { 428 /* 429 * This is not at all very stable or correct - but it works 430 * for the current functions. 431 * There will never be any doubt when something goes wrong! 432 */ 433 switch(pach[cb]) 522 BOOL fForce; 523 cb = 0; 524 while (cb < 5 || fForce) /* 5 is the size of a jump instruction. */ 525 { 526 int cb2; 527 fForce = FALSE; 528 switch (*pach) 434 529 { 435 case 0x33: /* xor (ldrClose, ldrOpen) */ 436 cb +=2; 437 break; 438 case 0x8b: 439 if (pach[cb+1] == 0x0d) 440 cb += 6; 530 /* simple one byte prefixes */ 531 case 0x2e: /* cs segment override */ 532 case 0x36: /* ss segment override */ 533 case 0x3e: /* ds segment override */ 534 case 0x26: /* es segment override */ 535 case 0x64: /* fs segment override */ 536 case 0x65: /* gs segment override */ 537 fForce = TRUE; 538 break; 539 540 /* simple one byte instructions */ 541 case 0x50: /* push ax */ 542 case 0x51: /* push cx */ 543 case 0x52: /* push dx */ 544 case 0x53: /* push bx */ 545 case 0x54: /* push sp */ 546 case 0x55: /* push bp */ 547 case 0x56: /* push si */ 548 case 0x57: /* push di */ 549 break; 550 551 /* simple two byte instructions */ 552 case 0xb0: /* mov al, imm8 */ 553 case 0xb1: /* mov cl, imm8 */ 554 case 0xb2: /* mov dl, imm8 */ 555 case 0xb3: /* mov bl, imm8 */ 556 case 0xb4: /* mov ah, imm8 */ 557 case 0xb5: /* mov ch, imm8 */ 558 case 0xb6: /* mov dh, imm8 */ 559 case 0xb7: /* mov bh, imm8 */ 560 case 0x2c: /* sub al, imm8 */ 561 case 0x34: /* xor al, imm8 */ 562 case 0x3c: /* cmp al, imm8 */ 563 case 0x6a: /* push <byte> */ 564 pach++; 565 cb++; 566 break; 567 568 /* simple five byte instructions */ 569 case 0xb8: /* mov eax, imm32 */ 570 case 0xb9: /* mov ecx, imm32 */ 571 case 0xba: /* mov edx, imm32 */ 572 case 0xbb: /* mov ebx, imm32 */ 573 case 0xbc: /* mov esx, imm32 */ 574 case 0xbd: /* mov ebx, imm32 */ 575 case 0xbe: /* mov esi, imm32 */ 576 case 0xbf: /* mov edi, imm32 */ 577 case 0x2d: /* sub eax, imm32 */ 578 case 0x35: /* xor eax, imm32 */ 579 case 0x3d: /* cmp eax, imm32 */ 580 case 0x68: /* push <dword> */ 581 pach += 4; 582 cb += 4; 583 break; 584 585 /* complex sized instructions - "/r" */ 586 case 0x30: /* xor r/m8, r8 */ 587 case 0x31: /* xor r/m32, r32 */ 588 case 0x32: /* xor r8, r/m8 */ 589 case 0x33: /* xor r32, r/m32 */ 590 case 0x38: /* cmp r/m8, r8 */ 591 case 0x39: /* cmp r/m32, r32 */ 592 case 0x3a: /* cmp r8, r/m8 */ 593 case 0x3b: /* cmp r32, r/m32 */ 594 case 0x28: /* sub r/m8, r8 */ 595 case 0x29: /* sub r/m32, r32 */ 596 case 0x2a: /* sub r8, r/m8 */ 597 case 0x2b: /* sub r32, r/m32 */ 598 case 0x8b: /* mov /r */ 599 case 0x8d: /* lea /r */ 600 if ((pach[1] & 0x7) == 4 && (pach[1] & 0xc0) != 0xc0) /* invalid instruction!?! */ 601 return -1; 602 cb += cb2 = ModR_M_32bit(pach[1]); 603 pach += cb2; 604 break; 605 606 /* complex sized instruction - "/5 ib" */ 607 case 0x80: /* 5: sub r/m8, imm8 7: cmp r/m8, imm8 */ 608 case 0x83: /* 5: sub r/m32, imm8 7: cmp r/m32, imm8 */ 609 if ((pach[1] & 0x38) == (5<<3) 610 || (pach[1] & 0x38) == (7<<3) 611 ) 612 { 613 cb += cb2 = 1 + ModR_M_32bit(pach[1]); /* 1 is the size of the imm8 */ 614 pach += cb2; 615 } 441 616 else 442 cb += 2; /*????!*/ 443 break; 444 case 0x8d: /* lea (ldrRead) */ 445 cb += 3; 446 break; 447 case 0x83: /* sub (LDRQAppType) */ 448 cb += 3; 449 break; 617 { 618 kprintf(("interpretFunctionProlog32: unknown instruction (-3) 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 619 return -3; 620 } 621 break; 622 623 /* complex sized instruction - "/digit id" */ 624 case 0x81: /* sub r/m32, imm32 + more instructions! */ 625 if ((pach[1] & 0x38) == (5<<3) /* sub r/m32, imm32 */ 626 || (pach[1] & 0x38) == (7<<3) /* cmp r/m32, imm32 */ 627 ) 628 { 629 cb += cb2 = 4 + ModR_M_32bit(pach[1]); /* 4 is the size of the imm32 */ 630 pach += cb2; 631 } 632 else 633 { 634 kprintf(("interpretFunctionProlog32: unknown instruction (-2) 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 635 return -2; 636 } 637 break; 638 450 639 default: 451 kprintf(("interpretFunctionProlog : unknown instruction 0x%x\n", pach[cb]));640 kprintf(("interpretFunctionProlog32: unknown instruction 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 452 641 return 0; 453 642 } 454 } 455 } 456 else if (pach[0] == 0x55 && pach[1] == 0xa1) /* ldrEnum32bitRelRecs on WS4eB */ 457 { 458 cb = 1 + 5; 643 pach++; 644 cb++; 645 } 459 646 } 460 647 else 461 648 { 462 /* special case for IOSftReadAt and IOSftWriteAt */ 463 if (fOverload == FALSE && pach[0] == 0xB8 && (pach[5] == 0xEB || pach[5] == 0x55)) 464 cb = 5; 465 else 466 cb = 0; 649 kprintf(("interpretFunctionProlog32: unknown prolog start. 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 650 cb = 0; 467 651 } 468 469 return (signed char)cb; 652 return cb; 470 653 } 471 654 … … 480 663 * FALSE: Function is to be imported. 481 664 */ 482 static signed charinterpretFunctionProlog16(char *pach, BOOL fOverload)665 static int interpretFunctionProlog16(char *pach, BOOL fOverload) 483 666 { 484 int cb; 485 667 int cb = -7; 668 669 kprintf(("interpretFunctionProlog16(0x%08x, %d):\n" 670 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n" 671 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n", 672 pach, fOverload, 673 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7], 674 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15])); 486 675 /* 487 676 * Check for the well known prolog (the only that is supported now) … … 493 682 BOOL fForce; 494 683 cb = 0; 495 while (cb < 8 || fForce) 684 while (cb < 8 || fForce) /* 8 is the size of a 66h prefixed far jump instruction. */ 496 685 { 497 686 fForce = FALSE; … … 528 717 529 718 case 0x8b: /* mov /r */ 530 if ((pach[1] & 0xc0) == 10 /* ex. mov ax,bp+1114h */531 || ((pach[1] & 0xc0) == 0 && (pach[1] & 0x c0) == 6)) /* ex. mov bp,0ff23h */719 if ((pach[1] & 0xc0) == 0x80 /* ex. mov ax,bp+1114h */ 720 || ((pach[1] & 0xc0) == 0 && (pach[1] & 0x7) == 6)) /* ex. mov bp,0ff23h */ 532 721 { /* 16-bit displacement */ 533 722 pach += 3; … … 548 737 549 738 default: 550 kprintf(("interpretFunctionProlog : unknown instruction 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2]));739 kprintf(("interpretFunctionProlog16: unknown instruction 0x%x 0x%x 0x%x\n", pach[0], pach[1], pach[2])); 551 740 return 0; 552 741 } … … 557 746 558 747 fOverload = fOverload; 559 return (signed char)cb;748 return cb; 560 749 } 750 561 751 562 752 … … 601 791 * Verify known function prolog. 602 792 */ 603 if ( _aImportTab[i].fType & EPT_32BIT)793 if (EPT32BitEntry(_aImportTab[i])) 604 794 { 605 795 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC32); 606 cbmin = 5; 796 cbmin = 5; /* Size of the jump instruction */ 607 797 } 608 798 else 609 799 { 610 800 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC16); 611 cbmin = 8;801 cbmin = 7; /* Size of the far jump instruction */ 612 802 } 613 803 … … 628 818 default: 629 819 kprintf(("VerifyImportTab32: only EPT_PROC is implemented\n",i)); 820 Int3(); /* temporary fix! */ 630 821 return STATUS_DONE | STERR | 4; 631 822 } … … 665 856 int i; 666 857 int cb; 667 858 int cbmin; 668 859 669 860 /* … … 676 867 continue; 677 868 678 if (_aImportTab[i].fType & EPT_32BIT) 869 if (EPT32BitEntry(_aImportTab[i])) 870 { 679 871 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC32); 872 cbmin = 5; /* Size of the jump instruction */ 873 } 680 874 else 875 { 681 876 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC16); 682 if (cb <= 0 || cb + 5 >= MAXSIZE_PROLOG) 683 { 684 kprintf(("ImportTabInit: verify failed for procedure no.%d, cb=%d\n", i, cb)); 877 cbmin = 7; /* Size of the far jump instruction */ 878 } 879 if (cb <= 0 || cb + cbmin >= MAXSIZE_PROLOG) 880 { 881 kprintf(("ImportTabInit: Verify failed for procedure no.%d, cb=%d\n", i, cb)); 685 882 return 1; 686 883 } … … 702 899 case EPT_PROC32: 703 900 { 704 cb = _aImportTab[i].cbProlog = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, TRUE); 705 if (cb > 0 && cb + 5 < MAXSIZE_PROLOG) 706 { 901 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, TRUE); 902 _aImportTab[i].cbProlog = (char)cb; 903 if (cb >= 5 && cb + 5 < MAXSIZE_PROLOG) /* 5(1st): size of jump instruction in the function prolog which jumps to my overloading function */ 904 { /* 5(2nd): size of jump instruction which jumps back to the original function after executing the prolog copied to the callTab entry for this function. */ 707 905 /* 708 906 * Copy function prolog which will be overwritten by the jmp to calltabl. … … 743 941 Int3(); 744 942 745 cb = _aImportTab[i].cbProlog = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, TRUE); 746 if (cb > 0 && cb + 8 < MAXSIZE_PROLOG) /* a 16:32 jump must be prefixed with 66h in a 16-bit segment */ 747 { 943 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, TRUE); 944 _aImportTab[i].cbProlog = (char)cb; 945 if (cb >= 8 && cb + 7 < MAXSIZE_PROLOG) /* 8: size of a 16:32 jump which jumps to my overloading function (prefixed with 66h in a 16-bit segment) */ 946 { /* 7: size of a 16:32 jump which is added to the call tab */ 748 947 /* 749 948 * Copy function prolog which is to be overwritten. … … 784 983 case EPT_PROCIMPORT32: 785 984 { 786 cb = _aImportTab[i].cbProlog = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, FALSE); 787 if (cb > 0 && cb + 5 < MAXSIZE_PROLOG) 985 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, FALSE); 986 _aImportTab[i].cbProlog = (char)cb; 987 if (cb > 0) /* Since no prolog part is copied to the function table, it's ok as long as the prolog has been recognzied. */ 788 988 { 789 989 /* … … 811 1011 case EPT_PROCIMPORT16: 812 1012 { 813 cb = _aImportTab[i].cbProlog = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, FALSE); 814 if (cb > 0 && cb + 8 < MAXSIZE_PROLOG) 1013 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, FALSE); 1014 _aImportTab[i].cbProlog = (char)cb; 1015 if (cb > 0) /* Since no prolog part is copied to the function table, it's ok as long as the prolog has been recognzied. */ 815 1016 { 816 1017 /* … … 842 1043 case EPT_VARIMPORT32: 843 1044 case EPT_VARIMPORT16: 1045 _aImportTab[i].cbProlog = (char)0; 844 1046 *(unsigned long*)(void*)&callTab[i][0] = _aImportTab[i].ulAddress; 845 1047 *(unsigned long*)(void*)&callTab[i][4] = _aImportTab[i].offObject; -
TabularUnified tags/trunk/src/win32k/dev32/devfirst.asm ¶
r13379 r13416 1 ; $Id: devfirst.asm,v 1. 3 2000-02-15 23:39:19bird Exp $1 ; $Id: devfirst.asm,v 1.4 2000-02-21 04:45:46 bird Exp $ 2 2 ; 3 3 ; DevFirst - entrypoint and segment definitions … … 239 239 CONST32_ROSTART label byte 240 240 CONST32_RO ends 241 242 _VFT segment 243 _VFTSTART LABEL BYTE 244 _VFT ends 245 246 EH_DATA segment 247 EH_DATASTART LABEL BYTE 248 EH_DATA ends 249 241 250 END 242 251 -
TabularUnified tags/trunk/src/win32k/dev32/devlast.asm ¶
r13412 r13416 1 ; $Id: devlast.asm,v 1. 3 2000-02-20 04:27:23bird Exp $1 ; $Id: devlast.asm,v 1.4 2000-02-21 04:45:46 bird Exp $ 2 2 ; 3 3 ; DevLast - the object file termintating the resident part of the objects. … … 105 105 106 106 CONST32_RO segment 107 CONST32_ROEND db ?107 CONST32_ROEND LABEL BYTE 108 108 CONST32_RO ends 109 110 _VFT segment 111 _VFTEND LABEL BYTE 112 _VFT ends 113 114 EH_DATA segment 115 EH_DATAEND LABEL BYTE 116 EH_DATA ends 117 109 118 END 110 119 -
TabularUnified tags/trunk/src/win32k/include/dev16.h ¶
r13412 r13416 1 /* $Id: dev16.h,v 1. 6 2000-02-20 04:27:23bird Exp $1 /* $Id: dev16.h,v 1.7 2000-02-21 04:45:46 bird Exp $ 2 2 * dev16 - 16-bit specific. Should not be used in 32-bit C/C++. 3 3 * … … 105 105 USHORT NEAR dev1Init(PRPINITIN pRpIn, PRPINITOUT pRpOut); 106 106 USHORT NEAR R0Init16(PRP_GENIOCTL pRp); 107 USHORT NEAR initGetDosTableData(void); 107 108 108 109 -
TabularUnified tags/trunk/src/win32k/include/dev32.h ¶
r13412 r13416 1 /* $Id: dev32.h,v 1. 6 2000-02-20 04:27:23bird Exp $1 /* $Id: dev32.h,v 1.7 2000-02-21 04:45:46 bird Exp $ 2 2 * 3 3 * dev32 - header file for 32-bit part of the driver. … … 82 82 * variable into an function call; like the addToModule calls. 83 83 * 84 * @returns 32-bit FLAT stack pointer. 84 * Warning - At init-time you have ot make sure that the pulTKSSBase32 pointer is set! 85 * 86 * @returns 32-bit FLAT pointer. 85 87 */ 86 88 #ifdef RING0 -
TabularUnified tags/trunk/src/win32k/include/devSegDf.inc ¶
r12264 r13416 1 ; $Id: devSegDf.inc,v 1. 3 1999-11-10 01:45:32bird Exp $1 ; $Id: devSegDf.inc,v 1.4 2000-02-21 04:45:46 bird Exp $ 2 2 ; 3 3 ; Segment definitions for win32k.sys. … … 20 20 DATA16_GROUP group DATA16, DATA16_CONST, DATA16_BSS 21 21 22 22 23 CODE16 segment word public 'CODE' use16 23 24 CODE16 ends 25 24 26 25 27 CODE32 segment dword public 'CODE' use32 26 28 CODE32 ends 27 29 30 EH_CODE segment dword public 'CODE' use32 31 EH_CODE ends 32 28 33 CALLTAB segment dword public 'DATA' use32 29 34 CALLTAB ends 30 35 31 DGROUP group BSS32, DATA32 36 37 ;DGROUP group BSS32, DATA32 38 DGROUP group BSS32, DATA32, CONST32_RO, _VFT, EH_DATA, CALLTAB 32 39 33 40 DATA32 segment dword public 'DATA' use32 … … 40 47 BSS32 ends 41 48 49 50 ;CONSTGROUP group CONST32_RO, _VFT, EH_DATA 51 42 52 CONST32_RO segment dword public 'CONST' use32 43 53 CONST32_RO ends 44 54 55 _VFT segment dword public 'CONST' use32 56 _VFT ends 57 58 EH_DATA segment byte public 'CONST' use32 59 EH_DATA ends 60 -
TabularUnified tags/trunk/src/win32k/include/options.h ¶
r13092 r13416 1 /* $Id: options.h,v 1. 6 2000-01-24 18:18:59bird Exp $1 /* $Id: options.h,v 1.7 2000-02-21 04:45:47 bird Exp $ 2 2 * 3 3 * Options. … … 44 44 o.usCom = OUTPUT_COM2; \ 45 45 o.fLogging = FALSE; \ 46 // o.fLogging = TRUE; \ 46 47 o.fKernel = KF_UNI; \ 47 48 o.ulBuild = ~0UL; \ -
TabularUnified tags/trunk/src/win32k/ldr/calltab.asm ¶
r13412 r13416 1 ; $Id: calltab.asm,v 1. 8 2000-02-20 04:27:24bird Exp $1 ; $Id: calltab.asm,v 1.9 2000-02-21 04:45:47 bird Exp $ 2 2 ; 3 3 ; callTab - Call back again table - table with entry for each function which is overrided. … … 42 42 ; Constants 43 43 ; 44 MAXSIZE_PROLOG EQU 1 0h44 MAXSIZE_PROLOG EQU 18h 45 45 46 46 -
TabularUnified tags/trunk/src/win32k/ldr/myldrOpen.cpp ¶
r13407 r13416 1 /* $Id: myldrOpen.cpp,v 1. 7 2000-02-19 08:40:30bird Exp $1 /* $Id: myldrOpen.cpp,v 1.8 2000-02-21 04:45:47 bird Exp $ 2 2 * 3 3 * myldrOpen - ldrOpen. … … 130 130 if (options.fPE == FLAGS_PE_NOT) 131 131 { 132 free(pszBuffer);132 rfree(pszBuffer); 133 133 return NO_ERROR; 134 134 } … … 208 208 rc = ldrOpen(phFile, "pe.exe", param3); /* path....! problems! */ 209 209 kprintf(("ldrOpen: pe.exe - open returned with rc = %d\n", rc)); 210 free(pszBuffer);210 rfree(pszBuffer); 211 211 return rc; 212 212 } 213 213 } 214 214 } 215 free(pszBuffer);215 rfree(pszBuffer); 216 216 return NO_ERROR; 217 217 } … … 231 231 * Do nothing more yet. NEED AN ELF LOADER!!! 232 232 */ 233 free(pszBuffer);233 rfree(pszBuffer); 234 234 return NO_ERROR; 235 235 } … … 273 273 { 274 274 char *pszStart = pach+2; 275 kprintf(("ldrOpen: scrtip debug 1\n")); 275 276 276 277 /* Make sure we don't read to much... */ … … 283 284 while (*pszStart != '\0' && (*pszStart == ' ' || *pszStart == '\t')) 284 285 pszStart++; 286 kprintf(("ldrOpen: scrtip debug 2\n")); 285 287 286 288 /* anything left on the line? */ … … 295 297 */ 296 298 pszEnd = pszStart; 299 kprintf(("ldrOpen: scrtip debug 3\n")); 297 300 //pszFirstArg = NULL; 298 301 while (*pszEnd != '\0' && *pszEnd != '\r' && *pszEnd != '\n') … … 314 317 } 315 318 *pszEnd = '\0'; 319 kprintf(("ldrOpen: scrtip debug 4\n")); 316 320 317 321 /* … … 319 323 */ 320 324 pBuffer = QueryBufferPointerFromFilename(pszFilename); 325 kprintf(("ldrOpen: scrtip debug 5\n")); 321 326 if (pBuffer != NULL) 322 327 { 323 328 unsigned cchArguments = getArgsLength(pBuffer->achArgs); 324 329 kprintf(("ldrOpen: debug1\n")); 330 331 kprintf(("ldrOpen: scrtip debug 6\n")); 325 332 326 333 /* … … 329 336 if (cchArguments + cchToAdd < sizeof(pBuffer->achArgs)) 330 337 { 331 kprintf(("ldrOpen: debug2\n"));338 kprintf(("ldrOpen: scrtip debug 7\n")); 332 339 /* 333 340 * Open the interpreter. … … 337 344 if (rc == NO_ERROR) 338 345 { 339 kprintf(("ldrOpen: debug3\n"));346 kprintf(("ldrOpen: scritp debug 8\n")); 340 347 /* Make space for the addition arguments. */ 341 348 memmove(&pBuffer->achArgs[cchToAdd], &pBuffer->achArgs[0], cchArguments); 342 349 memcpy(&pBuffer->achArgs[0], pszBuffer, cchToAdd); 343 kprintf(("ldrOpen: debug4\n"));350 kprintf(("ldrOpen: scrtip debug 9\n")); 344 351 } 345 352 else … … 375 382 rc = NO_ERROR; 376 383 } 377 free(pszBuffer);384 rfree(pszBuffer); 378 385 } 379 386 return rc; -
TabularUnified tags/trunk/src/win32k/win32k.def ¶
r13407 r13416 1 1 ;****************************************************************************** 2 ; Copyright 1998 knut st. osmundsen2 ; Copyright 1998-2000 knut st. osmundsen 3 3 ; Definition file for Win32k 4 4 ; Project Odin Software License can be found in LICENSE.TXT 5 5 ;****************************************************************************** 6 PHYSICAL DEVICE WIN32K7 DESCRIPTION "$@#knut st. osmundsen:v0.5.0alpha#@ Win32k - Odin32, Ring-0 part - Copyright (c) 1998-1999knut st. osmundsen"6 PHYSICAL DEVICE Grace 7 DESCRIPTION "$@#knut st. osmundsen:v0.5.0alpha#@Grace - Odin32 and OS2NIX Ring-0 part - Copyright (c) 1998-2000 knut st. osmundsen" 8 8 9 9 CODE PRELOAD EXECUTEREAD … … 17 17 CODE32 class 'CODE' 18 18 CALLTAB class 'DATA' 19 ; CALLTAB class 'CODE' WRITABLE20 19 DATA32 class 'DATA' 21 20 c_common class 'DATA' 22 21 BSS32 class 'BSS' 22 _VFT class 'CONST' 23 23 CONST32_RO class 'CONST' 24 24 25
Note:
See TracChangeset
for help on using the changeset viewer.