2005-04-16 15:20:36 -07:00
|
|
|
/*
|
2007-10-16 01:27:00 -07:00
|
|
|
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
2005-04-16 15:20:36 -07:00
|
|
|
* Licensed under the GPL
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __UM_MMU_CONTEXT_H
|
|
|
|
|
#define __UM_MMU_CONTEXT_H
|
|
|
|
|
|
2011-08-18 20:09:09 +01:00
|
|
|
#include <linux/sched.h>
|
|
|
|
|
#include <asm/mmu.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-02-23 01:37:19 -05:00
|
|
|
extern void uml_setup_stubs(struct mm_struct *mm);
|
2008-02-04 22:31:01 -08:00
|
|
|
extern void arch_exit_mmap(struct mm_struct *mm);
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#define deactivate_mm(tsk,mm) do { } while (0)
|
|
|
|
|
|
2005-07-12 13:58:22 -07:00
|
|
|
extern void force_flush_all(void);
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
|
|
|
|
|
{
|
2005-09-03 15:57:25 -07:00
|
|
|
/*
|
2008-06-06 11:31:39 -07:00
|
|
|
* This is called by fs/exec.c and sys_unshare()
|
|
|
|
|
* when the new ->mm is used for the first time.
|
2005-09-03 15:57:25 -07:00
|
|
|
*/
|
2008-06-06 11:31:39 -07:00
|
|
|
__switch_mm(&new->context.id);
|
2012-02-23 01:37:19 -05:00
|
|
|
down_write(&new->mmap_sem);
|
|
|
|
|
uml_setup_stubs(new);
|
|
|
|
|
up_write(&new->mmap_sem);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
|
|
|
|
|
struct task_struct *tsk)
|
|
|
|
|
{
|
|
|
|
|
unsigned cpu = smp_processor_id();
|
|
|
|
|
|
|
|
|
|
if(prev != next){
|
2009-09-24 09:34:51 -06:00
|
|
|
cpumask_clear_cpu(cpu, mm_cpumask(prev));
|
|
|
|
|
cpumask_set_cpu(cpu, mm_cpumask(next));
|
2005-04-16 15:20:36 -07:00
|
|
|
if(next != &init_mm)
|
2007-10-16 01:27:06 -07:00
|
|
|
__switch_mm(&next->context.id);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-23 01:37:19 -05:00
|
|
|
static inline void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm)
|
|
|
|
|
{
|
|
|
|
|
uml_setup_stubs(mm);
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
static inline void enter_lazy_tlb(struct mm_struct *mm,
|
|
|
|
|
struct task_struct *tsk)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-16 01:26:58 -07:00
|
|
|
extern int init_new_context(struct task_struct *task, struct mm_struct *mm);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2007-10-16 01:26:58 -07:00
|
|
|
extern void destroy_context(struct mm_struct *mm);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
#endif
|