home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / CYRIX100.ZIP / CX486DLC / SRC_MS / DISABLE.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-03-31  |  1009 b   |  44 lines

  1.     .MODEL    SMALL, C
  2.     .CODE
  3.     PUBLIC cx_i486cacheoff
  4.  
  5. CR0_CD_DIS    EQU    40000000h    ; Disable cache with CR0
  6. CR0_NW_DIS    EQU    20000000h    ; Disable writethru with CR0
  7.                     ; Actually, the NW bit is hardwired
  8.                     ; to 0 at all times on the Cyrix,
  9.                     ; but we set and clear it anyway...
  10.  
  11. ;
  12. ;    void cx_i486cacheoff(void)
  13. ;
  14. ;    This routine disables and flushes the i486 internal cache.
  15. ;
  16.  
  17. cx_i486cacheoff    PROC
  18.  
  19.     .386P                ; let fly with 32 bit instructions
  20.  
  21. ; Shouldn't need these with MASM v5.1 as it does this for you.
  22. ;    push    ebp
  23. ;    mov    ebp, esp
  24.  
  25.     mov    eax, cr0        ; cr0 -> eax
  26.     or    eax, CR0_CD_DIS        ; Turn "off" CD bit
  27.     or    eax, CR0_NW_DIS        ; Turn "off" NW bit
  28.     mov    cr0, eax        ; eax -> cr0
  29.     db    0fh            ; INVD instruction:
  30.     db    08h            ; Flush i486 cache
  31.     db    0fh            ; WBINVD instruction:
  32.     db    09h            ; Flush i486 cache with write back
  33.     jmp    cx_postinvd2        ; Jmp to next to force queue flush
  34. cx_postinvd2:
  35.  
  36. ; Same as above, i.e. MASM v5.1 should do this.
  37. ;    pop    ebp
  38.  
  39.     ret
  40.  
  41. cx_i486cacheoff    ENDP
  42.         END
  43.  
  44.