1433d6423SLionel Sambuc 2433d6423SLionel Sambuc #ifndef _ARM_ACONST_H 3433d6423SLionel Sambuc #define _ARM_ACONST_H 4433d6423SLionel Sambuc 5433d6423SLionel Sambuc #include <machine/interrupt.h> 6433d6423SLionel Sambuc #include <machine/memory.h> 7433d6423SLionel Sambuc #include <machine/cpu.h> 8433d6423SLionel Sambuc #include <arm/armreg.h> 9433d6423SLionel Sambuc 10433d6423SLionel Sambuc /* Program stack words and masks. */ 11433d6423SLionel Sambuc #define INIT_PSR (PSR_USR32_MODE | PSR_F) /* initial psr */ 12433d6423SLionel Sambuc #define INIT_TASK_PSR (PSR_SVC32_MODE | PSR_F) /* initial psr for tasks */ 13433d6423SLionel Sambuc 14433d6423SLionel Sambuc /* Exception vector numbers */ 15433d6423SLionel Sambuc #define RESET_VECTOR 0 16433d6423SLionel Sambuc #define UNDEFINED_INST_VECTOR 1 17433d6423SLionel Sambuc #define SUPERVISOR_CALL_VECTOR 2 18433d6423SLionel Sambuc #define PREFETCH_ABORT_VECTOR 3 19433d6423SLionel Sambuc #define DATA_ABORT_VECTOR 4 20433d6423SLionel Sambuc #define HYPERVISOR_CALL_VECTOR 5 21433d6423SLionel Sambuc #define INTERRUPT_VECTOR 6 22433d6423SLionel Sambuc #define FAST_INTERRUPT_VECTOR 7 23433d6423SLionel Sambuc 24*0dd719f1SArne Welzel /* Data abort helper */ 25*0dd719f1SArne Welzel #define is_align_fault(fault_status) \ 26*0dd719f1SArne Welzel ((fault_status) == FAULT_ALIGN_0) 277c3424c2SArne Welzel 28*0dd719f1SArne Welzel #define is_trans_fault(fault_status) \ 29*0dd719f1SArne Welzel (((fault_status) == FAULT_TRANS_S) || ((fault_status) == FAULT_TRANS_P)) 307c3424c2SArne Welzel 31*0dd719f1SArne Welzel #define is_perm_fault(fault_status) \ 32*0dd719f1SArne Welzel (((fault_status) == FAULT_PERM_S) || ((fault_status) == FAULT_PERM_P)) 337c3424c2SArne Welzel 34433d6423SLionel Sambuc /* 35433d6423SLionel Sambuc * defines how many bytes are reserved at the top of the kernel stack for global 36433d6423SLionel Sambuc * information like currently scheduled process or current cpu id 37433d6423SLionel Sambuc */ 38433d6423SLionel Sambuc #define ARM_STACK_TOP_RESERVED (2 * sizeof(reg_t)) 39433d6423SLionel Sambuc 40433d6423SLionel Sambuc /* only selected bits are changeable by user e.g.[31:9] and skip the 41433d6423SLionel Sambuc * mode bits. It is probably is a better idea to look at the current 42433d6423SLionel Sambuc * status to determine if one is allowed to write these values. This 43433d6423SLionel Sambuc * might allow debugging of privileged processes 44433d6423SLionel Sambuc */ 45433d6423SLionel Sambuc #define SET_USR_PSR(rp, npsr) \ 46433d6423SLionel Sambuc rp->p_reg.psr = ( rp->p_reg.psr & 0x1F) | ( npsr & ~0x1F) 47433d6423SLionel Sambuc 48433d6423SLionel Sambuc 49433d6423SLionel Sambuc #define PG_ALLOCATEME ((phys_bytes)-1) 50433d6423SLionel Sambuc 51433d6423SLionel Sambuc #endif /* _ARM_ACONST_H */ 52