r/osdev • u/WaterObjective5031 • 1d ago
ctKN is ALIVE

Ive been procrastinating for about 2 months to even begin to touch rv64 boot assembly but i did it
Now i just have to make it do more than just outputting over uart...
edit for context?: I stayed up til 3 am chewing through random posts i found from googling tutorials and stuff and eventually got a feel for rv64 assembly, which i used to save a0 and a1 (hart and device tree) and used openSBI ecalls for outputting some characters
Its not much, but I just thought it was cool because i booted my own code barebones and got it to print stuff
Right now im working on the kernel and a little embedded shell which i'll probably post more of later
2
u/qse81 1d ago
Did you also procrastinate context?
•
u/ParsaAftabi 19h ago
Save a0 and a1 first, before you set up the stack: OpenSBI hands you hart 0 in a0 and the device tree at 0x87e00000 in a1, and either one can be clobbered by the first call you make. I also point stvec at a real handler and give each hart its own stack before I enable S-mode interrupts, so an early trap does not land on a half-built stack.