

                    Improved Cache Performance
                    __________________________



       (Paragraph after features)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


          The copyback cache mode is the default caching mode
        for the Pascal Workstation (except for supervisor mode
        or I/O space memory accesses). This could cause problems
        for programs with self-modifying code or for programs
        that directly make DMA transfers.

          The routine ASM_FLUSH_ICACHE is provided to synchronize
        the caches and memory. In the case of an MC68040 processor
        this routine marks all the I-cache and D-cache entries
        invalid and writes any dirty D-cache entries back to
        main memory. Programs which modify instructions in main
        memory should call this routine before executing any such
        instructions to ensure that the I-cache does not contain
        stale instructions.

          Copyback mode presents a new problem for internals routines
        that make DMA calls directly. Users of such routines have
        always been advised to call ASM_FLUSH_ICACHE after any DMA
        inbound to main memory to synchronize the caches and memory.
        This is still the correct way to proceed. However, now it is
        also important to any DMA (inbound OR outbound) to ensure
        that both the correct data is written out and that dirty
        data in the data cache is not written over the results of
        any inbound DMA. The safest approach is to just call the
        routine ASM_FLUSH_ICACHE both before AND after initiating
        or terminating a DMA transfer.

          Correct handling of copyback mode could require that some
        existing code (only special internals applications that make
        DMA calls directly or applications with self-modifying code)
        be updated as described above. For such code that just cannot
        be modified and recompiled or reassembled it is possible to
        call a routine that will keep the Pascal Workstation in 
        writethrough mode all the time. This routine is ASM_COPY
        _OFF. Rebooting will restore copyback mode as the default
        mode, as will executing the routine ASM_COPY_ON.

          A sample program on the DOC: disc called COPY_OFF.TEXT
        shows how to call ASM_COPY_OFF. Executing this sample
        program will change the default mode of operation for
        the Pascal Workstation (for non-I/O space) to writethrough
        mode. Also on the DOC: disc is a sample program called
        COPY_ON.TEXT. This shows how to call the routine ASM_COPY_ON.
        Executing this program will cause the default mode of
        operation for the workstation (for non-I/O space and user
        mode) to be copyback mode. 
       
          Copyback mode allows for a substantial performance improve-
        ment over writethrough mode.
