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>
This commit is contained in:
Kyle McMartin 2008-12-22 12:29:02 -05:00 committed by Kyle McMartin
parent 0ca5506da6
commit a60715f589
1 changed files with 10 additions and 5 deletions

View File

@ -34,14 +34,19 @@ destroy_context(struct mm_struct *mm)
mm->context = 0;
}
static inline unsigned long __space_to_prot(mm_context_t ctx)
{
#if SPACEID_SHIFT == 0
return context << 1;
#else
return context >> (SPACEID_SHIFT - 1);
#endif
}
static inline void load_context(mm_context_t context)
{
mtsp(context, 3);
#if SPACEID_SHIFT == 0
mtctl(context << 1,8);
#else
mtctl(context >> (SPACEID_SHIFT - 1),8);
#endif
mtctl(__space_to_prot(context), 8);
}
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)