commit 00ecdccfda58bd7550cc1e7ebea349bba657c4fe parent 4ee196b1308105e974333a0db8191fdc7451220b Author: Dimitris Papastamos <dimitris.papastamos@arm.com> Date: Wed, 24 Apr 2019 13:02:34 +0100 doc: Add RMC handling flow Change-Id: I4d33a0e7447640f5b2a3222eca5c241a1e2bc845 Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com> Diffstat:
M | doc/DESIGN | | | 48 | +++++++++++++++++++++++++++++++++++++++++++++--- |
1 file changed, 45 insertions(+), 3 deletions(-)
diff --git a/doc/DESIGN b/doc/DESIGN @@ -162,17 +162,59 @@ code. This is where the test framework lives. There are 5 types of tests. -2) Driver model ---------------- +2) System initialization +------------------------ TBD 3) RMC handling flow -------------------- +The vector table is installed in target/native/crt.s. The vector +table definition is in target/native/arch.s. + +The exception handling code only uses the SP_EL3 stack pointer. The +code does not use SP-EL0 at all. + +When an exception is received, the code jumps to the `exception()' +function in target/native/arch.s. The code pushes the CPU context on +the SP_EL3 stack and then jumps to the `trap()' function which is the +generic top-level exception handler defined in src/romfw/rmc.c. + +The `trap()' function receives a pointer to the trapframe. The +trapframe type is described in include/rcode/rcode.h and it is +basically an array of registers. + +Within `trap()' the ESR is decoded and if it is not an RMC then the +code will panic. This is because in the original r-mode specification +only certain synchronous exceptions were defined. This part of the +code is not complete yet. + +The RMU command is decoded based on the RMC class and function and the +code jumps through a dispatch table to the corresponding libhdl +handler. The libhdl handler will call through to the librmu handler. +If there is an error, `badcmd()' is called by the librmu handler. +This forces the code to do an early return without unwinding through +all intermediate calls. `badcmd()' will set the x0 register in the +trapframe to indicate the error and call the low level `swtch()' +function which is defined in target/native/arch.s. If there is no +error, the code will unwind all the way back to `trap()' and then call +the low level `switch()' function. + +`swtch()' receives a trapframe pointer which points to the stored CPU +context which is the same pointer as the one received from `trap()'. +It will restore the context as needed and then perform an exception +return. + +4) Driver model +--------------- + TBD -4) Build system +5) Debug language +----------------- + +6) Build system --------------- The rcode build system is based in fully portable POSIX Makefiles. They