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

  1.     .MODEL SMALL, C
  2.     .CODE
  3.     PUBLIC cx_i486cacheon
  4.  
  5. CR0_CD_ENB    EQU    0bfffffffh    ; Enable cache with CR0
  6. CR0_NW_ENB    EQU    0dfffffffh    ; Enable 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_i486cacheon(void)
  13. ;
  14. ;    This routine flushes and enables the i486 internal cache.
  15. ;
  16.  
  17. cx_i486cacheon    PROC            ; The proceedure name.
  18.  
  19.     .386P
  20.  
  21. ; Use of MASM v5.1 should make this unecessary
  22. ;    push    ebp
  23. ;    movl    ebp, esp
  24.  
  25.     DB    0fh            ; INVD instruction:
  26.     DB    08h            ; Flush i486 cache
  27.     DB    0fh            ; WBINVD instruction:
  28.     DB    09h            ; Flush i486 cache with write back
  29.     jmp    cx_postinvd1        ; jmp to next to force queue flush
  30. cx_postinvd1:
  31.     mov    eax, cr0        ; cr0 -> eax
  32.     and    eax, CR0_CD_ENB        ; Turn "on" CD bit
  33.     and    eax, CR0_NW_ENB        ; Turn "on" NW bit
  34.     mov    cr0, eax        ; eax -> cr0
  35.  
  36. ; Again use of MASM v5.1 should do this when it sees ENDP (I hope...)
  37. ;    pop    ebp
  38.  
  39.     ret
  40.  
  41. cx_i486cacheon    ENDP
  42.         END
  43.  
  44.