x86: implement gbpages support in change_page_attr()
[wrt350n-kernel.git] / include / asm-sh / mmu_context_64.h
blob020be744b088c0775f6c14e50e29889dbc580750
1 #ifndef __ASM_SH_MMU_CONTEXT_64_H
2 #define __ASM_SH_MMU_CONTEXT_64_H
4 /*
5 * sh64-specific mmu_context interface.
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 - 2007 Paul Mundt
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
14 #include <asm/cpu/registers.h>
15 #include <asm/cacheflush.h>
17 #define SR_ASID_MASK 0xffffffffff00ffffULL
18 #define SR_ASID_SHIFT 16
21 * Destroy context related info for an mm_struct that is about
22 * to be put to rest.
24 static inline void destroy_context(struct mm_struct *mm)
26 /* Well, at least free TLB entries */
27 flush_tlb_mm(mm);
30 static inline unsigned long get_asid(void)
32 unsigned long long sr;
34 asm volatile ("getcon " __SR ", %0\n\t"
35 : "=r" (sr));
37 sr = (sr >> SR_ASID_SHIFT) & MMU_CONTEXT_ASID_MASK;
38 return (unsigned long) sr;
41 /* Set ASID into SR */
42 static inline void set_asid(unsigned long asid)
44 unsigned long long sr, pc;
46 asm volatile ("getcon " __SR ", %0" : "=r" (sr));
48 sr = (sr & SR_ASID_MASK) | (asid << SR_ASID_SHIFT);
51 * It is possible that this function may be inlined and so to avoid
52 * the assembler reporting duplicate symbols we make use of the
53 * gas trick of generating symbols using numerics and forward
54 * reference.
56 asm volatile ("movi 1, %1\n\t"
57 "shlli %1, 28, %1\n\t"
58 "or %0, %1, %1\n\t"
59 "putcon %1, " __SR "\n\t"
60 "putcon %0, " __SSR "\n\t"
61 "movi 1f, %1\n\t"
62 "ori %1, 1 , %1\n\t"
63 "putcon %1, " __SPC "\n\t"
64 "rte\n"
65 "1:\n\t"
66 : "=r" (sr), "=r" (pc) : "0" (sr));
69 /* No spare register to twiddle, so use a software cache */
70 extern pgd_t *mmu_pdtp_cache;
72 #define set_TTB(pgd) (mmu_pdtp_cache = (pgd))
73 #define get_TTB() (mmu_pdtp_cache)
75 #endif /* __ASM_SH_MMU_CONTEXT_64_H */