Ignore:
Timestamp:
Oct 27, 1999, 4:03:01 AM (26 years ago)
Author:
bird
Message:

Corrections to make win32k work.
(And now it does work, at least at my test machine...)

Location:
trunk/src/win32k/dev32
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/dev32/d32globals.c

    r847 r1467  
    1 /* $Id: d32globals.c,v 1.1 1999-09-06 02:19:56 bird Exp $
     1/* $Id: d32globals.c,v 1.2 1999-10-27 02:02:53 bird Exp $
    22 *
    33 * d32globals - global data (32-bit)
     
    2121*   Global Variables                                                           *
    2222*******************************************************************************/
    23 ULONG           TKSSBase32;
     23PULONG          pulTKSSBase32;
    2424struct options  options;
    2525
  • trunk/src/win32k/dev32/d32hlp.asm

    r847 r1467  
    1 ; $Id: d32hlp.asm,v 1.1 1999-09-06 02:19:56 bird Exp $
     1; $Id: d32hlp.asm,v 1.2 1999-10-27 02:02:54 bird Exp $
    22;
    33; d32hlp - 32-bit Device Driver Helper Function.
    44;
    55; Copyright (c) 1999 knut st. osmundsen
     6;
     7; Project Odin Software License can be found in LICENSE.TXT
    68;
    79    .386p
  • trunk/src/win32k/dev32/d32init.c

    r847 r1467  
    1 /* $Id: d32init.c,v 1.1 1999-09-06 02:19:56 bird Exp $
     1/* $Id: d32init.c,v 1.2 1999-10-27 02:02:54 bird Exp $
    22 *
    33 * d32init.c - 32-bits init routines.
     
    1212#define MAXSIZE_PROLOG 0x10             /* Note that this must be synced with */
    1313                                        /* the one used in calltab.asm.       */
     14#define static
    1415
    1516#define INCL_DOSERRORS
     
    3132#include "log.h"
    3233#include "asmutils.h"
    33 #include "cout.h"
    3434#include "malloc.h"
    3535#include "ldr.h"
     
    5858 * @returns   Status word.
    5959 * @param     pRpInit  Pointer init request packet.
     60 * @sketch    Set TKSSBase32.
     61 *            Set default parameters.
     62 *            Parse command line options.
     63 *            Show (kprint) configuration.
     64 *            Init heap.
     65 *            Init ldr.
     66 *            Init procs. (overloaded ldr procedures)
     67 * @status    completely implemented.
     68 * @author    knut st. osmundsen
    6069 */
    6170USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit)
     
    6473    char *pszTmp;
    6574
    66     TKSSBase32 = _TKSSBase16;
     75    pulTKSSBase32 = (PULONG)_TKSSBase16;
    6776
    6877    SET_OPTIONS_TO_DEFAULT(options);
     
    8089        switch (*pszTmp)
    8190        {
    82             case 'C': /* -C[1|2] - com-port no */
     91            case 'C': /* -C[1|2] - com-port no, def:-C2 */
    8392                switch (pszTmp[1])
    8493                {
     
    8695                        options.usCom = OUTPUT_COM1;
    8796                        break;
     97
    8898                    case '2':
     99                    default:
    89100                        options.usCom = OUTPUT_COM2;
    90                         break;
    91101                }
    92102                break;
    93103
    94             case 'L': /*-L:[Y|N or ]*/
     104            case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */
    95105                pszTmp2 = strpbrk(pszTmp, ":=/- ");
    96                 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 && (*pszTmp2 == '=' || *pszTmp2 == ':' || *pszTmp2 == ' ' && (pszTmp2[1] != '-' || pszTmp2[1] != '/')))
    97                 {
    98                     switch (pszTmp2[1])
    99                     {
    100                         case 'D': /*disable*/
    101                             options.fLogging = FALSE;
    102                             break;
    103                         case 'E': /*enable*/
    104                             options.fLogging = TRUE;
    105                             break;
    106                         case 'Y': /*yes*/
    107                             options.fLogging = TRUE;
    108                             break;
    109                         case 'N': /*no*/
    110                             options.fLogging = FALSE;
    111                             break;
    112                     }
    113                 }
     106                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     107                    && (pszTmp2[1] == 'N' ||pszTmp2[1] == 'n' || pszTmp2[1] == 'D' || pszTmp2[1] == 'd')
     108                    )
     109                    options.fLogging = FALSE;
    114110                else
    115111                    options.fLogging = TRUE;
     
    126122
    127123            case 'V': /* verbose initialization */
    128                 options.fQuiet = TRUE;
     124                options.fQuiet = FALSE;
    129125                break;
    130126
     
    164160     * init sub-parts
    165161     */
    166 
    167162    /* heap */
    168163    if (heapInit(HEAP_SIZE) != NO_ERROR)
    169164        return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
    170 
    171     /* cout init */
    172     coutInit(options.usCom);
    173165
    174166    /* loader */
     
    201193        {
    202194            kprintf(("VerifyProcTab32: procedure no.%d was not found!\n", i));
    203             return 1;
    204         }
    205 
    206         /* verify read/writeable. - NOT IMPLEMENTED (yet) */
     195            return STATUS_DONE | STERR | 1;
     196        }
     197
     198        /* verify read/writeable. - FIXME */
     199        if (_aProcTab[i].ulAddress < 0xffe00000UL)
     200        {
     201            kprintf(("VerifyProcTab32: procedure no.%d has an invlalid address, %#08x!\n",
     202                     i, _aProcTab[i].ulAddress));
     203            return STATUS_DONE | STERR | 2;
     204        }
    207205
    208206        /* verify known function prolog. (only EPT_PROC) */
     
    212210            {
    213211                kprintf(("VerifyProcTab32: verify failed for procedure no.%d\n",i));
    214                 return 2;
     212                return STATUS_DONE | STERR | 3;
    215213            }
    216214        }
     
    218216        {
    219217            kprintf(("VerifyProcTab32: only EPT_PROC is implemented\n",i));
    220             return 3;
    221         }
    222     }
    223 
    224     return 0;
     218            return STATUS_DONE | STERR | 4;
     219        }
     220    }
     221
     222    return STATUS_DONE;
    225223}
    226224
     
    228226/**
    229227 * Get kernel OTEs
    230  * @returns   0 if ok. !0 on failiure.
     228 * @returns   Strategy return code:
     229 *            STATUS_DONE on success.
     230 *            STATUS_DONE | STERR | errorcode on failure.
    231231 * @param     pOTEBuf  Pointer to output buffer.
     232 * @status    completely implemented and tested.
     233 * @author    knut st. osmundsen
    232234 * @remark    Called from IOCtl.
    233235 */
     
    271273        kprintf(("GetOTEs32: failed. usRc = %d\n", usRc));
    272274
    273     return usRc;
     275    return usRc | (usRc != 0 ? STATUS_DONE | STERR : STATUS_DONE);
    274276}
    275277
     
    292294     *     push ebp
    293295     *     mov ebp,esp
     296     *  or
     297     *     push ebp
     298     *     mov ecx, dword ptr [123407452]
    294299     */
    295300
    296     if (p[0] == 0x55 && p[1] == 0x8b && p[2] == 0xec)
    297     {
    298         rc = 3;
     301    if (p[0] == 0x55 && p[1] == 0x8b)
     302    {
     303        if (p[2] == 0xec)
     304            rc = 3;
     305        else
     306            rc = 1;
    299307        while (rc < 5)
    300308        {
     
    308316                case 0x33: /* xor (ldrClose, ldrOpen) */
    309317                    rc +=2;
     318                    break;
     319                case 0x8b:
     320                    if (p[rc+1] == 0x0d)
     321                        rc += 6;
     322                    else
     323                        rc += 2; /*????!*/
    310324                    break;
    311325                case 0x8d: /* lea (ldrRead) */
     
    341355    for (i = 0; i < NUMBER_OF_PROCS; i++)
    342356    {
    343         if ((cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress)) <= 0 && cb + 5 >= MAXSIZE_PROLOG)
    344         {
    345             kprintf(("rehookFunctions: verify failed for procedure no.%d\n", i));
     357        cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress);
     358        if (cb <= 0 || cb + 5 >= MAXSIZE_PROLOG)
     359        {
     360            kprintf(("rehookFunctions: verify failed for procedure no.%d, cb=%d\n", i, cb));
    346361            return 1;
    347362        }
     
    369384
    370385            /* copy function prolog */
    371             memcpy(callTab[i], (char*)_aProcTab[i].ulAddress, cb);
     386            memcpy(callTab[i], (void*)_aProcTab[i].ulAddress, (size_t)cb);
    372387
    373388            /* jump from calltab to original function */
     
    386401            return 1;
    387402        }
    388         i++;
    389403    }
    390404
  • trunk/src/win32k/dev32/devfirst.asm

    r847 r1467  
    1 ; $Id: devfirst.asm,v 1.1 1999-09-06 02:19:56 bird Exp $
     1; $Id: devfirst.asm,v 1.2 1999-10-27 02:02:54 bird Exp $
    22;
    33; DevFirst - entrypoint and segment definitions
     
    55; Copyright (c) 1999 knut st. osmundsen
    66;
     7; Project Odin Software License can be found in LICENSE.TXT
    78;
    89    .386p
     
    1213;
    1314    include devsegdf.inc
     15    include sas.inc
    1416
    1517;
     
    2931    public _strategyAsm0
    3032    public _strategyAsm1
     33    public _CallGetOTEs32
    3134    public _SSToDS_16a
     35    public GetOS2KrnlMTE
    3236
    3337
     
    3539; Externs
    3640;
     41    extrn _TKSSBase16:dword
     42    extrn GETOTES32:FAR
     43    .286p
    3744    extrn _strategy:near
    38     extrn CODE16END:byte
    39     extrn DATA16END:byte
    40     extrn _TKSSBase16:dword
    4145
    4246
     
    4650CODE16START label byte
    4751
     52    .286p
    4853;$win32ki entry point
    4954_strategyAsm0:
     
    5661    jmp     _strategyAsm
    5762
     63;;
     64; Stub which pushes parameters onto the stack and call the 16-bit C strategy routine.
     65; @returns   returns the return value of strategy(...)
     66; @author    knut st. osmundsen
    5867_strategyAsm proc far
    5968    push    es
     
    6675    mov     word ptr es:[bx+3], ax
    6776    add     sp, 2
    68 ;    int 3
    6977    retf
    7078_strategyAsm endp
    7179
    7280
    73 ;extern LIN   SSToDS_16a(void NEAR *pStackVar);
     81    .386p
     82;;
     83; Thunk procedure for R0Init32.
     84; @cproto    USHORT NEAR CallGetOTEs32(ULONG addressOTEBuf);
     85; @returns   Same as GetOTEs32.
     86; @param     addressOTEBuf  32-bit pointer to request data.
     87; @status    completely implemented.
     88; @author    knut st. osmundsen
     89_CallGetOTEs32 PROC NEAR
     90    ASSUME CS:CODE16
     91    push    ds
     92    push    word ptr [esp+6]            ; push high word.
     93    push    word ptr [esp+6]            ; push low word.
     94    call    far ptr FLAT:GETOTES32
     95    pop     ds
     96    retn
     97_CallGetOTEs32 ENDP
     98
     99
     100;;
     101; SSToDS - stack pointer to Flat pointer.
     102; @cproto    extern LIN   SSToDS_16a(void NEAR *pStackVar);
     103; @returns   ax:dx  makes up a 32-bit flat pointer to stack.
     104; @param     pStackVar  Stack pointer which is to be made a flat pointer.
     105; @equiv     SSToDS in 32-bit code.
     106; @sketch    Get Flat CS
     107;            Get TKSSBase address. (FLAT)
     108;            return *TKSSBase + pStackVar.
     109; @status    completely  implemented.
     110; @author    knut st. osmundsen
     111; @remark    es is cs, not ds!
    74112_SSToDS_16a proc near
    75113    assume CS:CODE16, DS:DATA16, ES:NOTHING
     114    mov     edx, ds:_TKSSBase16         ; get pointer held by _TKSSBase16 (pointer to stack base)
     115    call    far ptr FLAT:far_getCS      ; get flat selector.
    76116    push    es
    77     jmp far ptr FLAT:_SSToDS_16a_GetFLAT_32
    78 _SSToDS_16a_GetFLAT_16::
    79     mov     edx, ds:_TKSSBase16
    80     movzx   eax, word ptr ss:[esp + 4]
    81     add     eax, es:[edx]
     117    mov     es,  ax
     118    assume  es:FLAT
     119    mov     eax, es:[edx]               ; get pointer to stack base
     120    pop     es
     121    movzx   edx, word ptr ss:[esp + 2]  ; 16-bit stack pointer (parameter)
     122    add     eax, edx                    ; 32-bit stack pointer in eax
    82123    mov     edx, eax
    83     shr     edx, 16
    84     pop     es
     124    shr     edx, 16                     ; dx high 16-bit of 32-bit stack pointer.
    85125    ret
    86126_SSToDS_16a endp
     
    88128CODE16 ends
    89129
     130
     131;
     132; all segments have a <segmentname>START label at the start of the segment.
     133;
     134
    90135CODE32 segment
    91136CODE32START label byte
    92     ASSUME CS:CODE32
    93 _SSToDS_16a_GetFLAT_32:
    94     push    cs
    95     pop     es
    96     jmp far ptr CODE16:_SSToDS_16a_GetFLAT_16
     137
     138;;
     139; Gets the current cs.
     140; @cproto    none.
     141; @returns   CS
     142; @author    knut st. osmundsen
     143; @remark    internal method. called from 16-bit code...
     144far_getCS proc far
     145    ASSUME DS:nothing, ES:nothing
     146    mov     ax,  cs
     147    retf
     148far_getCS endp
     149
     150
     151
     152;;
     153; Gets the a 32-bit flat pointer to the OS/2 Kernel MTE.
     154; @cproto    extern PMTE _System GetOS2KrnlMTE(void);
     155; @returns   Pointer to kernel MTE.
     156; @status    completely implemented.
     157; @author    knut st. osmundsen
     158GetOS2KrnlMTE PROC NEAR
     159    push    es
     160
     161    mov     ax,  SAS_selector               ;70h - Read-only SAS selector.
     162    mov     es,  ax
     163    xor     ebx, ebx
     164    assume  ebx: PTR SAS
     165    mov     bx,  es:[ebx].SAS_vm_data       ;SAS_vm_data (0ch)
     166    assume  ebx: PTR SAS_vm_section
     167    mov     eax, es:[ebx].SAS_vm_krnl_mte   ;SAS_vm_krnl_mte (0ch)
     168
     169    pop     es
     170    ret
     171GetOS2KrnlMTE ENDP
    97172
    98173CODE32 ends
    99174
    100175
    101 ;
    102 ; all segments have a <segmentname>START label at the start of the segment.
    103 ;
    104176DATA16 segment
    105177DATA16START label byte
  • trunk/src/win32k/dev32/devlast.asm

    r847 r1467  
    1 ; $Id: devlast.asm,v 1.1 1999-09-06 02:19:56 bird Exp $
    2 ; DevLast - the last object file which is resident all the time.
    3 ; Object files which are linked in after this is discarded after init.
     1; $Id: devlast.asm,v 1.2 1999-10-27 02:02:54 bird Exp $
     2;
     3; DevLast - the object file termintating the resident part of the objects.
     4; Code after the ???END labes and object files and which are linked in
     5; after this file is discarded after init.
    46;
    57; Copyright (c) 1999 knut st. osmundsen
    68;
     9; Project Odin Software License can be found in LICENSE.TXT
    710;
    811       .model flat
     
    2831    public CONST32_ROEND
    2932    public _CallR0Init32
    30 
     33    public _CallVerifyProcTab32
    3134
    3235
     
    4952
    5053extrn R0INIT32:FAR
     54extrn VERIFYPROCTAB32:FAR
    5155
    5256CODE16 segment
    53     ASSUME CS:CODE16
    5457CODE16END db ?
    5558
    56 
     59;;
     60; Thunk procedure for R0Init32.
     61; @cproto    USHORT NEAR CallR0Init32(LIN pRpInit);
     62; @returns   Same as R0Init32.
     63; @param     pRpInit  32-bit pointer to request packet.
     64; @status    completely implemented.
     65; @author    knut st. osmundsen
    5766_CallR0Init32 PROC NEAR
     67    ASSUME CS:CODE16
    5868    push    ds
    59     push    word ptr [esp+4]
    60     push    word ptr [esp+8]
     69    push    word ptr [esp+6]            ; push high word.
     70    push    word ptr [esp+6]            ; push low word.
    6171    call    far ptr FLAT:R0INIT32
    6272    pop     ds
    6373    retn
    6474_CallR0Init32 ENDP
     75
     76
     77;;
     78; Thunk procedure for VerifyProcTab32.
     79; @cproto    USHORT NEAR CallVerifyProcTab32(void);
     80; @returns   Same as VerifyProcTab32.
     81; @status    completely implemented.
     82; @author    knut st. osmundsen
     83_CallVerifyProcTab32 PROC NEAR
     84    ASSUME CS:CODE16
     85    push    ds
     86    call    far ptr FLAT:VERIFYPROCTAB32
     87    pop     ds
     88    retn
     89_CallVerifyProcTab32 ENDP
     90
    6591CODE16 ends
     92
    6693
    6794CODE32 segment
Note: See TracChangeset for help on using the changeset viewer.