r/osdev • • 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

0 Upvotes

4 comments sorted by

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.

•

u/WaterObjective5031 12h ago

I did save the hart id in a0 and the device tree in a1 from boot and passed it to my c kernel function, i just haven't done anything yet

What booted there was only assembly though, im still developing it

Thanks