diff options
author | Kyle McMartin <kyle@treachery.i.cabal.ca> | 2008-12-22 12:29:02 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@mcmartin.ca> | 2009-01-05 13:15:25 -0500 |
commit | a60715f58907d4e1db7be6c31fa050c993e119b5 (patch) | |
tree | 3f625f4fd943d9f11e44abd55ff78b2d59b01d2d /arch/parisc | |
parent | 0ca5506da6795ebc700fd41cef2a7785613fbe28 (diff) |
parisc: factor out sid to protid conversion
Create a new __space_to_prot inline to convert the space id (mmu context)
to a protection id. Sadly it doesn't look like the #ifdef can be eliminated
since relying on the compiler to not truncate a bit on
return (ctx >> SPACEID_SHIFT) << 1;
seems a little dodgy.
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/include/asm/mmu_context.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h index 85856c74ad1d..93028975e2cf 100644 --- a/arch/parisc/include/asm/mmu_context.h +++ b/arch/parisc/include/asm/mmu_context.h | |||
@@ -34,16 +34,21 @@ destroy_context(struct mm_struct *mm) | |||
34 | mm->context = 0; | 34 | mm->context = 0; |
35 | } | 35 | } |
36 | 36 | ||
37 | static inline void load_context(mm_context_t context) | 37 | static inline unsigned long __space_to_prot(mm_context_t ctx) |
38 | { | 38 | { |
39 | mtsp(context, 3); | ||
40 | #if SPACEID_SHIFT == 0 | 39 | #if SPACEID_SHIFT == 0 |
41 | mtctl(context << 1,8); | 40 | return context << 1; |
42 | #else | 41 | #else |
43 | mtctl(context >> (SPACEID_SHIFT - 1),8); | 42 | return context >> (SPACEID_SHIFT - 1); |
44 | #endif | 43 | #endif |
45 | } | 44 | } |
46 | 45 | ||
46 | static inline void load_context(mm_context_t context) | ||
47 | { | ||
48 | mtsp(context, 3); | ||
49 | mtctl(__space_to_prot(context), 8); | ||
50 | } | ||
51 | |||
47 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) | 52 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) |
48 | { | 53 | { |
49 | 54 | ||