Header

  1. View current page

    kkamagui의 프로그래밍 작업실

Profile_image?t=1221830958&type=big
온갖 자료가 난무하는 kkamagui의 Springnote~!!!
16

02 Device Driver Code

02 Device Driver Code

원문 :  http://kkamagui.springnote.com/pages/570024

 

들어가기 전에...

 

 

1.CR0 Write Protect Managment Code

  1. //
    // 콘트롤 레지스터 관련 (IA-32 manual vol3, ch 2.5
    //    CR0 (Control Register Zero) 레지스터의 WP 비트(16)는 쓰기 속성제어에 사용됨
    // 
    #define   CR0_WP_MASK     0x0FFFEFFFF
  2.  
  3. /**
     Write Protect를 제거
    */
    VOID  ClearWriteProtect(VOID)

        __asm 
        {   
            push  eax;   
            mov   eax, cr0;   
            and   eax, CR0_WP_MASK; // WP 클리어   
            mov   cr0, eax;   
            pop   eax; 
        }
    }
  4. /**
     Write Protect를 설정
    */
    VOID  SetWriteProtect(VOID)

        __asm 
        {   
            push  eax;   
            mov   eax, cr0;   
            or    eax, not CR0_WP_MASK; // WP 비트 세팅   
            mov   cr0, eax;   
            pop   eax; 
        }
    }

 

 

    History

    Last edited on 05/19/2008 22:48 by kkamagui

    Comments (0)

    You must log in to leave a comment. Please sign in.