Skip to content

Commit

Permalink
parisc: factor out sid to protid conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kyle McMartin authored and Kyle McMartin committed Jan 5, 2009
1 parent 0ca5506 commit a60715f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arch/parisc/include/asm/mmu_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,21 @@ destroy_context(struct mm_struct *mm)
mm->context = 0;
}

static inline void load_context(mm_context_t context)
static inline unsigned long __space_to_prot(mm_context_t ctx)
{
mtsp(context, 3);
#if SPACEID_SHIFT == 0
mtctl(context << 1,8);
return context << 1;
#else
mtctl(context >> (SPACEID_SHIFT - 1),8);
return context >> (SPACEID_SHIFT - 1);
#endif
}

static inline void load_context(mm_context_t context)
{
mtsp(context, 3);
mtctl(__space_to_prot(context), 8);
}

static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk)
{

Expand Down

0 comments on commit a60715f

Please sign in to comment.