pg-r3k.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
- /*
- * Copyright (C) 2001 Ralf Baechle (ralf@gnu.org)
- */
- #include <linux/sched.h>
- #include <linux/mm.h>
- /* page functions */
- void r3k_clear_page(void * page)
- {
- __asm__ __volatile__(
- ".settnoreordernt"
- ".settnoatnt"
- "addiut$1,%0,%2n"
- "1:tswt$0,(%0)nt"
- "swt$0,4(%0)nt"
- "swt$0,8(%0)nt"
- "swt$0,12(%0)nt"
- "addiut%0,32nt"
- "swt$0,-16(%0)nt"
- "swt$0,-12(%0)nt"
- "swt$0,-8(%0)nt"
- "bnet$1,%0,1bnt"
- "swt$0,-4(%0)nt"
- ".settatnt"
- ".settreorder"
- : "=r" (page)
- : "0" (page), "I" (PAGE_SIZE)
- : "memory");
- }
- void r3k_copy_page(void * to, void * from)
- {
- unsigned long dummy1, dummy2;
- unsigned long reg1, reg2, reg3, reg4;
- __asm__ __volatile__(
- ".settnoreordernt"
- ".settnoatnt"
- "addiut$1,%0,%8n"
- "1:tlwt%2,(%1)nt"
- "lwt%3,4(%1)nt"
- "lwt%4,8(%1)nt"
- "lwt%5,12(%1)nt"
- "swt%2,(%0)nt"
- "swt%3,4(%0)nt"
- "swt%4,8(%0)nt"
- "swt%5,12(%0)nt"
- "lwt%2,16(%1)nt"
- "lwt%3,20(%1)nt"
- "lwt%4,24(%1)nt"
- "lwt%5,28(%1)nt"
- "swt%2,16(%0)nt"
- "swt%3,20(%0)nt"
- "swt%4,24(%0)nt"
- "swt%5,28(%0)nt"
- "addiut%0,64nt"
- "addiut%1,64nt"
- "lwt%2,-32(%1)nt"
- "lwt%3,-28(%1)nt"
- "lwt%4,-24(%1)nt"
- "lwt%5,-20(%1)nt"
- "swt%2,-32(%0)nt"
- "swt%3,-28(%0)nt"
- "swt%4,-24(%0)nt"
- "swt%5,-20(%0)nt"
- "lwt%2,-16(%1)nt"
- "lwt%3,-12(%1)nt"
- "lwt%4,-8(%1)nt"
- "lwt%5,-4(%1)nt"
- "swt%2,-16(%0)nt"
- "swt%3,-12(%0)nt"
- "swt%4,-8(%0)nt"
- "bnet$1,%0,1bnt"
- "swt%5,-4(%0)nt"
- ".settatnt"
- ".settreorder"
- : "=r" (dummy1), "=r" (dummy2),
- "=&r" (reg1), "=&r" (reg2), "=&r" (reg3), "=&r" (reg4)
- : "0" (to), "1" (from),
- "I" (PAGE_SIZE));
- }
- /*
- * Initialize new page directory with pointers to invalid ptes
- */
- void pgd_init(unsigned long page)
- {
- unsigned long dummy1, dummy2;
- /*
- * The plain and boring version for the R3000. No cache flushing
- * stuff is implemented since the R3000 has physical caches.
- */
- __asm__ __volatile__(
- ".settnoreordern"
- "1:tswt%2, (%0)nt"
- "swt%2, 4(%0)nt"
- "swt%2, 8(%0)nt"
- "swt%2, 12(%0)nt"
- "swt%2, 16(%0)nt"
- "swt%2, 20(%0)nt"
- "swt%2, 24(%0)nt"
- "swt%2, 28(%0)nt"
- "subut%1, 1nt"
- "bnezt%1, 1bnt"
- "addiut%0, 32nt"
- ".settreorder"
- :"=r" (dummy1), "=r" (dummy2)
- :"r" ((unsigned long) invalid_pte_table), "0" (page),
- "1" (USER_PTRS_PER_PGD / 8));
- }