aboutsummaryrefslogtreecommitdiff
path: root/HISTORY.md
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-11-26 17:08:37 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-11-26 17:08:37 +0100
commit92130ebe9d60e126844c3dfb33f49357a6f4e4cd (patch)
treefccc4fac66aa92d864bf5486e015747c3e309697 /HISTORY.md
parent3c1218507acb84c95818a044eefb51fc8e5fa4c7 (diff)
downloadrpi-MMU-example-92130ebe9d60e126844c3dfb33f49357a6f4e4cd.tar.gz
rpi-MMU-example-92130ebe9d60e126844c3dfb33f49357a6f4e4cd.zip
maintain history of recent progress
Diffstat (limited to 'HISTORY.md')
-rw-r--r--HISTORY.md9
1 files changed, 8 insertions, 1 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 3d912be..e63397d 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -44,4 +44,11 @@ Only at this point we eventually started working on the relevant part - the MMU.
The above could be possibly achieved easier, by using others' existing code, but doing the whole project with the Copy-Paste method seemed like a bad idea.
-Knowing a good, working sequence of actions needed for enabling the MMU, we could start writing it a cleaner way - using unions and structs with bitfields, which make the code a lot more readable compared to when bit masks and bit shifts are used for work on coprocessor register constents and translation tables entries. \ No newline at end of file
+Knowing a good, working sequence of actions needed for enabling the MMU, we could start writing it a cleaner way - using unions and structs with bitfields, which make the code a lot more readable compared to when bit masks and bit shifts are used for work on coprocessor register contents and translation tables entries.
+
+The next step was switching to PL0 (unprivileged) mode under MMU-mapped address space. For that, we embedded in our kernel image a binary, that is supposed to run in PL0 mode. It did the same simple thing kernel
+used to do - echoing everything on uart. The privileged code would mark a memory section entry in translation table as accessible for PL0 and then copy the embedded blob to that section. It would then jump to that just-copied code. switching from PL1 to PL0 would be done on the blob side (at the very beginning of it's execution).
+
+This was also an opportunity for us to check that the memory mapping truly works. We mapped virtual addresses 0xAAA00000 - 0xAAAFFFFF to physical addresses just after our kernel image and translation table (probably 0x00100000 - 0x001FFFFF given the small size of our kernel). The virtual address range 0xAAA00000 - 0xAAAFFFFF was also marked available for use by PL0 code. We then made kernel write the blob at 0x00100000 knowing it will also appear at virtual 0xAAA00000. Then, successfully running the unprivileged code from that address confirmed, that the mapping really works.
+
+There were 2 important things forgetting about which would stop us from succeeding in this step. The first one was the stack. Kernel used to use the memory just below itself (physical 0x8000) as the stack and since these addresses would not be available for PL0 code, a new stack had to be chosen - we set it somewhere on the high part of our unprivileged memory. The second important thing was marking the section in which the memory-mapped uart registers reside as accessible form PL0. This is because we were going to have unprivileged code write to uart by itself (and use the same uart code kernel uses...). Once we had interrupts programmed, this demo was to be improved to actually call the privileged code for writing and reading. \ No newline at end of file