summaryrefslogtreecommitdiffstats
path: root/arch/alpha/mm/fault.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
commitc7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch)
tree3682407a599b8f9f03fc096298134cafba1c9b2f /arch/alpha/mm/fault.c
parent1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff)
o Merge with Linux 2.1.116.
o New Newport console code. o New G364 console code.
Diffstat (limited to 'arch/alpha/mm/fault.c')
-rw-r--r--arch/alpha/mm/fault.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index 603b33149..f3a923064 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -4,23 +4,30 @@
* Copyright (C) 1995 Linus Torvalds
*/
-#include <linux/signal.h>
#include <linux/sched.h>
-#include <linux/head.h>
#include <linux/kernel.h>
+#include <linux/mm.h>
+
+#define __EXTERN_INLINE inline
+#include <asm/mmu_context.h>
+#include <asm/pgtable.h>
+#undef __EXTERN_INLINE
+
+#include <linux/signal.h>
+#include <linux/head.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/ptrace.h>
#include <linux/mman.h>
-#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/mmu_context.h>
+
+extern void die_if_kernel(char *,struct pt_regs *,long, unsigned long *);
+
#ifdef __SMP__
unsigned long last_asn[NR_CPUS] = { /* gag */
@@ -61,21 +68,26 @@ unsigned long last_asn[NR_CPUS] = { /* gag */
unsigned long asn_cache = ASN_FIRST_VERSION;
#endif /* __SMP__ */
-#ifndef BROKEN_ASN
/*
- * Select a new ASN and reload the context. This is
- * not inlined as this expands to a pretty large
- * function.
+ * Select a new ASN for a task.
*/
-void get_new_asn_and_reload(struct task_struct *tsk, struct mm_struct *mm)
+
+void
+get_new_mmu_context(struct task_struct *p, struct mm_struct *mm)
{
- mm->context = 0;
- get_new_mmu_context(tsk, mm);
- reload_context(tsk);
-}
-#endif
+ unsigned long asn = asn_cache;
-extern void die_if_kernel(char *,struct pt_regs *,long, unsigned long *);
+ if ((asn & HARDWARE_ASN_MASK) < MAX_ASN)
+ ++asn;
+ else {
+ tbiap();
+ imb();
+ asn = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION;
+ }
+ asn_cache = asn;
+ mm->context = asn; /* full version + asn */
+ p->tss.asn = asn & HARDWARE_ASN_MASK; /* just asn */
+}
/*
* This routine handles page faults. It determines the address,
@@ -99,23 +111,24 @@ extern void die_if_kernel(char *,struct pt_regs *,long, unsigned long *);
*/
/* Macro for exception fixup code to access integer registers. */
-#define dpf_reg(r) \
- (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \
+#define dpf_reg(r) \
+ (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \
(r) <= 18 ? (r)+8 : (r)-10])
-asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
- long cause, struct pt_regs *regs)
+asmlinkage void
+do_page_fault(unsigned long address, unsigned long mmcsr,
+ long cause, struct pt_regs *regs)
{
struct vm_area_struct * vma;
struct mm_struct *mm = current->mm;
unsigned fixup;
/* As of EV6, a load into $31/$f31 is a prefetch, and never faults
- (or is suppressed by the PALcode). Support that for older cpu's
+ (or is suppressed by the PALcode). Support that for older CPUs
by ignoring such an instruction. */
if (cause == 0) {
- /* No need for get_user.. we know the insn is there. */
- unsigned int insn = *(unsigned int *)regs->pc;
+ unsigned int insn;
+ __get_user(insn, (unsigned int *)regs->pc);
if ((insn >> 21 & 0x1f) == 0x1f &&
/* ldq ldl ldt lds ldg ldf ldwu ldbu */
(1ul << (insn >> 26) & 0x30f00001400ul)) {
@@ -124,8 +137,8 @@ asmlinkage void do_page_fault(unsigned long address, unsigned long mmcsr,
}
}
- lock_kernel();
down(&mm->mmap_sem);
+ lock_kernel();
vma = find_vma(mm, address);
if (!vma)
goto bad_area;