xref: /minix3/minix/kernel/arch/earm/include/archconst.h (revision 2a4046681ace62ad0c38bcc11c47f796c74ca4c6)
1 
2 #ifndef _ARM_ACONST_H
3 #define _ARM_ACONST_H
4 
5 #include <machine/interrupt.h>
6 #include <machine/memory.h>
7 #include <machine/cpu.h>
8 #include <arm/armreg.h>
9 
10 /* Program stack words and masks. */
11 #define INIT_PSR      (PSR_USR32_MODE | PSR_F)    /* initial psr */
12 #define INIT_TASK_PSR (PSR_SVC32_MODE | PSR_F)    /* initial psr for tasks */
13 
14 /* Exception vector numbers */
15 #define RESET_VECTOR                  0
16 #define UNDEFINED_INST_VECTOR         1
17 #define SUPERVISOR_CALL_VECTOR        2
18 #define PREFETCH_ABORT_VECTOR         3
19 #define DATA_ABORT_VECTOR             4
20 #define HYPERVISOR_CALL_VECTOR        5
21 #define INTERRUPT_VECTOR              6
22 #define FAST_INTERRUPT_VECTOR         7
23 
24 /* Data abort helper */
25 #define is_align_fault(fault_status) \
26 	((fault_status) == FAULT_ALIGN_0)
27 
28 #define is_trans_fault(fault_status) \
29 	(((fault_status) == FAULT_TRANS_S) || ((fault_status) == FAULT_TRANS_P))
30 
31 #define is_perm_fault(fault_status) \
32 	(((fault_status) == FAULT_PERM_S) || ((fault_status) == FAULT_PERM_P))
33 
34 /*
35  * defines how many bytes are reserved at the top of the kernel stack for global
36  * information like currently scheduled process or current cpu id
37  */
38 #define ARM_STACK_TOP_RESERVED	(2 * sizeof(reg_t))
39 
40 /* only selected bits are changeable by user e.g.[31:9] and skip the
41  * mode bits. It is probably is a better idea to look at the current
42  * status to determine if one is allowed to write these values. This
43  * might allow debugging of privileged processes
44  */
45 #define SET_USR_PSR(rp, npsr) \
46 	rp->p_reg.psr = ( rp->p_reg.psr & 0x1F) | ( npsr & ~0x1F)
47 
48 
49 #define PG_ALLOCATEME ((phys_bytes)-1)
50 
51 #endif /* _ARM_ACONST_H */
52