Changeset 9502 for trunk/src/win32k
- Timestamp:
- Dec 16, 2002, 1:46:47 AM (23 years ago)
- Location:
- trunk/src/win32k/kKrnlLib/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/kKrnlLib/src/MkCallTab.c
r9125 r9502 1 /* $Id: MkCallTab.c,v 1. 5 2002-08-24 22:27:16bird Exp $1 /* $Id: MkCallTab.c,v 1.6 2002-12-16 00:46:47 bird Exp $ 2 2 * 3 * Description:Generates the calltab.asm from aImportTab.3 * Generates the calltab.asm from aImportTab. 4 4 * 5 * Copyright (c) 2000-200 1 knut st. osmundsen (kosmunds@csc.com)5 * Copyright (c) 2000-2002 knut st. osmundsen <bird@anduin.net> 6 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 7 * 8 * This file is part of kKrnlLib. 9 * 10 * kKrnlLib is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * kKrnlLib is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with kKrnlLib; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 8 23 * 9 24 */ … … 15 30 #define NOLOGGING 1 16 31 17 #define fclose(a) DosClose(a)18 #define SEEK_SET FILE_BEGIN19 #define SEEK_END FILE_END20 21 32 22 33 /* … … 42 53 #include <os2.h> 43 54 44 #include <strat2.h> 45 #include <reqpkt.h> 46 47 #include "devSegDf.h" 48 #undef DATA16_INIT 49 #define DATA16_INIT 50 #undef CODE16_INIT 51 #define CODE16_INIT 55 //#include <strat2.h> 56 //#include <reqpkt.h> 57 58 #include "krnlImportTable.h" 52 59 #include "os2krnl.h" /* must be included before dev1632.h! */ 53 #include "probkrnl.h"54 60 #include "dev1632.h" 55 #include "d16vprintf.h" 56 #include "d16crt.h" 61 62 #include <string.h> 63 #include <stdio.h> 57 64 58 65 … … 61 68 *******************************************************************************/ 62 69 /* dummy replacement for SymDB.c */ 63 KRNLDBENTRY DATA16_INITaKrnlSymDB[] = {{0}};70 KRNLDBENTRY aKrnlSymDB[] = {{0}}; 64 71 65 72 struct Entry … … 74 81 { 2, "_ulKernelBuild", "ulKernelBuild", EXP_ABSOLUTE32}, 75 82 { 3, "_fKernel", "flKernel", EXP_ABSOLUTE32}, 76 { 4, "_ TKSSBase16","TKSSBase", EXP_ABSOLUTE32},77 { 5, "_ TKSSBase16","_TKSSBase", EXP_ABSOLUTE32},83 { 4, "_pulTKSSBase32", "TKSSBase", EXP_ABSOLUTE32}, 84 { 5, "_pulTKSSBase32", "_TKSSBase", EXP_ABSOLUTE32}, 78 85 { 6, "_R0FlatCS16", "R0FlatCS", EXP_ABSOLUTE16}, 79 86 { 7, "_R0FlatDS16", "R0FlatDS", EXP_ABSOLUTE16}, 80 87 81 88 /* 16-bit functions */ 89 #if 0 /* FIXME: not now */ 82 90 { 30, "_printf16", "_printf16", EXP_16}, 83 91 { 31, "_vprintf16", "_vprintf16", EXP_16}, … … 97 105 { 45, "_kstrcat", "_kstrcat", EXP_16}, 98 106 { 46, "_kstrtok", "_kstrtok", EXP_16}, 107 #endif 99 108 100 109 /* 16-bit crt functions */ … … 347 356 else if (argv[1][0] == 't') 348 357 return GenerateTstFakers(); 349 else 350 { 351 syntax(); 352 return -2; 353 } 354 355 return 0; 358 359 /* failure */ 360 syntax(); 361 return -2; 356 362 } 357 363 … … 362 368 void syntax(void) 363 369 { 364 printf 16("Incorrect parameter!\n"365 366 367 370 printf("Incorrect parameter!\n" 371 "Syntax: mkcalltab.exe <tab>\n" 372 " Where <tab> is either calltab or tstfakers.\n" 373 ); 368 374 } 369 375 … … 388 394 * Write Start of file. 389 395 */ 390 printf16("; $Id: MkCallTab.c,v 1.5 2002-08-24 22:27:16 bird Exp $\n" 391 ";\n" 392 "; Autogenerated calltab file.\n" 393 ";\n" 394 "; Generate: mkcalltab.exe > ldr\calltab.asm\n" 395 ";\n" 396 "; Copyright (c) 1998-2001 knut st. osmundsen (kosmunds@csc.com)\n" 397 ";\n" 398 "; Project Odin Software License can be found in LICENSE.TXT\n" 399 ";\n" 400 " .386p\n" 401 "\n" 402 "\n" 403 ";\n" 404 "; Include files\n" 405 ";\n" 406 " include devsegdf.inc\n" 407 " include options.inc\n" 408 "\n" 409 "\n" 410 ";\n" 411 "; Exported symbols\n" 412 ";\n" 413 " public callTab\n" 414 " public callTabEND\n" 415 " public callTab16\n" 416 " public callTab16END\n" 417 " public auNopFuncs\n" 418 "\n" 419 " extrn _aImportTab:BYTE\n" 420 " extrn _options:kKLOptions\n" 421 "\n" 422 "\n" 423 ";\n" 424 "; Constants\n" 425 ";\n" 426 "PROC32_PROLOG EQU 14h\n" 427 "PROC16_PROLOG EQU 14h\n" 428 "IMPORTH16_PROLOG EQU 08h\n" 429 "IMPORTHNR16_PROLOG EQU 07h\n" 430 "\n" 431 "\n" 432 ";\n" 433 "; Macros\n" 434 ";\n" 435 "\n" 436 "; Macro which makes a function overload calltable entry\n" 437 "FnProc32Entry macro fnname\n" 438 " public fnname\n" 439 " fnname proc near\n" 440 " db PROC32_PROLOG dup(0cch)\n" 441 " fnname endp\n" 442 "endm\n" 443 "\n" 444 "; Macro which makes a function overload calltable entry\n" 445 "FnProc16Entry macro fnname\n" 446 " public fnname\n" 447 " public &fnname&_off\n" 448 " public &fnname&_sel\n" 449 " fnname proc near\n" 450 " db PROC16_PROLOG dup(0cch)\n" 451 " fnname endp\n" 452 " &fnname&_off dw 0\n" 453 " &fnname&_sel dw 0\n" 454 "endm\n" 455 "\n"); 456 printf16("; Macro which makes a function calltable entry\n" 457 "FnProcNR32Entry macro fnname\n" 458 " f&fnname& dd 0\n" 459 " FnProc32Entry<fnname>\n" 460 "endm\n" 461 "\n" 462 "; Macro which makes a function calltable entry\n" 463 "FnProcNR16Entry macro fnname\n" 464 " f&fnname& dd 0\n" 465 " FnProc16Entry<fnname>\n" 466 "endm\n" 467 "\n" 468 "; Macro which makes a variable calltable entry.\n" 469 "VariableEntry macro varname\n" 470 " public p&varname&\n" 471 " p&varname& dd 0\n" 472 " public &varname&_offObject\n" 473 " &varname&_offObject dd 0\n" 474 " public _fp&varname&\n" 475 " _fp&varname& dd 0\n" 476 " public &varname&_sel\n" 477 " &varname&_sel dw 0\n" 478 " dw 0cch ;alignment\n" 479 "endm\n" 480 "\n" 481 "\n" 482 "\n" 483 "DATA32 segment\n" 484 " ;assume cs:DATA32, ds:flat, ss:nothing\n" 485 " assume ds:flat, ss:nothing\n" 486 ";\n" 487 "; callTab is an array of function prologs with a jump to the real function\n" 488 "; and pointers to real variables.\n" 489 ";\n" 490 "; Overrided OS/2 kernel functions are called thru this table.\n" 491 ";\n" 492 "db 'callTab',0\n" 493 "callTab:\n"); 396 printf("; $Id: MkCallTab.c,v 1.6 2002-12-16 00:46:47 bird Exp $\n" 397 ";\n" 398 "; Autogenerated calltab file.\n" 399 ";\n" 400 "; Copyright (c) 1998-2003 knut st. osmundsen <bird@anduin.net>\n" 401 ";\n" 402 ";\n" 403 "; This file is part of kKrnlLib.\n" 404 ";\n" 405 "; kKrnlLib is free software; you can redistribute it and/or modify\n" 406 "; it under the terms of the GNU General Public License as published by\n" 407 "; the Free Software Foundation; either version 2 of the License, or\n" 408 "; (at your option) any later version.\n" 409 ";\n" 410 "; kKrnlLib is distributed in the hope that it will be useful,\n" 411 "; but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 412 "; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" 413 "; GNU General Public License for more details.\n" 414 ";\n" 415 "; You should have received a copy of the GNU General Public License\n" 416 "; along with kKrnlLib; if not, write to the Free Software\n" 417 "; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" 418 ";\n" 419 " .386p\n" 420 "\n" 421 "\n" 422 ";\n" 423 "; Include files\n" 424 ";\n" 425 " include devsegdf.inc\n" 426 " include options.inc\n" 427 "\n" 428 "\n" 429 ";\n" 430 "; Exported symbols\n" 431 ";\n" 432 " public callTab\n" 433 " public callTabEND\n" 434 " public callTab16\n" 435 " public callTab16END\n" 436 " public auNopFuncs\n" 437 "\n" 438 " extrn _aImportTab:BYTE\n" 439 " extrn _options:kKLOptions\n" 440 "\n" 441 "\n" 442 ";\n" 443 "; Constants\n" 444 ";\n" 445 "PROC32_PROLOG EQU 14h\n" 446 "PROC16_PROLOG EQU 14h\n" 447 "IMPORTH16_PROLOG EQU 08h\n" 448 "IMPORTHNR16_PROLOG EQU 07h\n" 449 "\n" 450 "\n" 451 ";\n" 452 "; Macros\n" 453 ";\n" 454 "\n" 455 "; Macro which makes a function overload calltable entry\n" 456 "FnProc32Entry macro fnname\n" 457 " public fnname\n" 458 " fnname proc near\n" 459 " db PROC32_PROLOG dup(0cch)\n" 460 " fnname endp\n" 461 "endm\n" 462 "\n" 463 "; Macro which makes a function overload calltable entry\n" 464 "FnProc16Entry macro fnname\n" 465 " public fnname\n" 466 " public &fnname&_off\n" 467 " public &fnname&_sel\n" 468 " fnname proc near\n" 469 " db PROC16_PROLOG dup(0cch)\n" 470 " fnname endp\n" 471 " &fnname&_off dw 0\n" 472 " &fnname&_sel dw 0\n" 473 "endm\n" 474 "\n"); 475 printf("; Macro which makes a function calltable entry\n" 476 "FnProcNR32Entry macro fnname\n" 477 " f&fnname& dd 0\n" 478 " FnProc32Entry<fnname>\n" 479 "endm\n" 480 "\n" 481 "; Macro which makes a function calltable entry\n" 482 "FnProcNR16Entry macro fnname\n" 483 " f&fnname& dd 0\n" 484 " FnProc16Entry<fnname>\n" 485 "endm\n" 486 "\n" 487 "; Macro which makes a variable calltable entry.\n" 488 "VariableEntry macro varname\n" 489 " public p&varname&\n" 490 " p&varname& dd 0\n" 491 " public &varname&_offObject\n" 492 " &varname&_offObject dd 0\n" 493 " public _fp&varname&\n" 494 " _fp&varname& dd 0\n" 495 " public &varname&_sel\n" 496 " &varname&_sel dw 0\n" 497 " dw 0cch ;alignment\n" 498 "endm\n" 499 "\n" 500 "\n" 501 "\n" 502 "DATA32 segment\n" 503 " ;assume cs:DATA32, ds:flat, ss:nothing\n" 504 " assume ds:flat, ss:nothing\n" 505 ";\n" 506 "; callTab is an array of function prologs with a jump to the real function\n" 507 "; and pointers to real variables.\n" 508 ";\n" 509 "; Overrided OS/2 kernel functions are called thru this table.\n" 510 ";\n" 511 "db 'callTab',0\n" 512 "callTab:\n"); 494 513 495 514 /* … … 511 530 * Variable or Function? 512 531 */ 513 printf 16("%s<%s%s>%*.s;%d\n",514 515 516 517 45 - 2 - kstrlen(pszMacro) - aImportTab[i].cchName - kstrlen(pszExtra),518 519 532 printf("%s<%s%s>%*.s;%d\n", 533 pszMacro, 534 pszName, 535 pszExtra, 536 45 - 2 - strlen(pszMacro) - aImportTab[i].cchName - strlen(pszExtra), 537 "", 538 i); 520 539 if ((aImportTab[i].fType & EPT_WRAPPED)) 521 540 { 522 printf 16("extrn %s%s:NEAR\n",523 524 541 printf("extrn %s%s:NEAR\n", 542 pszName, 543 aImportTab[i].achExtra); 525 544 } 526 545 } … … 530 549 * Write End of Calltab and start of callTab16. 531 550 */ 532 printf16("\n" 533 "callTabEND db 'callTabEND',0,0\n" 534 "DATA32 ENDS\n" 535 "\n" 536 "\n" 537 "CALLTAB16 segment para public 'CALLTAB16_DATA' use16\n" 538 " assume ds:nothing, ss:nothing\n" 539 ";\n" 540 "; callTab16 is an array of function prologs with a jump to the real function\n" 541 "; for 16-bit overrides.\n" 542 ";\n" 543 "; Overrided 16-bit OS/2 kernel functions are called thru this table.\n" 544 ";\n" 545 "callTab16:\n" 546 547 ); 551 printf("\n" 552 "callTabEND db 'callTabEND',0,0\n" 553 "DATA32 ENDS\n" 554 "\n" 555 "\n" 556 "CALLTAB16 segment para public 'CALLTAB16_DATA' use16\n" 557 " assume ds:nothing, ss:nothing\n" 558 ";\n" 559 "; callTab16 is an array of function prologs with a jump to the real function\n" 560 "; for 16-bit overrides.\n" 561 ";\n" 562 "; Overrided 16-bit OS/2 kernel functions are called thru this table.\n" 563 ";\n" 564 "callTab16:\n" 565 ); 548 566 549 567 /* … … 554 572 if (EPT16Proc(aImportTab[i]) || EPT16ProcH(aImportTab[i])) 555 573 { 556 printf 16("FnProc16Entry<%s>%*.s;%d\n",557 558 559 560 574 printf("FnProc16Entry<%s>%*.s;%d\n", 575 aImportTab[i].achName, 576 45 - 2 - 17 - aImportTab[i].cchName, 577 "", 578 i); 561 579 } 562 580 } … … 566 584 * Write End of Calltab and start of auFuncs. 567 585 */ 568 printf 16("\n"569 570 571 572 573 574 575 576 577 578 579 580 581 586 printf("\n" 587 "callTab16END db 'callTab16END',0,0,0,0\n" 588 "CALLTAB16 ENDS\n" 589 "\n" 590 "\n" 591 "DATA32 segment\n" 592 " assume ds:nothing, es:nothing\n" 593 "\n" 594 ";\n" 595 "; Function table for nop functions.\n" 596 "; Used by krnlInitImports() in krnlInit.c.\n" 597 ";\n" 598 "auNopFuncs:\n" 599 ); 582 600 583 601 /* … … 592 610 char * pszName = (*pszPrefix != '\0' ? &aImportTab[i].achName[1] : &aImportTab[i].achName[0]); 593 611 594 printf 16(EPT16BitEntry(aImportTab[i])595 596 597 598 599 600 601 602 603 604 605 606 612 printf(EPT16BitEntry(aImportTab[i]) 613 ? " extrn %snop%s%s : NEAR\n" 614 " dw seg CODE%s:%snop%s%s\n" 615 " dw offset CODE%s:%snop%s%s\n" 616 : " extrn %snop%s%s : NEAR\n" 617 " dd offset FLAT:CODE%s:%snop%s%s\n", 618 pszPrefix, 619 pszName, 620 aImportTab[i].achExtra, 621 pszSeg, 622 pszPrefix, 623 pszName, 624 aImportTab[i].achExtra); 607 625 } 608 626 else 609 printf 16(" dd 0h\n");627 printf(" dd 0h\n"); 610 628 } 611 629 … … 614 632 * MTE. 615 633 */ 616 printf 16("\n"617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 634 printf("\n" 635 "\n" 636 ";\n" 637 "; kKrnlLib MTE\n" 638 ";\n" 639 "public kKrnlLibMTE\n" 640 "kKrnlLibMTE label byte\n" 641 "dw 2 ; mte_flags2; (MTEFORMATLX)\n" 642 "dw 0 ; mte_handle;\n" 643 "dd offset FLAT:KKL_SwapMTE ; mte_swapmte;\n" 644 "dd 0 ; mte_link;\n" 645 "dd 0001b180h ; mte_flags1; (LIBRARYMOD | LDRINVALID | CLASS_GLOBAL | MTE_MEDIAFIXED | MTEPROCESSED | VDDMOD)\n" 646 "dd 0 ; mte_impmodcnt;\n" 647 "dw 0 ; mte_sfn;\n" 648 "dw 1 ; mte_usecnt;\n" 649 "db \"KKRNLLIB\" ; mte_modname[8];\n" 650 "dd 0 ; evt. new fields\n" 651 "dd 0 ; evt. new fields\n" 652 "\n" 653 "\n"); 636 654 637 655 /* 638 656 * SMTE. 639 657 */ 640 printf 16(";\n"641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 printf 16("dd 0 ; ULONG smte_impproc; /* 48 Offset of Imp Procedure Name Tab - POINTER */\n"664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 658 printf(";\n" 659 "; kKrnlLIB SwapMTE\n" 660 ";\n" 661 "public KKL_SwapMTE\n" 662 "KKL_SwapMTE label byte\n" 663 "dd 0 ; ULONG smte_mpages; /* 00 Module # pages */\n" 664 "dd 0 ; ULONG smte_startobj; /* 04 Object # for instruction */\n" 665 "dd 0 ; ULONG smte_eip; /* 08 Extended instruction pointer */\n" 666 "dd 0 ; ULONG smte_stackobj; /* 0c Object # for stack pointer */\n" 667 "dd 0 ; ULONG smte_esp; /* 10 Extended stack pointer */\n" 668 "dd 0 ; ULONG smte_pageshift; /* 14 Page alignment shift in .EXE */\n" 669 "dd 0 ; ULONG smte_fixupsize; /* 18 Fixup section size */\n" 670 "dd offset FLAT:KKL_ObjTab ; POTE smte_objtab; /* 1c Object table offset - POINTER */\n" 671 "dd 5 ; ULONG smte_objcnt; /* 20 Number of objects in module */\n" 672 "dd 0 ; ULONG smte_objmap; /* 24 Object page map offset - POINTER */\n" 673 "dd 0 ; ULONG smte_itermap; /* 28 Object iterated data map offset */\n" 674 "dd 0 ; ULONG smte_rsrctab; /* 2c Offset of Resource Table */\n" 675 "dd 0 ; ULONG smte_rsrccnt; /* 30 Number of resource entries */\n" 676 "dd offset FLAT:KKL_ResNameTab ; ULONG smte_restab; /* 34 Offset of resident name table - POINTER */\n" 677 "dd offset FLAT:KKL_EntryTab ; ULONG smte_enttab; /* 38 Offset of Entry Table - POINTER */\n" 678 "dd 0 ; ULONG smte_fpagetab; /* 3c Offset of Fixup Page Table - POINTER */\n" 679 "dd 0 ; ULONG smte_frectab; /* 40 Offset of Fixup Record Table - POINTER */\n" 680 "dd 0 ; ULONG smte_impmod; /* 44 Offset of Import Module Name Table - POINTER */\n"); 681 printf("dd 0 ; ULONG smte_impproc; /* 48 Offset of Imp Procedure Name Tab - POINTER */\n" 682 "dd 0 ; ULONG smte_datapage; /* 4c Offset of Enumerated Data Pages */\n" 683 "dd 0 ; ULONG smte_nrestab; /* 50 Offset of Non-resident Names Table */\n" 684 "dd 0 ; ULONG smte_cbnrestab; /* 54 Size of Non-resident Name Table */\n" 685 "dd 0 ; ULONG smte_autods; /* 58 Object # for automatic data object */\n" 686 "dd 0 ; ULONG smte_debuginfo; /* 5c Offset of the debugging info */\n" 687 "dd 0 ; ULONG smte_debuglen; /* 60 The len of the debug info in */\n" 688 "dd 0 ; ULONG smte_heapsize; /* 64 use for converted 16-bit modules */\n" 689 "dd offset FLAT:KKL_szFn ; PCHAR smte_path; /* 68 full pathname - POINTER */\n" 690 "dd 0 ; USHORT smte_semcount; /* 6c Count of threads waiting on MTE semaphore. 0 => semaphore is free */\n" 691 "dd 0 ; USHORT smte_semowner; /* 6e Slot number of the owner of MTE semahore */\n" 692 "dd 0 ; ULONG smte_pfilecache; /* 70 Pointer to file cache for Dos32CacheModule */\n" 693 "dd 0 ; ULONG smte_stacksize; /* 74 Thread 1 Stack size from the exe header */\n" 694 "dd 0 ; USHORT smte_alignshift; /* 78 use for converted 16-bit modules */\n" 695 "dd 0 ; USHORT smte_NEexpver; /* 7a expver from NE header */\n" 696 "dd 12 ; USHORT smte_pathlen; /* 7c length of full pathname */\n" 697 "dd 0 ; USHORT smte_NEexetype; /* 7e exetype from NE header */\n" 698 "dd 0 ; USHORT smte_csegpack; /* 80 count of segs to pack */\n" 699 "\n"); 682 700 683 701 /* 684 702 * Filename. 685 703 */ 686 printf 16("\n"687 688 689 690 691 704 printf("\n" 705 ";\n" 706 "; Filename\n" 707 ";\n" 708 "KKL_szFn db \"kKrnlLib.dll\",0\n" 709 "\n"); 692 710 693 711 /* 694 712 * Object table. 695 713 */ 696 printf 16("\n"697 698 699 700 701 702 703 704 705 706 707 708 709 710 printf 16("\n"711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 printf 16(";obj 3\n"733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 /* 764 * Res ident name table.765 */ 766 printf 16("\n"767 768 769 770 771 772 773 714 printf("\n" 715 ";\n" 716 "; Externals\n" 717 ";\n" 718 "extrn DATA16START:BYTE\n" 719 "extrn DATA16_GLOBALEND:BYTE\n" 720 "extrn CODE16START:BYTE\n" 721 "extrn CODE16END:BYTE\n" 722 "extrn CODE32START:BYTE\n" 723 "extrn CODE32END:BYTE\n" 724 "extrn DATA32START:BYTE\n" 725 "extrn _end:BYTE\n" 726 ); 727 728 printf("\n" 729 ";\n" 730 "; Object table\n" 731 ";\n" 732 "public KKL_ObjTab\n" 733 "KKL_ObjTab label byte\n" 734 ";obj 1\n" 735 " dd offset FLAT:DATA16:DATA16_GLOBALEND;o32_size; /* Object virtual size */\n" 736 " dd offset FLAT:DATA16:DATA16START ; o32_base; /* Object base virtual address */\n" 737 " dd 1003h ; o32_flags; /* Attribute flags */ \n" 738 " dd 0 ; o32_pagemap; /* Object page map index */ \n" 739 " dd 0 ; o32_mapsize; /* Number of entries in object page map */\n" 740 " dw seg DATA16 ; ote_sel; /* Object Selector */\n" 741 " dw 0 ; ote_hob; /* Object Handle */\n" 742 ";obj 2\n" 743 " dd offset FLAT:CODE16:CODE16END ; o32_size; /* Object virtual size */\n" 744 " dd offset FLAT:CODE16:CODE16START ; o32_base; /* Object base virtual address */\n" 745 " dd 1005h ; o32_flags; /* Attribute flags */ \n" 746 " dd 0 ; o32_pagemap; /* Object page map index */ \n" 747 " dd 0 ; o32_mapsize; /* Number of entries in object page map */\n" 748 " dw seg CODE16 ; ote_sel; /* Object Selector */\n" 749 " dw 0 ; ote_hob; /* Object Handle */\n"); 750 printf(";obj 3\n" 751 " dd offset FLAT:CODE32:CODE32END ; o32_size; /* Object virtual size */\n" 752 " dd offset FLAT:CODE32:CODE32START ; o32_base; /* Object base virtual address */\n" 753 " dd 2005h ; o32_flags; /* Attribute flags */ \n" 754 " dd 0 ; o32_pagemap; /* Object page map index */ \n" 755 " dd 0 ; o32_mapsize; /* Number of entries in object page map */\n" 756 " dw seg FLAT:CODE32 ; ote_sel; /* Object Selector */\n" 757 " dw 0 ; ote_hob; /* Object Handle */\n" 758 ";obj 4\n" 759 " dd offset FLAT:DATA32:_end ; o32_size; /* Object virtual size */\n" 760 " dd offset FLAT:DATA32:DATA32START ; o32_base; /* Object base virtual address */\n" 761 " dd 2003h ; o32_flags; /* Attribute flags */ \n" 762 " dd 0 ; o32_pagemap; /* Object page map index */ \n" 763 " dd 0 ; o32_mapsize; /* Number of entries in object page map */\n" 764 " dw seg FLAT:DATA32 ; ote_sel; /* Object Selector */\n" 765 " dw 0 ; ote_hob; /* Object Handle */\n" 766 ";obj 5\n" 767 " dd offset FLAT:CALLTAB16:callTab16END; o32_size; /* Object virtual size */\n" 768 " dd offset FLAT:CALLTAB16:callTab16 ; o32_base; /* Object base virtual address */\n" 769 " dd 1005h ; o32_flags; /* Attribute flags */ \n" 770 " dd 0 ; o32_pagemap; /* Object page map index */ \n" 771 " dd 0 ; o32_mapsize; /* Number of entries in object page map */\n" 772 " dw seg FLAT:CALLTAB16 ; ote_sel; /* Object Selector */\n" 773 " dw 0 ; ote_hob; /* Object Handle */\n" 774 "\n" 775 "public KKL_ObjTab_DosCalls\n" 776 "KKL_ObjTab_DosCalls label byte\n" 777 "db (20 * (4 * 6)) dup(0) ; 4*6 = sizeof(o32_obj); 20 = max objects;\n" 778 "\n" 779 "\n"); 780 781 /* 782 * Resent name table. 783 */ 784 printf("\n" 785 ";\n" 786 "; Resident name table\n" 787 ";\n" 788 "public KKL_ResNameTab\n" 789 "KKL_ResNameTab label byte\n" 790 "db 8,\"KKRNLLIB\"\n" 791 "dw 0 ; ordinal #\n"); 774 792 #ifdef DEBUG 775 793 iOrdMax = findMaxOrdinal(); … … 778 796 iOrd = findNextOrdinal(iOrd, &szName[0], &szNameExp[0], NULL, NULL)) 779 797 { 780 printf16( 781 "db %d, '%s'\n" 782 "dw %d\n", 783 kstrlen(szNameExp), szNameExp, iOrd); 798 printf("db %d, '%s'\n" 799 "dw %d\n", 800 strlen(szNameExp), szNameExp, iOrd); 784 801 } 785 802 #endif 786 printf 16("db 0 ; terminator\n"787 788 789 790 791 792 803 printf("db 0 ; terminator\n" 804 "public KKL_ResNameTabEND\n" 805 "KKL_ResNameTabEND label byte\n" 806 "\n" 807 "DATA32 ends\n" 808 "\n" 809 "\n"); 793 810 794 811 /* 795 812 * Entry table. 796 813 */ 797 printf 16("KKLENTRY segment\n"798 799 800 801 802 803 804 805 806 814 printf("KKLENTRY segment\n" 815 "public KKL_EntryTab\n" 816 "KKL_EntryTab label byte\n" 817 "KKLENTRY ends\n" 818 "\n" 819 "KKLENTRYFIXUPS segment\n" 820 "public KKL_EntryTabFixups\n" 821 "KKL_EntryTabFixups label byte\n" 822 "KKLENTRYFIXUPS ends\n" 823 "\n"); 807 824 iOrdMax = findMaxOrdinal(); 808 825 for (iOrd = findNextOrdinal(0, &szName[0], &szNameExp[0], &fType, &iIndex), iPrevBundle = 0; … … 883 900 { 884 901 int cSkips = iOrd - iPrevBundle >= 255 ? 255 : iOrd - iPrevBundle - 1; 885 printf 16("\n"886 887 888 889 890 891 892 902 printf("\n" 903 "KKLENTRY segment\n" 904 "db %d ; skips ordinals %d to %d\n" 905 "db 0\n" 906 "KKLENTRY ends\n", 907 cSkips, 908 iPrevBundle + 1, 909 iPrevBundle + cSkips); 893 910 iPrevBundle += cSkips; 894 911 } … … 899 916 if (fType < EXP_IMPORT_FIRST) 900 917 { 901 printf 16("\n"902 903 918 printf("\n" 919 "%s segment\n", 920 aszSeg2[fType]); 904 921 for (i = iOrd; i < iBundle + iOrd; i++) 905 922 { … … 912 929 case EXP_ABSOLUTE32: 913 930 case EXP_32: 914 if (! kstrchr(szName, '.'))915 printf 16(" extrn %s:NEAR\n",916 931 if (!strchr(szName, '.')) 932 printf(" extrn %s:NEAR\n", 933 szName); 917 934 break; 918 935 case EXP_ABSOLUTE16: 919 936 case EXP_16: 920 if (! kstrchr(szName, '.'))921 printf 16(" extrn %s:FAR\n",922 937 if (!strchr(szName, '.')) 938 printf(" extrn %s:FAR\n", 939 szName); 923 940 break; 924 941 } 925 942 } 926 printf 16("\n"927 928 943 printf("\n" 944 "%s ENDS\n", 945 aszSeg2[fType]); 929 946 } 930 947 … … 933 950 * Write bundle header. 934 951 */ 935 printf 16("\n"936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 952 printf("\n" 953 "KKLENTRY segment\n" 954 "bundle%d label byte\n" 955 "db %d ; ordinal %d to %d\n" 956 "db %d ; %s\n" 957 "dw seg %s ; object\n", 958 iOrd, 959 iBundle, 960 iOrd, 961 iOrd + iBundle - 1, 962 fType == EXP_ABSOLUTE16 || fType == EXP_16 || fType == EXP_VAR16 || fType == EXP_PROC16 || fType == EXP_ORGPROC16 963 ? 1 964 : 3, 965 aszType[fType], 966 aszSeg[fType] 967 ); 951 968 for (i = iOrd; i < iBundle + iOrd; i++) 952 969 { … … 955 972 956 973 findNextOrdinal(i - 1, szName, szNameExp, &fType, &iIndex); 957 printf 16(" db 1\n");974 printf(" db 1\n"); 958 975 switch (fType) 959 976 { … … 961 978 case EXP_32: 962 979 case EXP_ORGPROC32: 963 printf16( 964 " dd offset FLAT:%s\n", 965 szName); 980 printf(" dd offset FLAT:%s\n", 981 szName); 966 982 break; 967 983 case EXP_ABSOLUTE16: 968 984 case EXP_16: 969 985 case EXP_ORGPROC16: 970 printf16( 971 " dw offset %s\n", 972 szName, 973 szName); 986 printf(" dw offset %s\n", 987 szName, 988 szName); 974 989 break; 975 990 976 991 case EXP_PROC16: 977 992 case EXP_VAR16: 978 printf16( 979 " dw %d ; %s\n", 980 iIndex, 981 szName); 993 printf(" dw %d ; %s\n", 994 iIndex, 995 szName); 982 996 break; 983 997 case EXP_PROC32: 984 998 case EXP_VAR32: 985 printf16( 986 " dd %d ; %s\n", 987 iIndex, 988 szName); 999 printf(" dd %d ; %s\n", 1000 iIndex, 1001 szName); 989 1002 break; 990 1003 } … … 994 1007 * Write bundle fixups. 995 1008 */ 996 printf 16("KKLENTRY ends\n"997 998 999 1000 1001 1002 1009 printf("KKLENTRY ends\n" 1010 "KKLENTRYFIXUPS segment\n" 1011 "db %d ; type\n" 1012 "dw offset FLAT:bundle%d - offset FLAT:KKL_EntryTab ; bundle offset\n" 1013 "KKLENTRYFIXUPS ends\n", 1014 fType, 1015 iOrd); 1003 1016 1004 1017 iPrevBundle += iBundle; … … 1008 1021 * Write stop bundles. 1009 1022 */ 1010 printf 16("KKLENTRY segment\n"1011 1012 1013 1014 1015 1016 1017 1018 1023 printf("KKLENTRY segment\n" 1024 "db 0 ; end bundle\n" 1025 "dw 0 ; end bundle\n" 1026 "public KKL_EntryTabEND\n" 1027 "KKL_EntryTabEND db 0ffh\n" 1028 "KKLENTRY ends\n" 1029 "KKLENTRYFIXUPS segment\n" 1030 "db 0 ; end type\n" 1031 "KKLENTRYFIXUPS ends\n"); 1019 1032 1020 1033 /* 1021 1034 * End of file 1022 1035 */ 1023 printf 16("\n"1024 1025 1036 printf("\n" 1037 "end\n" 1038 "\n"); 1026 1039 1027 1040 return 0; … … 1090 1103 { 1091 1104 iOrdRet = aEntries[i].iOrdinal; 1092 kstrcpy(pszName, aEntries[i].szName);1093 kstrcpy(pszNameExp, aEntries[i].szNameExp);1105 strcpy(pszName, aEntries[i].szName); 1106 strcpy(pszNameExp, aEntries[i].szNameExp); 1094 1107 *pfType = aEntries[i].fFlags; 1095 1108 *piIndex = i; … … 1097 1110 else if (aEntries[i].iOrdinal == iOrdRet) 1098 1111 { 1099 printf 16("Fatal Error: Duplicate ordinal detected (ord=%d)\n", iOrdRet);1112 printf("Fatal Error: Duplicate ordinal detected (ord=%d)\n", iOrdRet); 1100 1113 DosExit(EXIT_PROCESS, iOrdRet); 1101 1114 } … … 1108 1121 { 1109 1122 iOrdRet = aImportTab[i].iOrdinal; 1110 kstrcpy(pszName, aImportTab[i].achName);1111 kstrcat(pszName, /*EPTWrapped(aImportTab[i]) ? "_wrapped" :*/ aImportTab[i].achExtra);1112 kstrcpy(pszNameExp, aImportTab[i].achName);1113 kstrcat(pszNameExp, aImportTab[i].achExtra);1123 strcpy(pszName, aImportTab[i].achName); 1124 strcat(pszName, /*EPTWrapped(aImportTab[i]) ? "_wrapped" :*/ aImportTab[i].achExtra); 1125 strcpy(pszNameExp, aImportTab[i].achName); 1126 strcat(pszNameExp, aImportTab[i].achExtra); 1114 1127 if (EPTVar(aImportTab[i])) 1115 1128 *pfType = EPT16BitEntry(aImportTab[i]) ? EXP_VAR16 : EXP_VAR32; … … 1136 1149 { 1137 1150 iOrdRet = aImportTab[i].iOrdinal + ORD_ORGDISPLACEMENT; 1138 kstrcpy(pszName, aImportTab[i].achName);1139 kstrcat(pszName, /*EPTWrapped(aImportTab[i]) ? "_wrapped" :*/ aImportTab[i].achExtra);1151 strcpy(pszName, aImportTab[i].achName); 1152 strcat(pszName, /*EPTWrapped(aImportTab[i]) ? "_wrapped" :*/ aImportTab[i].achExtra); 1140 1153 1141 1154 if (aImportTab[i].achName[0] == '_') 1142 1155 { 1143 kstrcpy(pszNameExp, "_Org");1144 kstrcpy(pszNameExp + 4, &aImportTab[i].achName[1]);1156 strcpy(pszNameExp, "_Org"); 1157 strcpy(pszNameExp + 4, &aImportTab[i].achName[1]); 1145 1158 } 1146 1159 else 1147 1160 { 1148 kstrcpy(pszNameExp, "Org");1149 kstrcpy(pszNameExp + 3, &aImportTab[i].achName[0]);1161 strcpy(pszNameExp, "Org"); 1162 strcpy(pszNameExp + 3, &aImportTab[i].achName[0]); 1150 1163 } 1151 kstrcat(pszNameExp, aImportTab[i].achExtra);1164 strcat(pszNameExp, aImportTab[i].achExtra); 1152 1165 1153 1166 *pfType = EPT16BitEntry(aImportTab[i]) ? EXP_ORGPROC16 : EXP_ORGPROC32; … … 1172 1185 char szNameExp[64]; 1173 1186 1174 printf16(";/* $Id: MkCallTab.c,v 1.5 2002-08-24 22:27:16 bird Exp $\n" 1175 "; *\n" 1176 "; * Autogenerated .c file.\n" 1177 "; *\n" 1178 "; * Generate: mkcalltab.exe deffile > kKrnlLibImp.def\n" 1179 "; *\n" 1180 "; * Copyright (c) 2001 knut st. osmundsen (kosmunds@csc.com)\n" 1181 "; *\n" 1182 "; * Project Odin Software License can be found in LICENSE.TXT\n" 1183 "; *\n" 1184 "; */\n" 1185 "LIBRARY KKRNLLIB\n" 1186 "EXPORTS\n"); 1187 printf("; $Id: MkCallTab.c,v 1.6 2002-12-16 00:46:47 bird Exp $\n" 1188 ";\n" 1189 "; Autogenerated import definition file.\n" 1190 ";\n" 1191 "; Generate: mkcalltab.exe def > kKrnlLibImplib.def\n" 1192 ";\n" 1193 "; Copyright (c) 1998-2003 knut st. osmundsen <bird@anduin.net>\n" 1194 ";\n" 1195 ";\n" 1196 "; This file is part of kKrnlLib.\n" 1197 ";\n" 1198 "; kKrnlLib is free software; you can redistribute it and/or modify\n" 1199 "; it under the terms of the GNU General Public License as published by\n" 1200 "; the Free Software Foundation; either version 2 of the License, or\n" 1201 "; (at your option) any later version.\n" 1202 ";\n" 1203 "; kKrnlLib is distributed in the hope that it will be useful,\n" 1204 "; but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 1205 "; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" 1206 "; GNU General Public License for more details.\n" 1207 ";\n" 1208 "; You should have received a copy of the GNU General Public License\n" 1209 "; along with kKrnlLib; if not, write to the Free Software\n" 1210 "; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" 1211 ";\n" 1212 "LIBRARY KKRNLLIB\n" 1213 "EXPORTS\n"); 1187 1214 1188 1215 iOrdMax = findMaxOrdinal(); … … 1191 1218 iOrd = findNextOrdinal(iOrd, &szName[0], &szNameExp[0], NULL, NULL)) 1192 1219 { 1193 printf 16(" %30s @%d\n", szNameExp, iOrd);1220 printf(" %30s @%d\n", szNameExp, iOrd); 1194 1221 } 1195 1222 return 0; … … 1208 1235 * Write Start of file. 1209 1236 */ 1210 printf16("/* $Id: MkCallTab.c,v 1.5 2002-08-24 22:27:16 bird Exp $\n" 1211 " *\n" 1212 " * Autogenerated TstFakers.c file.\n" 1213 " *\n" 1214 " * Generate: mkcalltab.exe fake > test\TstFakers.c\n" 1215 " *\n" 1216 " * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)\n" 1217 " *\n" 1218 " * Project Odin Software License can be found in LICENSE.TXT\n" 1219 " *\n" 1220 " */\n" 1221 "\n" 1222 "\n" 1223 "/*******************************************************************************\n" 1224 "* Defined Constants And Macros *\n" 1225 "*******************************************************************************/\n" 1226 "#define INCL_NOPMAPI\n" 1227 "#define LDR_INCL_INITONLY\n" 1228 "#define INCL_OS2KRNL_ALL\n" 1229 "\n" 1230 "/*******************************************************************************\n" 1231 "* Header Files *\n" 1232 "*******************************************************************************/\n" 1233 "#include <os2.h>\n" 1234 "\n" 1235 "#include \"devSegDf.h\"\n" 1236 "#include \"OS2Krnl.h\"\n" 1237 "#include \"dev1632.h\"\n" 1238 "#include \"dev32.h\"\n" 1239 "#include \"dev32Hlp.h\"\n" 1240 "#include \"ProbKrnl.h\"\n" 1241 "#include \"testcase.h\"\n" 1242 "\n" 1243 "\n" 1244 "TSTFAKER aTstFakers[NBR_OF_KRNLIMPORTS] =\n" 1245 "{\n"); 1237 printf("/* $Id: MkCallTab.c,v 1.6 2002-12-16 00:46:47 bird Exp $\n" 1238 " *\n" 1239 " * Autogenerated TstFakers file.\n" 1240 " *\n" 1241 " * Generate: mkcalltab.exe fake > test\\TstFakers.c\n" 1242 " *\n" 1243 " * Copyright (c) 1998-2003 knut st. osmundsen <bird@anduin.net>\n" 1244 " *\n" 1245 " *\n" 1246 " * This file is part of kKrnlLib.\n" 1247 " *\n" 1248 " * kKrnlLib is free software; you can redistribute it and/or modify\n" 1249 " * it under the terms of the GNU General Public License as published by\n" 1250 " * the Free Software Foundation; either version 2 of the License, or\n" 1251 " * (at your option) any later version.\n" 1252 " *\n" 1253 " * kKrnlLib is distributed in the hope that it will be useful,\n" 1254 " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 1255 " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" 1256 " * GNU General Public License for more details.\n" 1257 " *\n" 1258 " * You should have received a copy of the GNU General Public License\n" 1259 " * along with kKrnlLib; if not, write to the Free Software\n" 1260 " * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" 1261 " */\n" 1262 "\n" 1263 "\n" 1264 "/*******************************************************************************\n" 1265 "* Defined Constants And Macros *\n" 1266 "*******************************************************************************/\n" 1267 "#define INCL_NOPMAPI\n" 1268 "#define LDR_INCL_INITONLY\n" 1269 "#define INCL_OS2KRNL_ALL\n" 1270 "\n" 1271 "\n" 1272 "/*******************************************************************************\n" 1273 "* Header Files *\n" 1274 "*******************************************************************************/\n" 1275 "#include <os2.h>\n" 1276 "\n" 1277 "#include \"OS2Krnl.h\"\n" 1278 "#include \"dev1632.h\"\n" 1279 "#include \"dev32.h\"\n" 1280 "#include \"dev32Hlp.h\"\n" 1281 "#include \"ProbKrnl.h\"\n" 1282 "#include \"testcase.h\"\n" 1283 "\n" 1284 "\n" 1285 "TSTFAKER aTstFakers[NBR_OF_KRNLIMPORTS] =\n" 1286 "{\n"); 1246 1287 1247 1288 /* … … 1260 1301 * Variable or Function? 1261 1302 */ 1262 printf 16(" {(unsigned)%sfake%s,%*.s%d}%s\n",1263 1264 1265 45 - 21 - kstrlen(psz) - ((aImportTab[i].fType & EPT_VAR) == EPT_VAR),1266 1267 1268 1303 printf(" {(unsigned)%sfake%s,%*.s%d}%s\n", 1304 (aImportTab[i].fType & EPT_VAR) ? "&" : "", 1305 psz, 1306 45 - 21 - strlen(psz) - ((aImportTab[i].fType & EPT_VAR) == EPT_VAR), 1307 "", 1308 iSeg, 1309 i + 1 == NBR_OF_KRNLIMPORTS ? "" : ","); 1269 1310 } 1270 1311 … … 1272 1313 * Write End of file. 1273 1314 */ 1274 printf 16("};\n"1275 1315 printf("};\n" 1316 "\n"); 1276 1317 1277 1318 return 0; -
trunk/src/win32k/kKrnlLib/src/MkCallTab.mak
r9124 r9502 1 # $Id: MkCallTab.mak,v 1.1 1 2002-08-24 22:07:40bird Exp $1 # $Id: MkCallTab.mak,v 1.12 2002-12-16 00:46:47 bird Exp $ 2 2 3 3 # … … 12 12 # Setup config 13 13 # 14 #!if [SET INCLUDE=] 15 #!endif 16 BUILD_ENV_FORCE = MSCV6-16 14 BUILD_ENV_FORCE = VAC308 17 15 PATH_ROOT = ..\..\..\.. 18 16 !include $(PATH_ROOT)\$(BUILD_SETUP_MAK) … … 26 24 TARGET_PUB_DIR = $(PATH_TOOLS) 27 25 MAKEFILE = $(TARGET_NAME).mak 28 CC_INCLUDES = -I../include -I../kLib/include -I$(PATH_DDKBASE)/h -I$(PATH_MSC)/include -I$(PATH_TOOLKIT)/h26 CC_INCLUDES = -I../include -I../kLib/include 29 27 ALL_DEFINES = -DMKCALLTAB 30 28 … … 32 30 $(PATH_TARGET)\MkCallTab.$(EXT_OBJ)\ 33 31 $(PATH_TARGET)\krnlImportTable.$(EXT_OBJ)\ 34 $(PATH_TARGET)\d16ProbeKrnl.$(EXT_OBJ)\35 $(PATH_TARGET)\d16globl.$(EXT_OBJ)\36 $(PATH_TARGET)\d16crt.$(EXT_OBJ)\37 $(PATH_TARGET)\d16vprintf.$(EXT_OBJ)\38 32 39 33 TARGET_LIBS =\
Note:
See TracChangeset
for help on using the changeset viewer.