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

mmx.h File Reference

Generic MMX extensions. More...

#include <arch/paging.h>

Go to the source code of this file.

Functions

__inline__ void fast_clear_page (void *page)
 Clear a page using MMX extensions.


Detailed Description

Generic MMX extensions.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
Last update: 2004-02-07
Note:
Copyright (©) 2003 Andrea Righi

Definition in file mmx.h.


Function Documentation

__inline__ void fast_clear_page void *    page [static]
 

Clear a page using MMX extensions.

Definition at line 14 of file mmx.h.

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 }


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