Seems to work well enough to take over the OpenSBI putchar
TODO: Add some kind of flush() to avoid trashing data still in the FIFO
when we take over from OpenSBI
Switched to an acutal cross compiler instead of using the linux gcc
Stole more ideas from managarm
Figured out the "right" way to handle warnings and flags in meson
Removed libgcc dependency because it doesnt exist in riscv64-elf-
will need to figure out how to use things like __builtin_memcpy
properly
NOTE: I didn't switch to the new functions in the kernel because for
some reason we get a page fault when trying to fetch the first
instruction of set_timer(addi sp, sp, -48). I doubt this is related to
the set_timer funcion itself and is instead some kind of paging or
linking problem because it works fine with paging disabled and really
just doesnt make sense.
General notes:
For now im just going to leave all the responses as SbiRet but once I
decide how I want to handle returning errors I would like to return more
useful values.
In the cpp file I define a enum class "ExtensionId" with only one
member. For now the thought is that its descriptive and is consistent
with how the legacy extension is written. I'll also do the same thing
with FunctionId in the legacy extension after this commit for
consistency.
Helps to actually return the right values...
Ecall was returning the passed arguments a0 and a1 instead of the actual
return values from the registers(r_a0 and r_a1)
Shit explanation just read the diff, its one line
Added legacy extension
Fixed typing memes by just define a sbiword_t typedef
Renamed sbiret_t to SbiRet, I think i'll only use _t for typedefs
Added ecall() variant that takes no additional arguments
Moved opensbi includes to includes/opensbi/...
kernel.cpp uses the legacy extensions instead of raw ecalls
All legacy extension calls are marked as deprecated
Split code into generic, arch, and platform
Made QEMU its own platform
Added shitty uart upload script for lichee board until I can get fel to
actually upload uboot payloads without hanging
TODO: Move platform selection out of build script
TODO: Move arch specific stuff from kernel to arch
TODO: Common linker script for arch instead of having a copy in each
platform
Mostly stolen from https://github.com/avdgrinten/riscv-toy-os
Changed load address to 0x45000000 so it would run on real hardware
Played around with GPIO and the watchdog