Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73315
b: refs/heads/master
c: 465ccab
h: refs/heads/master
i:
  73313: 26890af
  73311: 8f434fe
v: v3
  • Loading branch information
will schmidt authored and Paul Mackerras committed Nov 8, 2007
1 parent 9879d71 commit a521788
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e7bda183d4e3f6027ae9181c176a459423d04748
refs/heads/master: 465ccab9eb8209a2a402710b24a9bff127b25b94
34 changes: 31 additions & 3 deletions trunk/arch/powerpc/mm/slb.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,35 @@ void slb_vmalloc_update(void)
slb_flush_and_rebolt();
}

/* Helper function to compare esids. There are four cases to handle.
* 1. The system is not 1T segment size capable. Use the GET_ESID compare.
* 2. The system is 1T capable, both addresses are < 1T, use the GET_ESID compare.
* 3. The system is 1T capable, only one of the two addresses is > 1T. This is not a match.
* 4. The system is 1T capable, both addresses are > 1T, use the GET_ESID_1T macro to compare.
*/
static inline int esids_match(unsigned long addr1, unsigned long addr2)
{
int esid_1t_count;

/* System is not 1T segment size capable. */
if (!cpu_has_feature(CPU_FTR_1T_SEGMENT))
return (GET_ESID(addr1) == GET_ESID(addr2));

esid_1t_count = (((addr1 >> SID_SHIFT_1T) != 0) +
((addr2 >> SID_SHIFT_1T) != 0));

/* both addresses are < 1T */
if (esid_1t_count == 0)
return (GET_ESID(addr1) == GET_ESID(addr2));

/* One address < 1T, the other > 1T. Not a match */
if (esid_1t_count == 1)
return 0;

/* Both addresses are > 1T. */
return (GET_ESID_1T(addr1) == GET_ESID_1T(addr2));
}

/* Flush all user entries from the segment table of the current processor. */
void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
{
Expand Down Expand Up @@ -194,15 +223,14 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
return;
slb_allocate(pc);

if (GET_ESID(pc) == GET_ESID(stack))
if (esids_match(pc,stack))
return;

if (is_kernel_addr(stack))
return;
slb_allocate(stack);

if ((GET_ESID(pc) == GET_ESID(unmapped_base))
|| (GET_ESID(stack) == GET_ESID(unmapped_base)))
if (esids_match(pc,unmapped_base) || esids_match(stack,unmapped_base))
return;

if (is_kernel_addr(unmapped_base))
Expand Down

0 comments on commit a521788

Please sign in to comment.