Import changeset
[linux-flexiantxendom0-3.2.10.git] / arch / arm / mm / fault-armo.c
1 /*
2  *  linux/arch/arm/mm/fault-armo.c
3  *
4  *  Copyright (C) 1995  Linus Torvalds
5  *  Modifications for ARM processor (c) 1995-1999 Russell King
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 #include <linux/signal.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/errno.h>
15 #include <linux/string.h>
16 #include <linux/types.h>
17 #include <linux/ptrace.h>
18 #include <linux/mman.h>
19 #include <linux/mm.h>
20 #include <linux/interrupt.h>
21
22 #include <asm/system.h>
23 #include <asm/uaccess.h>
24 #include <asm/pgtable.h>
25
26 #define FAULT_CODE_FORCECOW     0x80
27 #define FAULT_CODE_PREFETCH     0x04
28 #define FAULT_CODE_WRITE        0x02
29
30 #define DO_COW(m)               ((m) & (FAULT_CODE_WRITE|FAULT_CODE_FORCECOW))
31 #define READ_FAULT(m)           (!((m) & FAULT_CODE_WRITE))
32
33 #include "fault-common.c"
34
35 /*
36  * Handle a data abort.  Note that we have to handle a range of addresses
37  * on ARM2/3 for ldm.  If both pages are zero-mapped, then we have to force
38  * a copy-on-write.  However, on the second page, we always force COW.
39  */
40 asmlinkage void
41 do_DataAbort(unsigned long min_addr, unsigned long max_addr, int mode, struct pt_regs *regs)
42 {
43         do_page_fault(min_addr, mode, regs);
44
45         if ((min_addr ^ max_addr) >> PAGE_SHIFT)
46                 do_page_fault(max_addr, mode | FAULT_CODE_FORCECOW, regs);
47 }
48
49 asmlinkage int
50 do_PrefetchAbort(unsigned long addr, struct pt_regs *regs)
51 {
52 #if 0
53         if (the memc mapping for this page exists) {
54                 printk ("Page in, but got abort (undefined instruction?)\n");
55                 return 0;
56         }
57 #endif
58         do_page_fault(addr, FAULT_CODE_PREFETCH, regs);
59         return 1;
60 }