Changeset 5220 for trunk/src/win32k/dev32/devfirst.asm
- Timestamp:
- Feb 21, 2001, 8:44:15 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/dev32/devfirst.asm
r4164 r5220 1 ; $Id: devfirst.asm,v 1. 6 2000-09-02 21:07:58bird Exp $1 ; $Id: devfirst.asm,v 1.7 2001-02-21 07:44:15 bird Exp $ 2 2 ; 3 3 ; DevFirst - entrypoint and segment definitions … … 41 41 public _SSToDS_16a 42 42 public GetOS2KrnlMTE 43 public x86DisableWriteProtect 44 public x86RestoreWriteProtect 43 45 44 46 … … 220 222 GetOS2KrnlMTE ENDP 221 223 224 225 ;; 226 ; Disables the ring-0 write protection. 227 ; It's used to help us write to readonly code segments and objects. 228 ; @cproto extern ULONG _Optlink x86DisableWriteProtect(void); 229 ; @return Previous write protection flag setting. 230 ; @uses eax, edx 231 ; @status completely implemented. 232 ; @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 233 ; @remark Used by importTabInit. 234 x86DisableWriteProtect proc near 235 cli 236 mov edx, cr0 ; Get current cr0 237 test edx, 000010000h ; Test for the WriteProtect flag (bit 16) 238 setnz al 239 movzx eax, al ; Old flag setting in eax (return value) 240 and edx, 0fffeffffh ; Clear the 16th (WP) bit. 241 mov cr0, edx ; 242 sti 243 ret ; return eax holds previous WP value. 244 x86DisableWriteProtect endp 245 246 247 ;; 248 ; Restore the WP flag of CR0 to it's previous state. 249 ; The call is intent only to be called with the result from x86DisableWriteProtect, 250 ; and will hence only enable the WP flag. 251 ; @cproto extern ULONG _Optlink x86RestoreWriteProtect(ULONG flWP); 252 ; @return Previous write protection flag setting. 253 ; @param eax - flWP Boolean value. (1 = WP was set, 0 WP was clear) 254 ; @uses eax 255 ; @status completely implemented. 256 ; @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 257 ; @remark Used by importTabInit. 258 x86RestoreWriteProtect proc near 259 test eax, eax ; Check if the flag was previously clear 260 jnz x86RWP_set ; If set Then Set it back. 261 jmp x86RWP_end ; If clear Then nothing to do. 262 x86RWP_set: 263 cli 264 mov eax, cr0 ; Get current cr0. 265 or eax, 000010000h ; The the 16-bit (WP) bit. 266 mov cr0, eax ; Update cr0. 267 sti 268 269 x86RWP_end: 270 ret 271 x86RestoreWriteProtect endp 272 273 222 274 CODE32 ends 223 275
Note:
See TracChangeset
for help on using the changeset viewer.