Changeset 4068 for branches/Grace/src
- Timestamp:
- Aug 22, 2000, 5:00:22 AM (25 years ago)
- Location:
- branches/Grace/src/win32k/ldr
- Files:
-
- 2 edited
-
mytkExecPgm.asm (modified) (7 diffs)
-
mytkStartProcess.asm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/Grace/src/win32k/ldr/mytkExecPgm.asm
r4065 r4068 1 ; $Id: mytkExecPgm.asm,v 1.10.4. 4 2000-08-21 22:59:40bird Exp $1 ; $Id: mytkExecPgm.asm,v 1.10.4.5 2000-08-22 03:00:21 bird Exp $ 2 2 ; 3 3 ; mytkExecPgm - tkExecPgm overload … … 54 54 extrn _TKFuBuff@16:PROC 55 55 56 57 56 ; 58 57 ; LDR semaphore 59 58 ; 60 extrn pLDRSem:DWORD 61 extrn _KSEMRequestMutex@8:PROC 62 extrn _LDRClearSem@0:PROC 59 extrn pLdrSem:DWORD 60 extrn _LDRClearSem@0:PROC 61 extrn _KSEMRequestMutex@8:PROC 62 extrn _KSEMQueryMutex@8:PROC 63 63 64 64 ; … … 77 77 extrn D32Hlp_VirtToLin:PROC 78 78 79 ; 80 ; TKSSBase (32-bit) 81 ; 82 extrn pulTKSSBase32:DWORD 79 83 80 84 ; … … 84 88 public tkExecPgmCopyEnv 85 89 86 public fLdrSemTaken87 90 public fTkExecPgm 88 91 public achTkExecPgmFilename … … 101 104 ; (and you'll have to be behind the loader semaphore of course!) 102 105 DATA16 SEGMENT 103 fLdrSemTaken db 0 ; 0 - Loader Semaphore not taken104 ; 1 - Loader semaphore is taken and will be freed at exit.105 106 fTkExecPgm db 0 ; 0 - achTkExecPgmFilename and achTkExecPgmArguments is INVALID 106 107 ; 1 - achTkExecPgmFilename and achTkExecPgmArguments is VALID. … … 221 222 ASSUME DS:FLAT, ES:FLAT 222 223 223 mov eax, pL DRSem ; Load pointer to pLDRSem224 or eax, eax ; Check NULL pointer.225 j e tkepgm_backout ; BACKOUT on NULL pointer. (paranoia)224 mov eax, pLdrSem ; Get pointer to the loader semaphore. 225 or eax, eax ; Check if null. (paranoia) 226 jz tkepgm_backout ; Fail if null. 226 227 227 228 push 0ffffffffh ; Wait indefinitely. 228 push eax ; LDRSem handle.229 push eax ; Push LdrSem address (which is the handle). 229 230 call near ptr FLAT:_KSEMRequestMutex@8 230 231 or eax, eax ; Check if failed. 231 232 jnz tkepgm_backout ; Backout on failure. 232 mov fLdrSemTaken, 1 ; Marks that the loader semaphore is taken233 233 234 234 … … 328 328 329 329 ; 330 ; Clear loader semaphore .330 ; Clear loader semaphore? 331 331 ; and clear loader state, current exe module and tkExecPgm global data flag. 332 332 ; 333 cmp fLdrSemTaken, 0 ; is the semaphore still taken? 334 je tkepgm_callbehindret ; jmp if not taken. 333 push 0 ; Usage count variable. 334 mov eax, pulTKSSBase32 ; Get TKSSBase 335 mov eax, [eax] 336 add eax, esp ; Added TKSSBase to the usage count pointer 337 push eax ; Push address of usage count pointer. 338 push pLdrSem ; Push pointer to loader semaphore ( = handle). 339 call _KSEMQueryMutex@8 340 or eax, eax ; Check return code. (1 = our / free; 0 = not our but take) 341 je tkepgm_callbehindret ; jmp if not taken by us (FALSE). 342 pop eax ; Pops usage count. 343 or eax, eax ; Check usage count. 344 jz tkepgm_callbehindret ; jmp if 0 (=free). 335 345 mov ulLDRState, 0 ; Clears loaderstate. (LDRSTATE_UNKNOWN) 336 346 mov pExeModule, 0 ; Sets the exemodule pointer to NULL. 337 347 mov fTkExecPgm, 0 ; Marks global data invalid. 338 348 call near ptr FLAT:_LDRClearSem@0 339 mov fLdrSemTaken, 0 ; Loader semaphore is not taken any longer!340 349 341 350 ; -
branches/Grace/src/win32k/ldr/mytkStartProcess.asm
r4065 r4068 1 ; $Id: mytkStartProcess.asm,v 1.1.2. 1 2000-08-21 22:59:40bird Exp $1 ; $Id: mytkStartProcess.asm,v 1.1.2.2 2000-08-22 03:00:22 bird Exp $ 2 2 ; 3 3 ; tkStartProcess overloader. Needed to clear the loader semaphore … … 20 20 ; Imported Functions and variables. 21 21 ; 22 22 23 ; 23 24 ; LDR semaphore 24 25 ; 25 extrn pLDRSem:DWORD 26 extrn _KSEMRequestMutex@8:PROC 27 extrn _LDRClearSem@0:PROC 26 extrn pLdrSem:DWORD 27 extrn _LDRClearSem@0:PROC 28 extrn _KSEMRequestMutex@8:PROC 29 extrn _KSEMQueryMutex@8:PROC 28 30 29 31 ; … … 33 35 34 36 ; 37 ; mytkExecPgm stuff. 35 38 ; 36 ;37 extrn fLdrSemTaken:BYTE38 39 extrn fTkExecPgm:BYTE 39 40 … … 44 45 45 46 ; 46 ; Exported symbols47 ; TKSSBase (32-bit) 47 48 ; 49 extrn pulTKSSBase32:DWORD 50 51 ; 52 ; Calltable entry for tkStartProcess 53 ; 54 extrn _g_tkStartProcess:PROC 55 56 ; 57 ; Exported symbols 58 ; 48 59 public mytkStartProcess 49 60 50 61 51 62 CODE32 SEGMENT 63 64 ;; 65 ; Overloads tkStartProcess. If the loader semahore is taken by us we'll release it. 66 ; @returns 67 ; @param 68 ; @uses eax, ecx, edx 69 ; @sketch 70 ; @status 71 ; @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 72 ; @remark 52 73 mytkStartProcess PROC NEAR 53 74 ASSUME CS:CODE32, DS:FLAT, ES:NOTHING, SS:NOTHING 54 75 55 76 ; 56 ; Check if the loader semphore is take .77 ; Check if the loader semphore is take by us. 57 78 ; Clear it (and other vars) if it is. 58 79 ; 59 cmp fLdrSemTaken, 0 60 jz finished 80 push eax 81 push ecx 82 push edx 61 83 84 push 0 ; Usage count variable. 85 mov eax, pulTKSSBase32 ; Get TKSSBase 86 mov eax, [eax] 87 add eax, esp ; Added TKSSBase to the usage count pointer 88 push eax ; Push address of usage count pointer. 89 push pLdrSem ; Push pointer to loader semaphore ( = handle). 90 call _KSEMQueryMutex@8 91 or eax, eax ; Check return code. (1 = our / free; 0 = not our but take) 92 jz mtksp_ret ; jmp if not taken by us (FALSE). 93 pop eax ; Pops usage count. 94 or eax, eax ; Check usage count. 95 jz mtksp_ret ; jmp if 0 (=free). 62 96 mov ulLDRState, 0 ; Clears loaderstate. (LDRSTATE_UNKNOWN) 63 97 mov pExeModule, 0 ; Sets the exemodule pointer to NULL. 64 98 mov fTkExecPgm, 0 ; Marks global data invalid. 99 cmp eax, 1 ; If usage count > 1 then issue a release. (should not happen here) 100 je mtksp_ret ; jmp if usage count < 2. (tkStartProcess or tkExecPgm will free the last usage). 65 101 call near ptr FLAT:_LDRClearSem@0 66 mov fLdrSemTaken, 0 ; Loader semaphore is not taken any longer!67 102 68 finished: 69 call ktStartProcess 70 ret 103 mtksp_ret: 104 pop edx 105 pop ecx 106 pop eax 107 jmp _g_tkStartProcess 71 108 mytkStartProcess ENDP 72 109
Note:
See TracChangeset
for help on using the changeset viewer.
