aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel
AgeCommit message (Collapse)Author
2024-08-26fix memory leaks destroying threadsKimplul
2024-08-26make sys_create() better + testKimplul
2024-08-26don't free the physical address of page tablesKimplul
2024-08-22change sys_ret handling to always include idKimplul
2024-08-22add basic ipc-req testKimplul
2024-07-09start working on testsKimplul
+ Current setup will likely not last long, just a stopgap until I figure out how I want to build each testcase etc. Probably dir based, but I'll probably add some scripts that generate the build rules for each test case (or binary?). Also, should probably put ouput files in a build directory and keep the source clean, but again, good enough for now. Will have to start implementing more extensive tests, and probably come up with some way to compare textual output etc.
2024-07-08fix LLVMKimplul
+ Anything extern is right out as LLVM doesn't produce correct code for them. Maybe if I added some extra attributes but I'm skeptical. Replaced with static variables and getters/setters. + Inline ASM is apparently a bit buggy, so use an assembly stub when jumping to init. + Minimize work done in main() to minimize chance of LLVM doing something silly. Still not 100% certain that I shouldn't just write the main() as an assembly stub in arch/riscv64 to be absolutely sure everything works as intended. + Make .kernel.start section SHF_ALLOC, otherwise lld complains about pc-relative addressing Probably some other stuff as well that I'm forgetting right now. But at least with LLVM14 LTO seems to work, which is pretty cool?
2024-07-08add orphan checking to timer and irq handlingKimplul
2024-07-07add req_page back in as I realized it's usefulKimplul
+ Can be used to pass contiguous memory regions to things like virtio block devices for implementing disk drivers etc.
2024-07-07make executable entrypoint universal callbackKimplul
+ Effectively means that all executables can be called into, but if an exe doesn't want to deal with anyone else it should just set a flag like `not_really_a_server` or whatever
2024-07-07misc fixesKimplul
+ Align kernel to 2MiB boundary in u-boot + Optimize alignment functions a little bit, should still have to check on real hardware but 'feels' more clean + Add early boot debugging + Put extra cores we aren't ready to account for to sleep if/when they boot. + Make BASE_PAGE_SIZE constant on riscv64/32, helps the compiler with some alignment checks among other things.
2024-07-07add small note about new booting methodKimplul
2024-07-07simplify assertionsKimplul
+ No real point having multiple different levels of assertions, just say you assert something and be done with it
2024-07-07smp now seems to workKimplul
+ Had some minor issues with a wraparound of size_t that effectively meant that some regions were allocated twice. Also, booting should be a bit more reliable now, turned out that the previous iteration of the booting was just accidentally working due to the kernel being placed 'close enough' in RAM to where it was linked to. Fixed by allocating a vmem of O1 that maps the kernel to a 2MiB boundary at boot, pretty nifty.
2024-07-06core bringup + various warningsKimplul
+ dbg_fdt() is apparently broken, possibly due to UB or something, but it causes some issues with optimizations enabled. Remove it temporarily
2024-07-06remove some unused macrosKimplul
2024-07-06adjust stack handlingKimplul
2024-07-06prefer __riscv_xlen over riscv64Kimplul
2024-07-06pretty massive virtual memory rewriteKimplul
+ The system is now a bit simpler and hopefully easier to understand, while also extending the shared memory to be 1:N, where there is one owner who may become a zombie while waiting for the N to die.
2024-07-05implement bklKimplul
+ Start out using big kernel lock, apparently seL4 thinks its good enough. I might have a go at using a more fair lock, and possibly moving to more fine-grained locks if I really feel the need to get scalability up.
2024-07-05formatting and documentationKimplul
2024-07-05allow booting with Qemu's -kernel flag directlyKimplul
+ Took some fairly significant changes, for one the kernel is no longer relocated at the start of a boot, instead it sits wherever the user decides the kernel should sit. Similarly, the initial kernel stack and page table are stored within the binary, slightly bloating the size but making it much safer to boot since there's really no chance of us overwriting the fdt or initrd in memory.
2024-07-05fix some small build issuesKimplul
+ Compiling for size emits memcpy() calls after they've already been removed by LTO, so add __used attribute to counteract this. Newer versions of GCC seem to prefer `-flto=auto` to just `-flto`, so use that. printf format %d -> %ld
2024-07-04use notification framework for orphanizing threadsKimplul
2024-07-04generalize orphantsKimplul
+ Allow threads to make themselves become orphants
2024-07-04add zombie and orphan threadsKimplul
+ Should write this down somewhere but the idea is that when a process gets killed, it frees all the memory it can, making all threads within that process orphans. Orphaned threads are assigned to the init process, which will generally call exit() on each one. Zombie threads are threads that own some bit of shared data, and whose reference count is above zero. They may not be swapped to or called, even though they take up space in thread map and reserve their thread ID.
2024-07-02more complete interrupt handling outlineKimplul
+ Still largely untested, should really try to come up with a proper testsuite, at the moment it's mostly me trying things out in the (as of yet unreleased) kmx repo
2024-07-01expand notifications into interrupt handlersKimplul
+ Terminology is still a bit poor, and will still have to write documentation + implement ipis properly
2024-06-01document sleepKimplul
2024-06-01add sleep syscallKimplul
+ Sets the current core to sleep
2024-05-10update formatting configKimplul
2024-01-10some kmx alleviationsKimplul
2023-10-09experimenting with removing lists threads per procKimplul
+ Gives a very slight improvement to RPC speeds, but mostly cleans up code a little bit.
2023-10-09move rpc stack handling to arch-specific codeKimplul
+ Fairly considerable speedup, as we don't have to look up the rpc pte every time separately, instead cacheing them. Adds an architecture specific limitation to total rpc stack size, though.
2023-08-04fix warnings in smp.cKimplul
+ Only occur with my version of riscv64-linux-gnu-gcc. Funny, that.
2023-08-04add initial smp bringupKimplul
2023-08-03add sbi_hart_startKimplul
2023-08-03fix cpu_send_ipiKimplul
2023-07-31start working on irqsKimplul
2023-07-27use nifty variable argument count trickKimplul
+ Found it in newlib. This allows the compiler to more effectively optimize away unnecessary register operations. Applied to both kernel and init.c for a slight speed increase. I really should move init.c to some other repository though, the binary files are starting to get annoying
2023-06-08skip saving registers when possibleKimplul
2023-06-08add fast userspace return to do_ipcKimplul
2023-06-07change register save/load to increasing orderKimplul
2023-06-04slight optimization and brainfart fixKimplul
2023-06-04visionfive2 bootsKimplul
+ Make 8250 serial driver more generic + Still TODO: write a tutorial on how to boot on the visionfive2
2023-06-04visionfive2 boots until debugging is initializedKimplul
2023-05-29start trying to boot on visionfive 2Kimplul
+ Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested.
2023-05-17align handle_irq to four byte boundaries alwaysKimplul
+ CSR_STVEC requires four byte alignment
2023-05-12fix LLVM compilationKimplul
+ RELEASE=1 doesn't work for some reason, though
2023-05-11arbitrary load address and RAM base detectionKimplul
+ Both kind of go hand in hand, made sense to do both at the same time. Some parts feel slightly hacky, the loader works by placing everything on the stack and avoiding global values. Still, seems to work?