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