summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-08-18kernel: basic _sys_setxattr implementationHEADmaindzwdz
2024-08-18kernel/req: support combined kernel and user inputsdzwdz
prep work for setxattr
2024-08-17libc/compat: make c0_fs_respond's buffer argument constdzwdz
2024-08-17tests: fix the bad_delegate testdzwdz
It was closing the request handle... Now I'm guaranteeing an empty handle in a smarter way.
2024-08-17kernel: immediately fail open() request instead of truncating the pathdzwdz
less error prone
2024-08-17*: getxattrdzwdz
2024-08-17kernel/syscall: inline simple_vfsopdzwdz
History is a circle. In hindsight that function was pointless, it makes the code more complicated for pretty much no reason (except saving a few LoC, which is silly).
2024-08-17kernel: split the kernel/user inputs in VfsReqdzwdz
I think I've done this refactor in the opposite direction a few years ago. This is mostly meant to prepare me for setxattr, which requires two inputs - coincidentally, one is already going to be a kernel input, and the other will be an user input, so it works out. I also just didn't like the previous way it worked, this feels cleaner.
2024-08-16tmpfs: minor cleanupdzwdz
2024-08-16kernel/pcpy: minor cleanup, implement pcpy_from_strdzwdz
might potentially be used in a reworked open(), mount() etc interface
2024-08-15kernel: disallow NUL bytes in pathsdzwdz
2024-08-15ext2fs: don't create files unless OPEN_CREATE is setdzwdz
2024-08-03kernel: send user interrupt on page faultdzwdz
I really should just rename interrupts to something else. This is inspired by Plan9 and meant to make debugging easier, as the dying process can take a stacktrace etc. It kinda sucks that the default handler now depends on fprintf, which is quite a bit of code, but whatever.
2024-08-02kernel/interrupts: use UserRegs in the isr handlerdzwdz
2024-08-02*: use a generic UserRegs type everywhere I'm storing registersdzwdz
mostly inspired by Plan 9's Ureg, probably obvious from the name
2024-07-27cmd/termcook: fix integer size cast warningdzwdz
2024-07-27kernel: don't use pointer types for registers, add proc_savereturndzwdz
2024-07-26kernel: implement _sys_intr_returndzwdz
2024-07-25kernel: pass more information to user on interruptdzwdz
This is meant to facilitate a syscall for returning from interrupts, which will actually work in the general case as opposed to the current hack, which only works if the interrupt occured during a syscall (which is correct... for now).
2024-07-25kernel: set up the GDT in assemblydzwdz
This is just for simplicity's sake. I think I could even omit the `movw $TSS, (GdtTss + 2)` and have the linker fill that out as a relocation, but that would probably be more complex overall.
2024-07-22tests: check if SSE registers are preserved on context switchesdzwdz
2024-07-22kernel: explicitly store process RIP and RFLAGSdzwdz
Once again, needed for the interrupt return syscall. Seems to have made the kernel slower in timebench?
2024-07-22kernel: use IRET instead of SYSRET for switching into usermodedzwdz
I want to implement a new syscall for returning from "interrupts" (my crappy take on Plan 9's notes / UNIX signals), and I've realized that I can't use SYSRET for that, as it clobbers RCX and R11. This hasn't been an issue so far, as I've only been switching into usermode to return from syscalls, but now I might be switching into it at arbitrary moments (right after an interrupt handler recovers from a page fault, etc). I could make it so I switch between IRET and SYSRET depending on the context, but I don't think it's worth it.
2024-07-22kernel/isr: improve interrupt handling codedzwdz
On the assembly side, ensure the stack frame looks always the same, by pushing a fake "error code" for the interrupts that don't generate one. On the C side, use a struct instead of magic indices into an "array", and make it consistent with the current style.
2024-07-20*: moving filesdzwdz
2024-07-17kernel: actually store the tag (and size) in the kmalloc metadatadzwdz
I'm storing more information in less space. Win-win.
2024-07-17kernel: make kmalloc accept a numeric "tag" instead of a freeform descriptiondzwdz
This will both let me save space in the allocation header, and make the debugprint more readable.
2024-07-16kernel: use a slab allocator for kmallocdzwdz
For a while during development it managed to be faster than the old allocator despite having more overhead, probably because it makes better use of the cache. It no longer is - not sure why. The code definitely could be optimized to hell, though, and it'd probably recover its original edge. Non-power-of-2 sizeclasses would be really useful, as I could then e.g. fit four processes into a page instead of three, but I think implementing them "well" would be too complicated for now. In hindsight arbitrary allocation descriptions were probably a bad idea too. I've kept them in for now, but I'll switch to an enum of allocation types soon. I think I can fit all the per-allocation state (size+type) in 2 bytes. There are so few allocations in the kernel that I no longer care about the backtraces, so I'm leaving them out. The "large" allocations could probably be tested with execbuf in userland, so I might actually implement them soon too.
2024-07-15kernel: free list page allocatordzwdz
Yay for guaranteed O(1) insertions, even if iostress seems a bit slower.
2024-07-15kernel: split the page allocator and kmallocdzwdz
2024-07-15kernel: minor malloc tweaks before refactordzwdz
* firstfreepage now updates properly, preventing a crash (oops) * kfree only wipes the length of the allocation, not the entire page - which should make it easier to see the performance impact of the pagealloc changes
2024-07-15kernel: new queue abstractiondzwdz
The postqueue functions remain as-is, as that's a more "specialized" interface. They're mostly wrappers around queue.h, though.
2024-07-14kernel: O(1) ReqQueue insertionsdzwdz
2024-07-14kernel: make the adhoc VfsQueue queues use ReqQueue insteaddzwdz
I'm still not sure if I should use sys/queue.h for this. But yeah, this is more consistent, and it will also let me switch over to O(1) insertions later on.
2024-07-14kernel: rework postqueuedzwdz
Keeping its old name for now to make things easier for myself. This might just be replaced by sys/queue.h soon.
2024-07-14kernel/request: remove outdated comment in VfsReqdzwdz
2024-07-14kernel/malloc: clean up the code a little bitdzwdz
The bitmap functions now accept page addresses so I don't have to handle raw bitmap indexes, which was kinda complex. kmalloc_sanity is now not visible to other code as it wasn't really that useful in the first place.
2024-07-13kernel/malloc: limit the maximum allocation size to under a pagedzwdz
This will likely be changed back, but for the time being it will let me implement a better allocator without too much effort.
2024-07-12kernel: don't reuse VfsReq allocations for a single processdzwdz
To use the same testing methodology as when I've introduced request slots: before: / $ iostress 1 1000000 0 > /dev/vtty run 0: 2585203 1000000 calls, 0 bytes. avg 2585203 after: / $ iostress 1 1000000 0 > /dev/vtty run 0: 2783171 1000000 calls, 0 bytes. avg 2783171 This is around a 7.7% slowdown - that I hope to fix with a better malloc. While this doesn't really make the code that much simpler, it doesn't feel like the right approach in the first place
2024-07-11kernel: start cleaning up VfsRequestdzwdz
* I'm being more strict about the linked list state to hopefully ensure I'm not leaking any references. * vfsreq_create was renamed to vfsreq_dispatchcopy as that name feels more clear. It copies its argument, and dispatches it. * Requests for user backends are now handled more like requests for kernel backends - there's an accept() function that accepts a request.
2024-07-07kernel/vfs: split vfs_backend_refdown into two functionsdzwdz
2024-07-05man: document open(2)dzwdz
2024-05-25man: start writing manpagesdzwdz
2024-05-25libc/socket: use the "normal" form of ipsdzwdz
2024-05-19cmd: implement timebenchdzwdz
2024-05-19kernel: implement /dev/bintimedzwdz
2024-05-18configure: pass the -r flag to cpdzwdz
2024-05-18libc/execvpe: ENOENT on missing interpreterdzwdz
2024-05-11kernel: DUP_RDONLY and DUP_WRONLYdzwdz
I probably should've tested DUP_WRONLY too, now that I think about it. TODO?
2024-05-11kernel: remove HANDLE_NULLFSdzwdz
It was a dumb hack that wasn't even necessary - an error when mounting should shadow over the mountpoint anyways.