Changeset 1467 for trunk/src/win32k/dev32
- Timestamp:
- Oct 27, 1999, 4:03:01 AM (26 years ago)
- 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:56bird Exp $1 /* $Id: d32globals.c,v 1.2 1999-10-27 02:02:53 bird Exp $ 2 2 * 3 3 * d32globals - global data (32-bit) … … 21 21 * Global Variables * 22 22 *******************************************************************************/ 23 ULONGTKSSBase32;23 PULONG pulTKSSBase32; 24 24 struct options options; 25 25 -
trunk/src/win32k/dev32/d32hlp.asm
r847 r1467 1 ; $Id: d32hlp.asm,v 1. 1 1999-09-06 02:19:56bird Exp $1 ; $Id: d32hlp.asm,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 2 ; 3 3 ; d32hlp - 32-bit Device Driver Helper Function. 4 4 ; 5 5 ; Copyright (c) 1999 knut st. osmundsen 6 ; 7 ; Project Odin Software License can be found in LICENSE.TXT 6 8 ; 7 9 .386p -
trunk/src/win32k/dev32/d32init.c
r847 r1467 1 /* $Id: d32init.c,v 1. 1 1999-09-06 02:19:56bird Exp $1 /* $Id: d32init.c,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. … … 12 12 #define MAXSIZE_PROLOG 0x10 /* Note that this must be synced with */ 13 13 /* the one used in calltab.asm. */ 14 #define static 14 15 15 16 #define INCL_DOSERRORS … … 31 32 #include "log.h" 32 33 #include "asmutils.h" 33 #include "cout.h"34 34 #include "malloc.h" 35 35 #include "ldr.h" … … 58 58 * @returns Status word. 59 59 * @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 60 69 */ 61 70 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit) … … 64 73 char *pszTmp; 65 74 66 TKSSBase32 =_TKSSBase16;75 pulTKSSBase32 = (PULONG)_TKSSBase16; 67 76 68 77 SET_OPTIONS_TO_DEFAULT(options); … … 80 89 switch (*pszTmp) 81 90 { 82 case 'C': /* -C[1|2] - com-port no */91 case 'C': /* -C[1|2] - com-port no, def:-C2 */ 83 92 switch (pszTmp[1]) 84 93 { … … 86 95 options.usCom = OUTPUT_COM1; 87 96 break; 97 88 98 case '2': 99 default: 89 100 options.usCom = OUTPUT_COM2; 90 break;91 101 } 92 102 break; 93 103 94 case 'L': /* -L:[Y|N or ]*/104 case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */ 95 105 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; 114 110 else 115 111 options.fLogging = TRUE; … … 126 122 127 123 case 'V': /* verbose initialization */ 128 options.fQuiet = TRUE;124 options.fQuiet = FALSE; 129 125 break; 130 126 … … 164 160 * init sub-parts 165 161 */ 166 167 162 /* heap */ 168 163 if (heapInit(HEAP_SIZE) != NO_ERROR) 169 164 return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 170 171 /* cout init */172 coutInit(options.usCom);173 165 174 166 /* loader */ … … 201 193 { 202 194 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 } 207 205 208 206 /* verify known function prolog. (only EPT_PROC) */ … … 212 210 { 213 211 kprintf(("VerifyProcTab32: verify failed for procedure no.%d\n",i)); 214 return 2;212 return STATUS_DONE | STERR | 3; 215 213 } 216 214 } … … 218 216 { 219 217 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; 225 223 } 226 224 … … 228 226 /** 229 227 * 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. 231 231 * @param pOTEBuf Pointer to output buffer. 232 * @status completely implemented and tested. 233 * @author knut st. osmundsen 232 234 * @remark Called from IOCtl. 233 235 */ … … 271 273 kprintf(("GetOTEs32: failed. usRc = %d\n", usRc)); 272 274 273 return usRc ;275 return usRc | (usRc != 0 ? STATUS_DONE | STERR : STATUS_DONE); 274 276 } 275 277 … … 292 294 * push ebp 293 295 * mov ebp,esp 296 * or 297 * push ebp 298 * mov ecx, dword ptr [123407452] 294 299 */ 295 300 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; 299 307 while (rc < 5) 300 308 { … … 308 316 case 0x33: /* xor (ldrClose, ldrOpen) */ 309 317 rc +=2; 318 break; 319 case 0x8b: 320 if (p[rc+1] == 0x0d) 321 rc += 6; 322 else 323 rc += 2; /*????!*/ 310 324 break; 311 325 case 0x8d: /* lea (ldrRead) */ … … 341 355 for (i = 0; i < NUMBER_OF_PROCS; i++) 342 356 { 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)); 346 361 return 1; 347 362 } … … 369 384 370 385 /* copy function prolog */ 371 memcpy(callTab[i], ( char*)_aProcTab[i].ulAddress,cb);386 memcpy(callTab[i], (void*)_aProcTab[i].ulAddress, (size_t)cb); 372 387 373 388 /* jump from calltab to original function */ … … 386 401 return 1; 387 402 } 388 i++;389 403 } 390 404 -
trunk/src/win32k/dev32/devfirst.asm
r847 r1467 1 ; $Id: devfirst.asm,v 1. 1 1999-09-06 02:19:56bird Exp $1 ; $Id: devfirst.asm,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 2 ; 3 3 ; DevFirst - entrypoint and segment definitions … … 5 5 ; Copyright (c) 1999 knut st. osmundsen 6 6 ; 7 ; Project Odin Software License can be found in LICENSE.TXT 7 8 ; 8 9 .386p … … 12 13 ; 13 14 include devsegdf.inc 15 include sas.inc 14 16 15 17 ; … … 29 31 public _strategyAsm0 30 32 public _strategyAsm1 33 public _CallGetOTEs32 31 34 public _SSToDS_16a 35 public GetOS2KrnlMTE 32 36 33 37 … … 35 39 ; Externs 36 40 ; 41 extrn _TKSSBase16:dword 42 extrn GETOTES32:FAR 43 .286p 37 44 extrn _strategy:near 38 extrn CODE16END:byte39 extrn DATA16END:byte40 extrn _TKSSBase16:dword41 45 42 46 … … 46 50 CODE16START label byte 47 51 52 .286p 48 53 ;$win32ki entry point 49 54 _strategyAsm0: … … 56 61 jmp _strategyAsm 57 62 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 58 67 _strategyAsm proc far 59 68 push es … … 66 75 mov word ptr es:[bx+3], ax 67 76 add sp, 2 68 ; int 369 77 retf 70 78 _strategyAsm endp 71 79 72 80 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! 74 112 _SSToDS_16a proc near 75 113 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. 76 116 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 82 123 mov edx, eax 83 shr edx, 16 84 pop es 124 shr edx, 16 ; dx high 16-bit of 32-bit stack pointer. 85 125 ret 86 126 _SSToDS_16a endp … … 88 128 CODE16 ends 89 129 130 131 ; 132 ; all segments have a <segmentname>START label at the start of the segment. 133 ; 134 90 135 CODE32 segment 91 136 CODE32START 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... 144 far_getCS proc far 145 ASSUME DS:nothing, ES:nothing 146 mov ax, cs 147 retf 148 far_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 158 GetOS2KrnlMTE 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 171 GetOS2KrnlMTE ENDP 97 172 98 173 CODE32 ends 99 174 100 175 101 ;102 ; all segments have a <segmentname>START label at the start of the segment.103 ;104 176 DATA16 segment 105 177 DATA16START 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. 4 6 ; 5 7 ; Copyright (c) 1999 knut st. osmundsen 6 8 ; 9 ; Project Odin Software License can be found in LICENSE.TXT 7 10 ; 8 11 .model flat … … 28 31 public CONST32_ROEND 29 32 public _CallR0Init32 30 33 public _CallVerifyProcTab32 31 34 32 35 … … 49 52 50 53 extrn R0INIT32:FAR 54 extrn VERIFYPROCTAB32:FAR 51 55 52 56 CODE16 segment 53 ASSUME CS:CODE1654 57 CODE16END db ? 55 58 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 57 66 _CallR0Init32 PROC NEAR 67 ASSUME CS:CODE16 58 68 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. 61 71 call far ptr FLAT:R0INIT32 62 72 pop ds 63 73 retn 64 74 _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 65 91 CODE16 ends 92 66 93 67 94 CODE32 segment
Note:
See TracChangeset
for help on using the changeset viewer.