arm archtecture

arm archtecture

 

ARMv8 架构与指令集.学习笔记

https://www.cnblogs.com/lvdongjie/p/6644821.html

arm registers

https://developer.arm.com/documentation/ddi0500/e/debug/memory-mapped-register-summary

stage 1 and stage2 address translation

https://yomostatic.oss-cn-shenzhen.aliyuncs.com/courses/10_arm_virtualization/chapter_4_Deep_in_Arm_Virtualization.pdf

 

linux kernel读写arm64系统寄存器

read_sysreg(r)

write_sysreg(v, r)

 

Introducing Cortex-A35: ARM's Most Efficient Application Processor(ARM technology blog)

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/introducing-cortex-a35-arm-s-most-efficient-application-processor

 

PSTATE.M[3:0]

PSTATE.M[3:0] is AArch64 Exception level and selected Stack Pointer.

  • M[3:2] is set to the value of PSTATE.EL on taking an exception to EL3 and copied to PSTATE.EL on executing an exception return operation in EL3.
  • M[1] is unused and is 0 for all non-reserved values.
  • M[0] is set to the value of PSTATE.SP on taking an exception to EL3 and copied to PSTATE.SP on executing an exception return operation in EL3.
/*
 * PSR bits
 */
#define PSR_MODE_EL0t    0x00000000
#define PSR_MODE_EL1t    0x00000004
#define PSR_MODE_EL1h    0x00000005
#define PSR_MODE_EL2t    0x00000008
#define PSR_MODE_EL2h    0x00000009
#define PSR_MODE_EL3t    0x0000000c
#define PSR_MODE_EL3h    0x0000000d
#define PSR_MODE_MASK    0x0000000f

 

    • The t suffix indicates that the SP_EL0 stack pointer is selected.
    • The h suffix indicates that the SP_ELn stack pointer is selected.
      在这里插入图片描述

所以在用user_mode()判断当前是否是在user space exception level时,如果pstate[3:0]的值是PSR_MODE_EL0t时,表示是user space exception level:

#define user_mode(regs)    \
    (((regs)->pstate & PSR_MODE_MASK) == PSR_MODE_EL0t)

 

posted @ 2021-09-30 14:12  aspirs  阅读(148)  评论(0编辑  收藏  举报