Changeset 4005 for branches/Grace/src


Ignore:
Timestamp:
Aug 13, 2000, 11:23:59 AM (25 years ago)
Author:
bird
Message:

Messing around with libraries. There were a conversion bug in libconv.
The VAC365 linker don't like the output libconv...

Location:
branches/Grace/src/win32k
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/Grace/src/win32k/dev32/d32hlp.asm

    r3834 r4005  
    1 ; $Id: d32hlp.asm,v 1.3.4.1 2000-07-16 22:43:25 bird Exp $
     1; $Id: d32hlp.asm,v 1.3.4.2 2000-08-13 09:23:58 bird Exp $
    22;
    33; d32hlp - 32-bit Device Driver Helper Function.
     
    3737
    3838;CODE32 segment
    39 CODE32 segment dword public 'CODE' use32
     39CODE32 segment
    4040    assume cs:CODE32, ds:flat, ss:nothing, es:nothing
    4141    .386p
     
    281281
    282282;CODE16 segment
    283 CODE16 segment word public 'CODE' use16
     283CODE16 segment
    284284    assume cs:CODE16, ds:FLAT
    285285
  • branches/Grace/src/win32k/dev32/devfirst.asm

    r2898 r4005  
    1 ; $Id: devfirst.asm,v 1.5 2000-02-25 18:15:03 bird Exp $
     1; $Id: devfirst.asm,v 1.5.4.1 2000-08-13 09:23:58 bird Exp $
    22;
    33; DevFirst - entrypoint and segment definitions
     
    6060;$win32ki entry point
    6161_strategyAsm0:
     62    int 3
    6263    push    0
    6364    jmp     _strategyAsm
     
    6566;$win32k entry point
    6667_strategyAsm1:
     68    int 3
    6769    push    1
    6870    jmp     _strategyAsm
  • branches/Grace/src/win32k/include/devSegDf.inc

    r3834 r4005  
    1 ; $Id: devSegDf.inc,v 1.5.4.1 2000-07-16 22:43:28 bird Exp $
     1; $Id: devSegDf.inc,v 1.5.4.2 2000-08-13 09:23:59 bird Exp $
    22;
    33; Segment definitions for win32k.sys.
     
    2323CODE16 segment word public 'CODE' use16
    2424CODE16 ends
     25
     26CODE16_IOSEG segment word public 'CODE' use16
     27CODE16_IOSEG ends
    2528
    2629
  • branches/Grace/src/win32k/include/omf.h

    r1678 r4005  
    1 /* $Id: omf.h,v 1.2 1999-11-10 01:45:33 bird Exp $ */
     1/* $Id: omf.h,v 1.2.4.1 2000-08-13 09:23:59 bird Exp $ */
    22/*
    33 * OMF stuff
     
    1616#define LIBEND      0xF1
    1717#define THEADR      0x80
    18 
    1918#define MODEND      0x8a
    2019#define MODEND2     0x8b
    21 
    2220#define COMENT      0x88
    2321#define     IMPDEF  0x01
    24 
     22#define PUBDEF      0x90
    2523#define LNAMES      0x96
     24#define SEGDEF      0x98
     25#define SEGDEF2     0x99
     26#define GRPDEF      0x9A
     27#define FIXUPP      0x9C
     28#define FIXUPP2     0x9D
     29#define LEDATA      0xA0
     30#define LEDATA2     0xA1
    2631
    2732#endif
  • branches/Grace/src/win32k/libconv.c

    r3834 r4005  
    1 /* $Id: libconv.c,v 1.2.4.1 2000-07-16 22:43:19 bird Exp $
     1/* $Id: libconv.c,v 1.2.4.2 2000-08-13 09:23:53 bird Exp $
    22 *
    33 * Very simple OMF/LIB dumper.
     
    2121
    2222int fCodeToCode16 = 0;
     23int fRemoveExtra = 0;
    2324
    2425/*@IntFunc**********************************************************************
     
    2627*******************************************************************************/
    2728int processFile(const char *pszFilename, const char *pszFilenameOut);
    28 void *processRecord(void *pvRecord, void *pvBase, FILE *phNew);
     29void *processRecord(void *pvRecord, void *pvBase, FILE *phNew, unsigned short *ausTrans);
    2930
    3031
     
    3536    int argi = 1;
    3637
     38    if (argc == 4)
     39    {
     40        argi = 2;
     41        fRemoveExtra = 1;
     42    }
    3743    if (argc != 3)
    3844        printf("syntax error - requires two filename, in.lib and out.lib\n");
     
    7884                if (fread(pvFile, cbFile, 1, phFile) == 1)
    7985                {
     86                    unsigned short * ausTrans = calloc(sizeof(unsigned short), cbFile / 16 ); /* Assumes page size of 16 FIXME! */
    8087                    void *pvNew = pvFile;
     88
    8189
    8290                    /*  main loop */
    8391                    while (pvNew < (void*)(cbFile + (int)pvFile))
    84                         pvNew = processRecord(pvNew, pvFile, phNew);
     92                        pvNew = processRecord(pvNew, pvFile, phNew, ausTrans);
    8593                }
    8694                else
     
    103111
    104112
    105 void *processRecord(void *pvRecord, void *pvBase, FILE *phNew)
     113void *processRecord(void *pvRecord, void *pvBase, FILE *phNew, unsigned short *ausTrans)
    106114{
    107115    static char *apszLNames[256];
    108116    static int   cpszLNames = 0;
    109117    static int   iCode16 = 0;
     118    static int   cbPage = 16;       /* fixme todo TODO FIXME ASSUMES: pagesize = 16 */
    110119    void *pvRet = pvRecord;
    111120    int  cbRecord;
     
    116125    {
    117126       case LIBHDR:
    118             fChanged = 1;
    119             fwrite(pvRecord, 1, 3, phNew);
    120127            if (*(unsigned short*)((int)pvRecord+1) < 6)
    121                 fwrite((char*)pvRecord+3, 1, *(unsigned short*)((int)pvRecord+1), phNew);
    122             else
    123             {
    124                 i = 0;
    125                 fwrite(&i, 1, 2, phNew);
    126                 fwrite(&i, 1, 2, phNew);
    127                 fwrite(&i, 1, 2, phNew);
    128                 fwrite((char*)pvRecord+3+6, 1, *(unsigned short*)((int)pvRecord+1) - 6, phNew);
    129             }
    130             cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
    131             break;
    132 
    133         case 0x98: /* 16-bit segdef */
    134             cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     128                fprintf(stderr, "error: not supported LIBHDR\n");
     129            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     130            break;
     131
     132        case THEADR:
     133            /* Add entry to the translation table - used to translate block numbers in the dictionary */
     134            ausTrans[((char*)pvRecord - (char*)pvBase) / cbPage] = (unsigned short)(ftell(phNew) / cbPage);
     135            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     136            break;
     137
     138        case SEGDEF: /* 16-bit segdef */
     139            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     140            *((char*)pvRecord + 9) =  0;
    135141            i = *(char*)((int)pvRecord + 6);
    136142            if (cbRecord == 10 && i <= cpszLNames && strcmp(apszLNames[i-1], "CODE") == 0)
    137                 {
     143            {
    138144                *(char*)((int)pvRecord + 6) = iCode16+1;
    139                 }
     145            }
     146            i = *(char*)((int)pvRecord + 6);
     147            if (cbRecord == 10 &&  (*((char *)pvRecord + 3) & 0xE0) == 0x20 && i <= cpszLNames && strcmp(apszLNames[i-1], "CODE16_IOSEG") == 0)
     148            {   /* change alignment of this segment... */
     149                /* fprintf(stderr, "debug %s 0x%02x\n", apszLNames[*(char*)((int)pvRecord + 6) - 1], (*((char *)pvRecord + 3) & 0xFF)); */
     150                *((char*)pvRecord + 3) =  0x40 | (*((char*)pvRecord + 3) & 0x1F);
     151            }
    140152            break;
    141153
     
    148160            /* it seems to be somthing funny here! - lets try aligning it to on a 16 bytes boundrary... */
    149161            /* PS. I know this I have a wrong approch to the lib files, not using the directory... */
     162            /* Aug 13 2000 4:24am: The alignment of modules are found in the library header.
     163             *    It's the size of the library header.
     164             *    Not implemented yet. TODO FIXME BUGBUG ASSUMES
     165             */
    150166            fChanged = 1;
    151167            fwrite(pvRecord, 1, cbRecord, phNew);
     
    153169            if (*((unsigned char*)((int)pvRecord+cbRecord)) == 0x00)
    154170            {
    155                 if ((ul % 16) > 0)
    156                     cbRecord += 16 - (ul % 16);
     171                if ((ul % cbPage) > 0)
     172                    cbRecord += cbPage - (ul % cbPage);
    157173            }
    158174            /*if (*((unsigned char*)pvRecord + cbRecord) != LIBEND)*/
    159175            {
    160176                ul = ftell(phNew);
    161                 while (ul++ % 16 != 0)
     177                while (ul++ % cbPage != 0)
    162178                    fputc(0, phNew);
    163179            }
     
    166182        } break;
    167183
     184        case PUBDEF:
     185        {
     186            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     187            *((char*)pvRecord + cbRecord - 1) = 0;
     188            break;
     189        }
     190
    168191        case LNAMES:
    169             {
     192        {
    170193            char *apszConv[] =
    171194            {
    172                 "CODE",     "CODE",
    173                 "_CODE",    "CODE16",
    174                 "TEXT",     "CODE16",
    175                 "_TEXT",    "CODE16",
    176                 "_IOSEG",   "CODE16",
    177                 "IOSEG_CODE", "CODE",
    178                 "DATA",     "FAR_DATA",
    179                 "_DATA",    "DATA16",
    180                 "DGROUP",   "DATA16_GROUP",
    181                 "_BSS",     "DATA16BSS",
    182                 "BSS",      "DATA16BSS",
    183                 "_CONST",   "DATA16CONST",
    184                 "CONST",    "DATA16CONST",
     195                /* classes */
     196                "CODE",         "CODE",
     197                "IOSEG_CODE",   "CODE",
     198                "DATA",         "FAR_DATA",
     199                "BSS",          "DATA16BSS",
     200                "CONST",        "DATA16CONST",
     201                /* segment names */
     202                "_TEXT",        "CODE16",
     203                "_IOSEG",       "CODE16_IOSEG",
     204                "_CODE",        "CODE16",           /* dhcalls */
     205                "_DATA",        "DATA16",
     206                "_BSS",         "DATA16BSS",
     207                "_CONST",       "DATA16CONST",
     208                /* groups */
     209                "DGROUP",       "DATA16_GROUP",
    185210                NULL, NULL
    186211            };
     
    244269            fputc(0, phNew);
    245270            break;
    246             }
     271        }
    247272
    248273        case LIBEND:
    249             cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
    250             fwrite(pvRecord, 1, cbRecord, phNew);
     274        {
     275            /* align dictionary at 512 byte (3 is min size of this record) */
     276            int cBlocks;
     277            unsigned short int cbSize  = (((ftell(phNew) + 3 + 0x1ff) & ~0x1ff) - ftell(phNew)) - 3;
     278            unsigned long int  offDict = ftell(phNew) + cbSize + 3;
     279            cbRecord = cbSize + 3;
     280            fwrite(pvRecord, 1, 1, phNew);
     281            fwrite(&cbSize, 1, sizeof(cbSize), phNew);
     282            while (cbSize-- > 0)
     283                fwrite("\0", 1, 1, phNew);
     284
     285            /* update header record. */
     286            fseek(phNew, 3, SEEK_SET);
     287            fwrite(&offDict, 1, sizeof(offDict), phNew);
     288            fseek(phNew, offDict, SEEK_SET);
     289
     290            /* Translate the dictionary */
     291            pvRecord = (void*)((char*)pvRecord + *(unsigned short*)((char*)pvRecord + 1) + 3);
     292            cBlocks = *(unsigned short *)((char*)pvBase + 7);
     293            for (i = 0; i < cBlocks; i++)
     294            {
     295                int j;
     296                char *pchBlock = (char*)pvRecord + i * 512;
     297                for (j = 0; j < 37; j++)
     298                {
     299                    if (pchBlock[j] > 19 && pchBlock[j] < 0xff)
     300                    {
     301                        unsigned short *pusBlock = (unsigned short*)&pchBlock[pchBlock[j] * 2];
     302                        pusBlock = (unsigned short *) ((char*)pusBlock + *(char*)pusBlock + 1);
     303                        if (ausTrans[*pusBlock] == 0)
     304                            fprintf(stderr, "error: dictionary entry don't point to a THEADR page!\n");
     305                        else
     306                            *pusBlock = ausTrans[*pusBlock];
     307                    }
     308                }
     309
     310            }
     311
     312            /* Write the dictionary */
     313            fwrite(pvRecord, 512, cBlocks, phNew);
    251314            return (void*)0xffffffff; /* FINE */
    252             break;
     315        }
     316
     317        case COMENT:
     318        {
     319            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     320            switch (*((unsigned char*)((int)pvRecord+4)))
     321            {
     322                /* remove "Link Pass Separator" */
     323                case 0xA2:
     324                /* remove "LIBMOD" - The VAC 3.6.5 Linker don't like these! */
     325                case 0xA3:
     326                    fChanged = fRemoveExtra;
     327                    break;
     328            }
     329            break;
     330        }
     331
     332        /*
     333         * Remove checksum
     334         */
     335        /*
     336        case GRPDEF:
     337        case FIXUPP:
     338        case FIXUPP2:
     339        case LEDATA:
     340        {
     341            cbRecord = *((unsigned short*)((int)pvRecord+1)) + 3;
     342            *((char*)pvRecord + cbRecord - 1) = 0;
     343            break;
     344        }
     345        */
    253346
    254347        default:
Note: See TracChangeset for help on using the changeset viewer.