Commit graph

29 commits

Author SHA1 Message Date
80dc438fd0
Drivers: Added start of 16550 UART driver
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
2022-07-31 23:29:24 -04:00
259d929c13
Drivers: Added Sunxi pinctrl driver
Works well enough to set bank modes and turn on an LED

Very not complete and needs more testing
2022-07-31 23:03:01 -04:00
d100b515d6
Kernel: Disabled dtb stuff for now 2022-07-31 23:01:57 -04:00
8274a93abb
Make: Throwing more random shit at the makefiles
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
2022-07-31 22:57:40 -04:00
f9ea032b7d
Kernel/OpenSBI: Switched to stdint.h
Not sure when I started typing cstdint but for now I want to stick to
stdint.h
2022-07-31 21:32:11 -04:00
44bfd9c4fb
Kernel: Removed left over example code 2022-07-31 21:20:48 -04:00
ad1ac3f9d7
Common: Started writing a DTB/FDT parser 2022-06-07 01:06:02 -04:00
4367e38f39
Kernel: OpenSBI memes
Just making sure things work
2022-06-07 01:04:21 -04:00
4a9d3a24d5
Renamed riscv -> riscv64 to make meson happy 2022-06-07 01:00:23 -04:00
9023bb8d60
Cleaned up ecall asm volatile 2022-04-09 14:02:41 -04:00
b78b3f5763
OpenSBI: Added PMU(Performance Monitoring Unit) extension 2022-01-26 23:17:58 -05:00
e149b8d503
OpenSBI: Added SRST(System Reset) extension 2022-01-26 18:31:40 -05:00
03fcf4dbb2
OpenSBI: Added HSM(Hart State Management) extension 2022-01-26 18:16:29 -05:00
a8a7c5fdc9
OpenSBI: Added rfence extension and HartMask struct 2022-01-26 17:39:49 -05:00
854f65a4b3
OpenSBI: Added IPI extension 2022-01-24 21:36:53 -05:00
b26479e625
Remove extra comma 2022-01-24 21:12:13 -05:00
dbfd13630d
OpenSBI: Added timer extension
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.
2022-01-23 23:56:46 -05:00
dd373fca85
OpenSBI: FunctionId in legacy extension, see previous commit 2022-01-23 22:52:02 -05:00
b08ac4817c
OpenSBI: Added base extension
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.
2022-01-23 22:40:21 -05:00
4d85da9674
OpenSBI: Fixed ecall return
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
2022-01-23 22:32:19 -05:00
c24628ab2a
Formatting
It would be nice if I would stay consistent with namespace formatting

Maybe I should use a real linter or something...
2022-01-23 20:27:14 -05:00
464a61102e
OpenSBI memes
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
2022-01-23 20:15:53 -05:00
ea60891ef5
Renamed call -> ecall
Removed old sbi call funcions in kernel.cpp
2022-01-23 15:35:18 -05:00
c4e91606de
Fixed qemu build
Forgot to add the include directories
2022-01-09 17:15:15 -05:00
94fbea02ca
Kernel: tabs -> spaces 2022-01-05 02:50:14 -05:00
d5d92555ae
Drivers: Started OpenSBI driver
Just ecall wrapper for now

TODO: Build system changes are lazy and need to be figured out

TODO: Looks like kernel.cpp was indented with tabs, fix
2022-01-05 02:47:30 -05:00
7336f9e6d6
QEMU: Fix load address
0x81000000 -> 0x80100000
2022-01-04 02:08:31 -05:00
b35d58df1f
Build System: More better
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
2022-01-04 01:50:46 -05:00
e50fb2de2c
Initial Commit
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
2022-01-03 19:11:49 -05:00