Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

mmx.h

Go to the documentation of this file.
00001 /*!     \file include/arch/mmx.h
00002  *      \brief Generic MMX extensions.
00003  *      \author Andrea Righi <drizzt@inwind.it>
00004  *      \date Last update: 2004-02-07
00005  *      \note Copyright (&copy;) 2003 Andrea Righi
00006  */
00007 
00008 #ifndef MMX_H
00009 #define MMX_H
00010 
00011 #include <arch/paging.h>
00012 
00013 //! \brief Clear a page using MMX extensions.
00014 static __inline__ void fast_clear_page( void *page )
00015 {
00016         int i;
00017 
00018         // Clear the task switch flag.
00019         __asm__ __volatile__ ("clts");
00020 
00021         // Clear the 64-bit mm0 register.
00022         __asm__ __volatile__ ("pxor %mm0, %mm0");
00023 
00024         // Fast clear the page.
00025         for( i=0; i<PAGE_SIZE/128; i++ )
00026         {
00027                 __asm__ __volatile__ (
00028                         "movq %%mm0, (%0)\n"
00029                         "movq %%mm0, 8(%0)\n"
00030                         "movq %%mm0, 16(%0)\n"
00031                         "movq %%mm0, 24(%0)\n"
00032                         "movq %%mm0, 32(%0)\n"
00033                         "movq %%mm0, 40(%0)\n"
00034                         "movq %%mm0, 48(%0)\n"
00035                         "movq %%mm0, 56(%0)\n"
00036                         "movq %%mm0, 64(%0)\n"
00037                         "movq %%mm0, 72(%0)\n"
00038                         "movq %%mm0, 80(%0)\n"
00039                         "movq %%mm0, 88(%0)\n"
00040                         "movq %%mm0, 96(%0)\n"
00041                         "movq %%mm0, 104(%0)\n"
00042                         "movq %%mm0, 112(%0)\n"
00043                         "movq %%mm0, 120(%0)\n"
00044                 : : "r"(page) : "memory");
00045                 page += 128;
00046         }
00047 
00048         // Restore task switch flag.
00049         do
00050         {
00051                 unsigned int __cr0;
00052                 __asm__ __volatile__ (
00053                         "movl %%cr0, %0\n"
00054                         "or $8, %0\n"
00055                         "movl %0, %%cr0" : "=r"(__cr0));
00056         } while( 0 );
00057 }
00058 
00059 #endif

Generated on Fri Feb 20 15:32:16 2004 for Minirighi by doxygen1.2.18