xref: /kvm-unit-tests/lib/arm/asm/processor.h (revision b13b47ed278645f3e9a88bc1487eb0bf3b10503e)
1 #ifndef _ASMARM_PROCESSOR_H_
2 #define _ASMARM_PROCESSOR_H_
3 /*
4  * Copyright (C) 2014, Red Hat Inc, Andrew Jones <drjones@redhat.com>
5  *
6  * This work is licensed under the terms of the GNU LGPL, version 2.
7  */
8 #include <asm/ptrace.h>
9 
10 enum vector {
11 	EXCPTN_RST,
12 	EXCPTN_UND,
13 	EXCPTN_SVC,
14 	EXCPTN_PABT,
15 	EXCPTN_DABT,
16 	EXCPTN_ADDREXCPTN,
17 	EXCPTN_IRQ,
18 	EXCPTN_FIQ,
19 	EXCPTN_MAX,
20 };
21 
22 typedef void (*exception_fn)(struct pt_regs *);
23 extern void install_exception_handler(enum vector v, exception_fn fn);
24 
25 extern void show_regs(struct pt_regs *regs);
26 
27 static inline unsigned long current_cpsr(void)
28 {
29 	unsigned long cpsr;
30 	asm volatile("mrs %0, cpsr" : "=r" (cpsr));
31 	return cpsr;
32 }
33 
34 #define current_mode() (current_cpsr() & MODE_MASK)
35 
36 extern void start_usr(void (*func)(void *arg), void *arg, unsigned long sp_usr);
37 
38 #endif /* _ASMARM_PROCESSOR_H_ */
39