Rev 4339 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4339 | Rev 4345 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | * @return Value stored in CP15 fault status register (FSR). |
47 | * @return Value stored in CP15 fault status register (FSR). |
48 | */ |
48 | */ |
49 | static inline fault_status_t read_fault_status_register(void) |
49 | static inline fault_status_t read_fault_status_register(void) |
50 | { |
50 | { |
51 | fault_status_union_t fsu; |
51 | fault_status_union_t fsu; |
52 | 52 | ||
53 | /* fault status is stored in CP15 register 5 */ |
53 | /* fault status is stored in CP15 register 5 */ |
54 | asm volatile ( |
54 | asm volatile ( |
55 | "mrc p15, 0, %0, c5, c0, 0" |
55 | "mrc p15, 0, %[dummy], c5, c0, 0" |
56 | : "=r"(fsu.dummy) |
56 | : [dummy] "=r" (fsu.dummy) |
57 | ); |
57 | ); |
- | 58 | ||
58 | return fsu.fs; |
59 | return fsu.fs; |
59 | } |
60 | } |
60 | 61 | ||
61 | /** Returns FAR (fault address register) content. |
62 | /** Returns FAR (fault address register) content. |
62 | * |
63 | * |
63 | * @return FAR (fault address register) content (address that caused a page |
64 | * @return FAR (fault address register) content (address that caused a page |
64 | * fault) |
65 | * fault) |
65 | */ |
66 | */ |
66 | static inline uintptr_t read_fault_address_register(void) |
67 | static inline uintptr_t read_fault_address_register(void) |
67 | { |
68 | { |
68 | uintptr_t ret; |
69 | uintptr_t ret; |
69 | 70 | ||
70 | /* fault adress is stored in CP15 register 6 */ |
71 | /* fault adress is stored in CP15 register 6 */ |
71 | asm volatile ( |
72 | asm volatile ( |
72 | "mrc p15, 0, %0, c6, c0, 0" |
73 | "mrc p15, 0, %[ret], c6, c0, 0" |
73 | : "=r"(ret) |
74 | : [ret] "=r" (ret) |
74 | ); |
75 | ); |
- | 76 | ||
75 | return ret; |
77 | return ret; |
76 | } |
78 | } |
77 | 79 | ||
78 | /** Decides whether the instruction is load/store or not. |
80 | /** Decides whether the instruction is load/store or not. |
79 | * |
81 | * |
80 | * @param instr Instruction |
82 | * @param instr Instruction |
81 | * |
83 | * |
82 | * @return true when instruction is load/store, false otherwise |
84 | * @return true when instruction is load/store, false otherwise |
- | 85 | * |
|
83 | */ |
86 | */ |
84 | static inline bool is_load_store_instruction(instruction_t instr) |
87 | static inline bool is_load_store_instruction(instruction_t instr) |
85 | { |
88 | { |
86 | /* load store immediate offset */ |
89 | /* load store immediate offset */ |
87 | if (instr.type == 0x2) { |
90 | if (instr.type == 0x2) |
88 | return true; |
91 | return true; |
89 | } |
92 | |
90 | - | ||
91 | /* load store register offset */ |
93 | /* load store register offset */ |
92 | if (instr.type == 0x3 && instr.bit4 == 0) { |
94 | if ((instr.type == 0x3) && (instr.bit4 == 0)) |
93 | return true; |
95 | return true; |
94 | } |
96 | |
95 | - | ||
96 | /* load store multiple */ |
97 | /* load store multiple */ |
97 | if (instr.type == 0x4) { |
98 | if (instr.type == 0x4) |
98 | return true; |
99 | return true; |
99 | } |
100 | |
100 | - | ||
101 | /* oprocessor load/store */ |
101 | /* oprocessor load/store */ |
102 | if (instr.type == 0x6) { |
102 | if (instr.type == 0x6) |
103 | return true; |
103 | return true; |
104 | } |
104 | |
105 | - | ||
106 | return false; |
105 | return false; |
107 | } |
106 | } |
108 | 107 | ||
109 | /** Decides whether the instruction is swap or not. |
108 | /** Decides whether the instruction is swap or not. |
110 | * |
109 | * |
Line 113... | Line 112... | ||
113 | * @return true when instruction is swap, false otherwise |
112 | * @return true when instruction is swap, false otherwise |
114 | */ |
113 | */ |
115 | static inline bool is_swap_instruction(instruction_t instr) |
114 | static inline bool is_swap_instruction(instruction_t instr) |
116 | { |
115 | { |
117 | /* swap, swapb instruction */ |
116 | /* swap, swapb instruction */ |
118 | if (instr.type == 0x0 && |
117 | if ((instr.type == 0x0) && |
119 | (instr.opcode == 0x8 || instr.opcode == 0xa) && |
118 | ((instr.opcode == 0x8) || (instr.opcode == 0xa)) && |
120 | instr.access == 0x0 && instr.bits567 == 0x4 && instr.bit4 == 1) { |
119 | (instr.access == 0x0) && (instr.bits567 == 0x4) && (instr.bit4 == 1)) |
121 | return true; |
120 | return true; |
122 | } |
121 | |
123 | - | ||
124 | return false; |
122 | return false; |
125 | } |
123 | } |
126 | 124 | ||
127 | /** Decides whether read or write into memory is requested. |
125 | /** Decides whether read or write into memory is requested. |
128 | * |
126 | * |