aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvetch <vetch97@gmail.com>2020-01-18 14:57:12 +0100
committervetch <vetch97@gmail.com>2020-01-18 14:57:12 +0100
commit5441ff0019b747e1206292ea8f91ddb06d17841d (patch)
tree148f823285c35a0d849c1f859033aeb183f2b901
parent795954eec24dbc77380e3136050c8f40c813491b (diff)
downloadrpi-MMU-example-5441ff0019b747e1206292ea8f91ddb06d17841d.tar.gz
rpi-MMU-example-5441ff0019b747e1206292ea8f91ddb06d17841d.zip
TODO find oprating state document, done PSR beside that i guess
-rw-r--r--PSRs-explained.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/PSRs-explained.txt b/PSRs-explained.txt
index 6d67423..a125add 100644
--- a/PSRs-explained.txt
+++ b/PSRs-explained.txt
@@ -1,10 +1,13 @@
-CPSR (Current Program Status Register) is a register, bits of which contain and/or determine various aspects of execution, i.e. condition flags, execution state (arm, thumb or jazelle), endianness state, execution mode <link to doc explaining modes> and interrupt mask. This register is readable and writeable with the use of mrs and msr instructions from any PL1 mode, thus it is possible to change things like mode or interrupt mask by writing to this register.
+## Program Status Register
+CPSR (Current Program Status Register) is a register, bits of which contain and/or determine various aspects of execution, i.e. condition flags, execution state (arm, thumb or jazelle), endianness state, [execution mode](./link_to_doc_explaining_modes) and interrupt mask. This register is readable and writeable with the use of mrs and msr instructions from any PL1 mode, thus it is possible to change things like mode or interrupt mask by writing to this register.
+
Additionally, there are other registers with the same or simillar bit fields as CPSR. Those PSRs (Program Status Registers) are:
-· APSR (Application Program Status Register)
-· SPSRs (Saved Program Status Registers)
+
+1. APSR (Application Program Status Register)
+2. SPSRs (Saved Program Status Registers)
APSR is can be considered the same as CPSR or a view of CPSR, with some limitations - some bit fields from CPSR are missing (reserved) in APSR. APSR can be accessed from PL0, while CPSR should only be accessed from PL1. This was an application program executing in user mode can learn some of the settings in CPSR without accessing CPSR directly.
-SPSR is used for exception handling. Each exception-taking mode has it's own SPSR (they can be called SPSR_sup, SPSR_irq, etc.). On exception entry, old contents of CPSR are backed up in entered mode's SPSR. Instructions used for exception return (subs and ldm ^), when writing to the pc, have the important additional effect of copying the SPSR to CPSR. This way, on return from an exception, processor returns to the state from before the exception (this includes endianness settings, execution state, etc.).
+SPSR is used for exception handling. Each exception-taking mode has it's own SPSR (they can be called SPSR_sup, SPSR_irq, etc.). On exception entry, old contents of CPSR are backed up in entered mode's SPSR. Instructions used for exception return (subs and ldm ^), when writing to the pc, have the important additional effect of copying the SPSR to CPSR. This way, on return from an exception, processor returns to the state from before the exception. That includes endianess settings, execution state, etc.
In our project, the structure of PSRs is defined in terms of C bitfield structs in src/arm/PL1/kernel/psr.h.