aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/mmu_context.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-arm/mmu_context.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-arm/mmu_context.h')
-rw-r--r--include/asm-arm/mmu_context.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
new file mode 100644
index 000000000000..4af9c411c617
--- /dev/null
+++ b/include/asm-arm/mmu_context.h
@@ -0,0 +1,96 @@
1/*
2 * linux/include/asm-arm/mmu_context.h
3 *
4 * Copyright (C) 1996 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 27-06-1996 RMK Created
12 */
13#ifndef __ASM_ARM_MMU_CONTEXT_H
14#define __ASM_ARM_MMU_CONTEXT_H
15
16#include <asm/proc-fns.h>
17
18#if __LINUX_ARM_ARCH__ >= 6
19
20/*
21 * On ARMv6, we have the following structure in the Context ID:
22 *
23 * 31 7 0
24 * +-------------------------+-----------+
25 * | process ID | ASID |
26 * +-------------------------+-----------+
27 * | context ID |
28 * +-------------------------------------+
29 *
30 * The ASID is used to tag entries in the CPU caches and TLBs.
31 * The context ID is used by debuggers and trace logic, and
32 * should be unique within all running processes.
33 */
34#define ASID_BITS 8
35#define ASID_MASK ((~0) << ASID_BITS)
36
37extern unsigned int cpu_last_asid;
38
39void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
40void __new_context(struct mm_struct *mm);
41
42static inline void check_context(struct mm_struct *mm)
43{
44 if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
45 __new_context(mm);
46}
47
48#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
49
50#else
51
52#define check_context(mm) do { } while (0)
53#define init_new_context(tsk,mm) 0
54
55#endif
56
57#define destroy_context(mm) do { } while(0)
58
59/*
60 * This is called when "tsk" is about to enter lazy TLB mode.
61 *
62 * mm: describes the currently active mm context
63 * tsk: task which is entering lazy tlb
64 * cpu: cpu number which is entering lazy tlb
65 *
66 * tsk->mm will be NULL
67 */
68static inline void
69enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
70{
71}
72
73/*
74 * This is the actual mm switch as far as the scheduler
75 * is concerned. No registers are touched. We avoid
76 * calling the CPU specific function when the mm hasn't
77 * actually changed.
78 */
79static inline void
80switch_mm(struct mm_struct *prev, struct mm_struct *next,
81 struct task_struct *tsk)
82{
83 unsigned int cpu = smp_processor_id();
84
85 if (prev != next) {
86 cpu_set(cpu, next->cpu_vm_mask);
87 check_context(next);
88 cpu_switch_mm(next->pgd, next);
89 cpu_clear(cpu, prev->cpu_vm_mask);
90 }
91}
92
93#define deactivate_mm(tsk,mm) do { } while (0)
94#define activate_mm(prev,next) switch_mm(prev, next, NULL)
95
96#endif