diff options
Diffstat (limited to 'include/asm-sparc64/mmu_context.h')
-rw-r--r-- | include/asm-sparc64/mmu_context.h | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index 34640a370ab4..0dffb4ce8a1d 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h | |||
@@ -19,36 +19,8 @@ extern unsigned long tlb_context_cache; | |||
19 | extern unsigned long mmu_context_bmap[]; | 19 | extern unsigned long mmu_context_bmap[]; |
20 | 20 | ||
21 | extern void get_new_mmu_context(struct mm_struct *mm); | 21 | extern void get_new_mmu_context(struct mm_struct *mm); |
22 | 22 | extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); | |
23 | /* Initialize a new mmu context. This is invoked when a new | 23 | extern void destroy_context(struct mm_struct *mm); |
24 | * address space instance (unique or shared) is instantiated. | ||
25 | * This just needs to set mm->context to an invalid context. | ||
26 | */ | ||
27 | #define init_new_context(__tsk, __mm) \ | ||
28 | ({ unsigned long __pg = get_zeroed_page(GFP_KERNEL); \ | ||
29 | (__mm)->context.sparc64_ctx_val = 0UL; \ | ||
30 | (__mm)->context.sparc64_tsb = \ | ||
31 | (unsigned long *) __pg; \ | ||
32 | (__pg ? 0 : -ENOMEM); \ | ||
33 | }) | ||
34 | |||
35 | |||
36 | /* Destroy a dead context. This occurs when mmput drops the | ||
37 | * mm_users count to zero, the mmaps have been released, and | ||
38 | * all the page tables have been flushed. Our job is to destroy | ||
39 | * any remaining processor-specific state, and in the sparc64 | ||
40 | * case this just means freeing up the mmu context ID held by | ||
41 | * this task if valid. | ||
42 | */ | ||
43 | #define destroy_context(__mm) \ | ||
44 | do { free_page((unsigned long)(__mm)->context.sparc64_tsb); \ | ||
45 | spin_lock(&ctx_alloc_lock); \ | ||
46 | if (CTX_VALID((__mm)->context)) { \ | ||
47 | unsigned long nr = CTX_NRBITS((__mm)->context); \ | ||
48 | mmu_context_bmap[nr>>6] &= ~(1UL << (nr & 63)); \ | ||
49 | } \ | ||
50 | spin_unlock(&ctx_alloc_lock); \ | ||
51 | } while(0) | ||
52 | 24 | ||
53 | extern unsigned long tsb_context_switch(unsigned long pgd_pa, unsigned long *tsb); | 25 | extern unsigned long tsb_context_switch(unsigned long pgd_pa, unsigned long *tsb); |
54 | 26 | ||