68#define DSB __asm__ volatile("dsb" ::: "memory")
69#define DMB __asm__ volatile("dmb" ::: "memory")
70#define ISB __asm__ volatile("isb" ::: "memory")
71#define WFI __asm__ volatile("wfi" ::: "memory")
72#define BARRIER __asm__ volatile("":::"memory")
73#define WFE __asm__ volatile("wfe" ::: "memory")
74#define SEV __asm__ volatile("sev" ::: "memory")
76#define ARM_SYSREG_READ(REG) \
79 __asm__ volatile("mrc " REG : "=r" (_val)); \
83#define ARM_SYSREG_WRITE(REG, val) \
85 __asm__ volatile("mcr " REG :: "r" (val)); \
89#define ARM_SYSREG64_READ(REG) \
92 __asm__ volatile("mrrc " REG : "=r" (_val)); \
96#define ARM_SYSREG64_WRITE(REG, val) \
98 __asm__ volatile("mcrr " REG :: "r" (val)); \
102#define CP14_REG(CRn, Op1, CRm, Op2) "p14, "#Op1", %0, "#CRn","#CRm","#Op2
103#define CP15_REG(CRn, Op1, CRm, Op2) "p15, "#Op1", %0, "#CRn","#CRm","#Op2
104#define CP15_REG64(CRn, Op1) "p15, "#Op1", %0, %H0,"#CRn
109#define MIDR CP15_REG(c0, 0, c0, 0)
110#define MPIDR CP15_REG(c0, 0, c0, 5)
111#define CCSIDR CP15_REG(c0, 1, c0, 0)
112#define CLIDR CP15_REG(c0, 1, c0, 1)
113#define VPIDR CP15_REG(c0, 4, c0, 0)
114#define VMPIDR CP15_REG(c0, 4, c0, 5)
119#define SCTLR CP15_REG(c1, 0, c0, 0)
120#define ACTLR CP15_REG(c1, 0, c0, 1)
121#define CPACR CP15_REG(c1, 0, c0, 2)
126#define TTBR0 CP15_REG(c2, 0, c0, 0)
127#define TTBR1 CP15_REG(c2, 0, c0, 1)
128#define TTBCR CP15_REG(c2, 0, c0, 2)
129#define DACR CP15_REG(c3, 0, c0, 0)
134#define DFSR CP15_REG(c5, 0, c0, 0)
135#define IFSR CP15_REG(c5, 0, c0, 1)
136#define DFAR CP15_REG(c6, 0, c0, 0)
137#define IFAR CP15_REG(c6, 0, c0, 2)
142#define FCSEIDR CP15_REG(c13, 0, c0, 0)
143#define CONTEXTIDR CP15_REG(c13, 0, c0, 1)
144#define TPIDRURW CP15_REG(c13, 0, c0, 2)
145#define TPIDRURO CP15_REG(c13, 0, c0, 3)
146#define TPIDRPRW CP15_REG(c13, 0, c0, 4)
148#define MPIDR_CPUID_MASK (0xffU)
152 return (VOID *)(
UINTPTR)ARM_SYSREG_READ(TPIDRPRW);
162 ARM_SYSREG_WRITE(TPIDRURO, (
UINT32)val);
170#ifdef LOSCFG_KERNEL_SMP
171 return ARM_SYSREG_READ(MPIDR) & MPIDR_CPUID_MASK;
179 return ARM_SYSREG_READ(MPIDR);
184 return ARM_SYSREG_READ(MIDR);
188#if LOSCFG_ARM_ARCH >= 6
193 __asm__ __volatile__(
205 __asm__ __volatile__(
216 __asm__ __volatile__(
225 __asm__ __volatile__(
237 __asm__ __volatile__(
239 "orr %1, %0, #0xc0 \n"
241 :
"=r"(intSave),
"=r"(temp)
249 __asm__ __volatile__(
251 "bic %0, %0, #0xc0 \n"
262 __asm__ __volatile__(
269#define PSR_I_BIT 0x00000080U
281 return intSave & PSR_I_BIT;
287 __asm__ __volatile__(
"mov %0, sp" :
"=r"(val));
STATIC INLINE VOID ArchIrqDisable(VOID)
STATIC INLINE UINT32 ArchSPGet(VOID)
STATIC INLINE VOID ArchCurrUserTaskSet(UINTPTR val)
向协处理器写入用户态任务ID TPIDRURO 仅用于用户态
STATIC INLINE UINT32 OsMainIDGet(VOID)
获取CPU型号,包含CPU各种信息,例如:[15:4]表示 arm 7或arm 9
STATIC INLINE UINT32 OsIntLocked(VOID)
关闭当前处理器所有中断响应
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
STATIC INLINE UINT32 ArchIntUnlock(VOID)
打开当前处理器所有中断响应
STATIC INLINE VOID * ArchCurrTaskGet(VOID)
获取当前task的地址
STATIC INLINE VOID ArchIntRestore(UINT32 intSave)
恢复到使用LOS_IntLock关闭所有中断之前的状态
STATIC INLINE VOID ArchIrqEnable(VOID)
STATIC INLINE UINT32 ArchIntLock(VOID)
禁止中断
STATIC INLINE VOID ArchCurrTaskSet(VOID *val)
向CP15 - > C13 保存当前任务的地址
STATIC INLINE UINT64 OsHwIDGet(VOID)
获取CPU硬件ID,每个CPU都有自己的唯一标识