aboutsummaryrefslogtreecommitdiff
path: root/TODOs
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2020-01-05 15:21:12 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2020-01-05 15:21:12 +0100
commitd1a7da144195888f1ff2a9763e965d489a8b4287 (patch)
tree6d9f539d8ccfafae2c77fbb0eb85df173b5d74a8 /TODOs
parentf8aca1d03016c2f4a4ae878fd9afab424cb6b72a (diff)
downloadrpi-MMU-example-d1a7da144195888f1ff2a9763e965d489a8b4287.tar.gz
rpi-MMU-example-d1a7da144195888f1ff2a9763e965d489a8b4287.zip
pseudonym
Diffstat (limited to 'TODOs')
-rw-r--r--TODOs2
1 files changed, 1 insertions, 1 deletions
diff --git a/TODOs b/TODOs
index c65683c..6126c85 100644
--- a/TODOs
+++ b/TODOs
@@ -5,7 +5,7 @@ high priority TODOs are higher; low priority ones and completed ones are lower;
!!! VERY IMPORTANT !!!
* (never to be completed, as new stuff to document comes all the time) Write documentation for what we've already done (yea, there's HISTORY.md, but we also want something that gives technical details of how MMU gets set up (writes to SCTLR, DACR and others), etc.). Things worth including:
- - Problems we've faced (I mentioned to Metal, I'd include those and he seemed very enthusiastic about us describing them) (+ some stuff qualifiable as probles is already in HISTORY.md)
+ - Problems we've faced (I mentioned to Metal (is it ok to use that pseudonym? I think it's ok), I'd include those and he seemed very enthusiastic about us describing them) (+ some stuff qualifiable as probles is already in HISTORY.md)
· Our ramfs needs to be 4-aligned in memory, but when objcopy creates the embeddable file, it doesn't (at least by default) mark it's data section as requiring 2**2 alignment. There has to be .=ALIGN(4) in linker script before ramfs_embeddable.o, but I forgot about it, which caused the ramfs to misbehave
· VERY NAUGHTY PROBLEM · Many sources mention /COMMON/ as the section, that contains some specific kind of uninitialized (0-initialized) data. Obviously, it has to be included in the linker script. Unfortunately, gcc names it differently, mainly - /COM/. This caused our linker script to not include it in the image. Instead, it was placed somewhere after the last section specified in the linker script. This happened to be after our NOLOAD stack section, where first free MMU section is (which happens to always get allocated to the first process, which gets it's code copied there). Do You imagine sitting for hours in front of radare2, searching for a bug in scheduler.c or PL0_test.c, that causes the userspace code to fail with either some kind of weird abort or undefined instruction, always on the second PL0 instruction!?
· VERY NAUGHTY PROBLEM · I wanted to make our bootloader and kernel able to run no matter what address they are loaded at (see comment in kernel's stage1 linker script). To achieve that, I added -fPIC to compilation options of all arm code. With this, I decided I can, instead of embedding code in other code using objcopy, just put that code in separate linker script section with section_start and section_end symbols defined, so that I can copy it to some other address in runtime. I did it and it worker with interrupt vector and libkernel (see point below). But once I changed EVERYTHING to use linker symbols/sections instead of objcopy embedding it turned out it doesn't really work... and I had to make it back the old way :( The thing is -fPIC requires code to be loaded by some os or bootloader, that will fill the global offset table with symbols. I knew it's possible to generate bare-metal position-independent code, that shall work without got, but it turned out this is not implemented in gcc (it is in arm compiler, but only in 32-bits and who would like to use arm compiler anyway). I ended up writing stage1 of both bootloader and the kernel in careful position-independent assembly, thus achieving my goal (jut with a bit more of effort).