Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / arch / x86 / lib / scrub.c
1 #include <asm/cpufeature.h>
2 #include <asm/page.h>
3 #include <asm/processor.h>
4
5 void xen_scrub_pages(void *v, unsigned int count)
6 {
7         if (likely(cpu_has_xmm2)) {
8                 unsigned long n = count * (PAGE_SIZE / sizeof(long) / 4);
9
10                 for (; n--; v += sizeof(long) * 4)
11                         asm("movnti %1,(%0)\n\t"
12                             "movnti %1,%c2(%0)\n\t"
13                             "movnti %1,2*%c2(%0)\n\t"
14                             "movnti %1,3*%c2(%0)\n\t"
15                             : : "r" (v), "r" (0L), "i" (sizeof(long))
16                             : "memory");
17                 asm volatile("sfence" : : : "memory");
18         } else
19                 for (; count--; v += PAGE_SIZE)
20                         clear_page(v);
21 }