aboutsummaryrefslogtreecommitdiff
path: root/include/arch
AgeCommit message (Collapse)Author
2024-11-01update some docsKimplul
2024-11-01rpc actually marks and unmarks stack regionsKimplul
+ Processes won't be able to read previous stack frames etc
2024-10-30bookkeepingKimplul
2024-10-30tests passKimplul
2024-10-30most of the way to passing testsKimplul
2024-10-29start moving towards threads always being in rpcKimplul
2024-08-30speed up ipc_resp a bitKimplul
+ Skip unwinding stack and just jump directly to userspace
2024-08-27add some missing documentationKimplul
2024-08-26fix memory leaks destroying threadsKimplul
2024-08-22change sys_ret handling to always include idKimplul
2024-07-09allow mapping null pageKimplul
+ User has to 'free' the 0 page before it becomes accessible to mapping. Probably worth noting that this is likely VERY niche and mainly concerns stuff like certain kinds of emulators that I'm still eons from implementing, but still. Unbacked pages can also be useful for some kinds of notifications, like 'if someone writes to this page, please report it to me with this ID' or whatever, I remember seeing some discussion about it somewhere but that's also not really relevant for the moment. Most significantly, at least with the current design, after the null page is freed it becomes available for use to regular req_mem() calls, so users should probably using locks around memory requests. That's probably a good idea anyway as internally the kernal has to lock the virtual memory, and without a scheduler it might cause threads to spin for a while in the kernel which is rather bad.
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-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-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-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-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-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-04add initial smp bringupKimplul
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-08add fast userspace return to do_ipcKimplul
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-01update license stuffKimplul
2023-04-30rename to kmiKimplul
2022-12-01start looking into memory handlingKimplul
+ Now 10M alloc/frees succeed, which totals more memory than the virtual machine has, so no too obvious leaks are occuring. For future debugging speed, changed 10M to 1M. + Also quick fix to rpcs, stacks are now assigned. Not entirely sure why they worked before this, but good that I found it.
2022-11-21possible optimisationsKimplul
2022-11-13improve documentation on new featuresKimplul
2022-11-13~1.3M ipc requestsKimplul
+ The secret is using gravestones. I'll have to write up full documentation for the feature but essentially riscv lets us encode whatever we want into page table entries, as long as they're not active. We use this to encode highest user address that is not a zero, in that all entries in the top level are either active or gravestones. When an active entry is removed, it is either a gravestone (if there are other active entries above it) or it starts a cascade of removing entries that have been previously removed Slight runtime overhead to page mapping, pretty major advantage in rpc calls. Feature will need to be tested more thorougly, and the init program is sort of a best scenario with just one top level userspace page table entry active at a time, leading to incredibly fast context switches. Current implementation limits a process' max virtual memory to 248 GiB (in Sv39), but I don't think the missing 8 GiB is that big of a deal.
2022-11-12slight optimizationKimplul
2022-11-12initial rpc implementationsKimplul
2022-11-11less buggy forkKimplul
+ Not strictly done yet, but we can swap between two processes :D
2022-11-09update docsKimplul
2022-11-09add basic IPI structureKimplul
2022-10-22initial high level fork impKimplul
2022-10-21beautificationKimplul
2022-10-21initial implementation of swapKimplul
+ Slightly unsure if it should be a syscall, or if assign would be enough. Also, which thread should run in a fork/spawn? For now, old thread, though this might increase latency. Or add swap flag to these calls?
2022-10-21initial spawn implementationKimplul
2022-09-15change syscalls to take 5 params and return 6Kimplul
+ In total, a syscall is built up of 6 values, with the first being the syscall number. Symmetrically, the first value is now a status and the following five values return "values". This allows us to cram in more info into the ipc_* functions. The performance difference is absolutely minimal, at least from my testing in qemu.
2022-06-12add license textsKimplul
2022-06-11continue documentationKimplul
2022-06-11continue documentationKimplul