rust-embedded / rust-embedded/aarch64-cpu
Access to AArch32 view of AArch64 registers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 116
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
When running a AArch32 guest (EL1) under a AArch64 hypervisor (EL2) it is useful for the hypervisor to be able to access the registers of the guest, for example SPSR_hyp. Accessing these AArch32 registers directly via MRS is not possible from AArch64 code, so they can't be accessed using AArch32 libraries e.g. aarch32-cpu. Instead these registers are mapped to relevant AArch64 registers, like the low 32-bits of SPSR_EL2 in this case.
In these situations the fields of the registers differ from the AArch64 fields, e.g bit 23 of SPSR_EL2 is UAO for AArch64, whereas in AArch32 this is the SSBS field. Currently accessing these fields with this library isn't possible.
I see a few ways to handle this:
1: Simply have all fields as part of the register definition, specify via comments that they are only valid for A64 / A32. (field names match the docs)
2: Same as 1 but use a prefix to differentiate (A32_SSBS / A64_UAO) (field names don't match docs). This is what I'm currently maintaining on a fork.
3: Have two copies of registers where this applies SPSR_EL2_A32 / SPSR_EL2_A64
I don't really have a preference but I'd like to see this use case be supported if possible.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining how aarch32-cpu defines AArch64 registers and fields, using SPSR_EL2 and the AArch32 SPSR_hyp mapping as the concrete case. Compare the three proposed representation approaches and determine how the chosen design should expose differing AArch32 and AArch64 fields; done means the relevant AArch32 fields can be accessed through the library without breaking existing AArch64 access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100