1/* 2 * This file is subject to the terms and conditions of the GNU General Public 3 * License. See the file "COPYING" in the main directory of this archive 4 * for more details. 5 * 6 * Copyright (C) 1997, 1998, 1999 Ralf Baechle (ralf@gnu.org) 7 * Copyright (C) 1999 Silicon Graphics, Inc. 8 * Copyright (C) 2000 Kanoj Sarcar (kanoj@sgi.com) 9 */ 10#include <linux/init.h> 11#include <linux/kernel.h> 12#include <linux/sched.h> 13#include <linux/mm.h> 14#include <asm/page.h> 15#include <asm/pgtable.h> 16#include <asm/r10kcache.h> 17#include <asm/system.h> 18#include <asm/mmu_context.h> 19 20/* 21 * This version has been tuned on an Origin. For other machines the arguments 22 * of the pref instructin may have to be tuned differently. 23 */ 24void andes_clear_page(void * page) 25{ 26 __asm__ __volatile__( 27 ".set\tnoreorder\n\t" 28 ".set\tnoat\n\t" 29 "daddiu\t$1,%0,%2\n" 30 "1:\tpref 7,512(%0)\n\t" 31 "sd\t$0,(%0)\n\t" 32 "sd\t$0,8(%0)\n\t" 33 "sd\t$0,16(%0)\n\t" 34 "sd\t$0,24(%0)\n\t" 35 "daddiu\t%0,64\n\t" 36 "sd\t$0,-32(%0)\n\t" 37 "sd\t$0,-24(%0)\n\t" 38 "sd\t$0,-16(%0)\n\t" 39 "bne\t$1,%0,1b\n\t" 40 "sd\t$0,-8(%0)\n\t" 41 ".set\tat\n\t" 42 ".set\treorder" 43 : "=r" (page) 44 : "0" (page), "I" (PAGE_SIZE) 45 : "memory"); 46} 47 48/* R10000 has no Create_Dirty type cacheops. */ 49void andes_copy_page(void * to, void * from) 50{ 51 unsigned long dummy1, dummy2, reg1, reg2, reg3, reg4; 52 53 __asm__ __volatile__( 54 ".set\tnoreorder\n\t" 55 ".set\tnoat\n\t" 56 "daddiu\t$1,%0,%8\n" 57 "1:\tpref\t0,2*128(%1)\n\t" 58 "pref\t1,2*128(%0)\n\t" 59 "ld\t%2,(%1)\n\t" 60 "ld\t%3,8(%1)\n\t" 61 "ld\t%4,16(%1)\n\t" 62 "ld\t%5,24(%1)\n\t" 63 "sd\t%2,(%0)\n\t" 64 "sd\t%3,8(%0)\n\t" 65 "sd\t%4,16(%0)\n\t" 66 "sd\t%5,24(%0)\n\t" 67 "daddiu\t%0,64\n\t" 68 "daddiu\t%1,64\n\t" 69 "ld\t%2,-32(%1)\n\t" 70 "ld\t%3,-24(%1)\n\t" 71 "ld\t%4,-16(%1)\n\t" 72 "ld\t%5,-8(%1)\n\t" 73 "sd\t%2,-32(%0)\n\t" 74 "sd\t%3,-24(%0)\n\t" 75 "sd\t%4,-16(%0)\n\t" 76 "bne\t$1,%0,1b\n\t" 77 " sd\t%5,-8(%0)\n\t" 78 ".set\tat\n\t" 79 ".set\treorder" 80 :"=r" (dummy1), "=r" (dummy2), "=&r" (reg1), "=&r" (reg2), 81 "=&r" (reg3), "=&r" (reg4) 82 :"0" (to), "1" (from), "I" (PAGE_SIZE)); 83} 84