MCPcopy Create free account
hub / github.com/F-Stack/f-stack / undefinedinstruction

Function undefinedinstruction

freebsd/arm/arm/undefined.c:203–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203void
204undefinedinstruction(struct trapframe *frame)
205{
206 struct thread *td;
207 u_int fault_pc;
208 int fault_instruction;
209 int fault_code;
210 int coprocessor;
211 struct undefined_handler *uh;
212#ifdef VERBOSE_ARM32
213 int s;
214#endif
215 ksiginfo_t ksi;
216
217 /* Enable interrupts if they were enabled before the exception. */
218 if (__predict_true(frame->tf_spsr & PSR_I) == 0)
219 enable_interrupts(PSR_I);
220 if (__predict_true(frame->tf_spsr & PSR_F) == 0)
221 enable_interrupts(PSR_F);
222
223 VM_CNT_INC(v_trap);
224
225 fault_pc = frame->tf_pc;
226
227 /*
228 * Get the current thread/proc structure or thread0/proc0 if there is
229 * none.
230 */
231 td = curthread == NULL ? &thread0 : curthread;
232
233 coprocessor = 0;
234 if ((frame->tf_spsr & PSR_T) == 0) {
235 /*
236 * Make sure the program counter is correctly aligned so we
237 * don't take an alignment fault trying to read the opcode.
238 */
239 if (__predict_false((fault_pc & 3) != 0)) {
240 ksiginfo_init_trap(&ksi);
241 ksi.ksi_signo = SIGILL;
242 ksi.ksi_code = ILL_ILLADR;
243 ksi.ksi_addr = (u_int32_t *)(intptr_t) fault_pc;
244 trapsignal(td, &ksi);
245 userret(td, frame);
246 return;
247 }
248
249 /*
250 * Should use fuword() here .. but in the interests of
251 * squeezing every bit of speed we will just use ReadWord().
252 * We know the instruction can be read as was just executed
253 * so this will never fail unless the kernel is screwed up
254 * in which case it does not really matter does it ?
255 */
256
257 fault_instruction = *(u_int32_t *)fault_pc;
258
259 /* Check for coprocessor instruction */
260

Callers

nothing calls this directly

Calls 6

enable_interruptsFunction · 0.85
trapsignalFunction · 0.85
userretFunction · 0.85
kdb_trapFunction · 0.85
printfFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected