1 | /*
|
---|
2 | * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup arm32mm
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | * @brief Page fault related declarations.
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef KERN_arm32_PAGE_FAULT_H_
|
---|
37 | #define KERN_arm32_PAGE_FAULT_H_
|
---|
38 |
|
---|
39 | #include <typedefs.h>
|
---|
40 |
|
---|
41 |
|
---|
42 | /** Decribes CP15 "fault status register" (FSR).
|
---|
43 | *
|
---|
44 | * See ARM Architecture Reference Manual ch. B4.9.6 (pdf p.743).
|
---|
45 | */
|
---|
46 | typedef union {
|
---|
47 | struct {
|
---|
48 | unsigned status : 4;
|
---|
49 | unsigned domain : 4;
|
---|
50 | unsigned zero : 1;
|
---|
51 | unsigned lpae : 1; /**< Needs LPAE support implemented */
|
---|
52 | unsigned fs : 1; /**< armv6+ mandated, earlier IPLM. DEFINED */
|
---|
53 | unsigned wr : 1; /**< armv6+ only */
|
---|
54 | unsigned ext : 1 ; /**< external abort */
|
---|
55 | unsigned cm : 1; /**< Cache maintenance, needs LPAE support */
|
---|
56 | unsigned should_be_zero : 18;
|
---|
57 | } data;
|
---|
58 | struct {
|
---|
59 | unsigned status : 4;
|
---|
60 | unsigned sbz0 : 6;
|
---|
61 | unsigned fs : 1;
|
---|
62 | unsigned should_be_zero : 21;
|
---|
63 | } inst;
|
---|
64 | uint32_t raw;
|
---|
65 | } fault_status_t;
|
---|
66 |
|
---|
67 |
|
---|
68 | /** Simplified description of instruction code.
|
---|
69 | *
|
---|
70 | * @note Used for recognizing memory access instructions.
|
---|
71 | * @see ARM architecture reference (chapter 3.1)
|
---|
72 | */
|
---|
73 | typedef struct {
|
---|
74 | unsigned dummy1 : 4;
|
---|
75 | unsigned bit4 : 1;
|
---|
76 | unsigned bits567 : 3;
|
---|
77 | unsigned dummy : 12;
|
---|
78 | unsigned access : 1;
|
---|
79 | unsigned opcode : 4;
|
---|
80 | unsigned type : 3;
|
---|
81 | unsigned condition : 4;
|
---|
82 | } ATTRIBUTE_PACKED instruction_t;
|
---|
83 |
|
---|
84 |
|
---|
85 | /** Help union used for casting pc register (uint_32_t) value into
|
---|
86 | * #instruction_t pointer.
|
---|
87 | */
|
---|
88 | typedef union {
|
---|
89 | instruction_t *instr;
|
---|
90 | uint32_t pc;
|
---|
91 | } instruction_union_t;
|
---|
92 |
|
---|
93 | extern void prefetch_abort(unsigned int, istate_t *);
|
---|
94 | extern void data_abort(unsigned int, istate_t *);
|
---|
95 |
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | /** @}
|
---|
99 | */
|
---|