Bananymous
f6679eb4b5
Kernel: Expose CPU load information under /proc/cpu/<index>
2026-05-20 19:13:25 +03:00
Bananymous
ed3924722e
Kernel: Remove kernel CPU load printing
...
We still keep track of processor loads but the hacky printing is no
longer done in kernel space :)
2026-05-20 19:11:27 +03:00
Bananymous
4ef03eac97
Kernel: Allow ProcRO inode fail and pass arbitrary argument to it
2026-05-20 19:06:10 +03:00
Bananymous
7ce68b0488
LibGUI: Allow timeout with Window::wait_events
2026-05-20 19:03:11 +03:00
Bananymous
14aa28b043
Kernel: Handle TTY ioctls on all inodes not implementing it
...
This reduces debug spam while compiling software
2026-05-20 16:57:24 +03:00
Bananymous
6045726e41
Kernel: Optimize PageTable::unmap_range on x86_64
2026-05-20 16:16:44 +03:00
Bananymous
45e55d8907
LibC: Don't compare equal elements in qsort
...
This seemed to break supertuxkart which returned `less` in this case
2026-05-20 05:54:45 +03:00
Bananymous
e9d6431728
DynamicLoader: Fix dynamic TLS init order
2026-05-20 05:03:20 +03:00
Bananymous
aa8be130f9
DynamicLoader: Cleanup lazy PLT relocations
2026-05-20 05:02:48 +03:00
Bananymous
a19e6938eb
Kernel: Remove TTY keyboard thread
...
This was really hacky as it had no idea when the keyboard had events
and the blocking was just one millisecond sleeps :D
Now keyboard device checks if current tty is receiving input and if so
it forwards the events to the TTY.
2026-05-20 04:17:03 +03:00
Bananymous
32206069bc
Kernel: Use per cpu fast page for {Memory,File}BackedRegion
2026-05-20 02:51:48 +03:00
Bananymous
46a1903f8d
Kernel: Use per cpu fast page for PMM
2026-05-20 02:46:50 +03:00
Bananymous
a3ca49ff1f
Kernel: Don't sync ext2 inode on read
...
This is the most common operation and we don't even update any fields
during read (although we should update atime). The disk read+write is a
bit too heavy with the current cache system
2026-05-20 02:14:40 +03:00
Bananymous
94f92d982c
Kernel: Optimize PageTable address space reservation
...
I only did this for the 64 bit target.
2026-05-20 02:01:16 +03:00
Bananymous
4f5f84bb5b
Kernel: Speed up mmap address space reservation by a lot
...
Instead of scanning the page table for free range, we not use the
process's mapped regions to find a slot. This speeds up mmap by a lot!
2026-05-20 01:08:08 +03:00
Bananymous
5cb5ae2dfe
Kernel: Use per cpu fast pages for DiskCache
...
This makes accessing disk cache a lot faster
2026-05-20 00:17:51 +03:00
Bananymous
7704e3c5c0
Kernel: Implement per cpu fast pages
...
Basically every fast page usage should be converted into this but I'll
do them one by one when they show up in profiles
2026-05-20 00:16:56 +03:00
Bananymous
376e4b4c45
Kernel: Reduce the number of sent IPIs
...
Only send an IPI when the target processors don't have pending messages.
This basically gets rid of TLB shootdowns from showing up in profiles.
Before they were taking maybe >10% kernel time :^D
2026-05-19 23:52:38 +03:00
Bananymous
24c37e7381
Kernel: Move TLB invalidation out of standard SMPMessages
...
This makes accessing TLB messages much faster as TLB flushes are very
frequent in comparison to other messages
2026-05-19 23:51:01 +03:00
Bananymous
fb9c67ab15
Kernel: Add PageTable API to invalidate full address space
2026-05-19 23:46:56 +03:00
Bananymous
d52ad29afa
Kernel: Add missing tr cmake file
2026-05-19 13:57:56 +03:00
Bananymous
1dc26d3c06
Kernel: Cleanup inode stat updating
...
Inode now handles stat upates itself and calls sync function to make
updates visible on the underlying filesystem
2026-05-19 13:00:05 +03:00
Bananymous
a05fcdde8c
Kernel: Move UTIME_OMIT handling to the syscall from inode
2026-05-19 11:56:12 +03:00
Bananymous
deb2f52a35
Kernel: Add support for named pipes
...
These only copy inodes stat when created, if you fchmod/fchown a named
pipe, the change will not be visible on the filesystem
2026-05-19 00:15:25 +03:00
Bananymous
8224659c48
Kernel: Allow creating FIFOs in tmpfs
2026-05-19 00:05:22 +03:00
Bananymous
1922d78661
Kernel: Add support for mkfifo{,at} mkdir at
...
Opening FIFOs still dont work as expected but at least you can create
them now :D
2026-05-18 23:53:09 +03:00
Bananymous
6d1ecc2388
Kernel: Clean up file creation
2026-05-18 15:26:59 +03:00
Bananymous
5cf658c175
Kernel: Fix 2 memory pinning bugs
...
If pinning a region succeeded but pushing the region to a vector failed,
we would leak the pin preventing the process from cleaning up
2026-05-17 03:38:18 +03:00
Bananymous
ef2738bfb7
Kernel: Disable devfs device add/remove logging
2026-05-17 03:38:18 +03:00
Bananymous
d7865b2929
Kernel: Don't msync file backed pages that were never mapped writable
2026-05-17 03:21:08 +03:00
Bananymous
9c79971bdc
LibC/Kernel: Add support for detached pthreads
2026-05-17 00:40:56 +03:00
Bananymous
ff75c15ba3
LibC: Move pthread keys to TCB
...
This removes all TLS relocations from libc which may become handy ;)
2026-05-17 00:29:20 +03:00
Bananymous
9e6fa0a1ba
Kernel: Add fast path for invalid address during region pin
...
Before I was falling through to the write lock which does allocation,
but as the read loop already saw, specified address was not mapped.
2026-05-17 00:29:20 +03:00
Bananymous
6e95519acc
Kernel: Make TTY write lock a mutex instead of a spinlock
...
The mutex could not be locked while processing ANSI DGR in VTTY
2026-05-17 00:29:20 +03:00
Bananymous
d081655913
Kernel: Add API for mutex to check if it is locked by current thread
...
Also add assertion that you have interrupts enabled :^)
2026-05-17 00:29:20 +03:00
Bananymous
9c3eb8d270
userspace: Implement tr utility
2026-05-17 00:29:20 +03:00
Bananymous
68479bf07e
userspace: Fix getopt_long usage
...
- Add missing null entry after the last long option
- Don't duplicate illegal option message, getopt already prints
the message as I do not suppress it. Also handle missing arguments.
2026-05-17 00:29:20 +03:00
Bananymous
d528314ae3
Kernel: Make SYS_FUTEX restartable
2026-05-17 00:29:20 +03:00
Bananymous
40dd29b876
LibC: Cleanup syscall macros
2026-05-17 00:29:20 +03:00
Bananymous
dc1d7e3fae
ls: Print total field with -l
2026-05-15 22:46:50 +03:00
Bananymous
8f8ba2751c
ls: Add support for -A and -h
2026-05-15 22:35:58 +03:00
Bananymous
928d3e3fe7
dirname: Fix help message
2026-05-15 22:34:48 +03:00
Bananymous
4ef7b8e71c
Kernel: AFG reset return value
2026-05-15 21:38:23 +03:00
Bananymous
5e1b5c329b
Kernel: Allow HDA stream reset to timeout
...
This was hanging on some version of qemu :^)
2026-05-15 21:30:41 +03:00
Bananymous
b2f795b1e1
Kernel: Pipe ignore tc attr ioctls
2026-05-15 21:23:19 +03:00
Bananymous
bf2121e166
LibC: Implement tc{get,set}winsize
...
These were added in POSIX issue 8 :^)
2026-05-15 17:08:02 +03:00
Bananymous
05c9f0640c
Kernel/LibC: Replace terminal syscalls with ioctls
...
isatty, tc{get,set}attr, tc{get,set}pgrp are now implemented as ioctls
instead of separate syscalls
2026-05-15 17:03:33 +03:00
Bananymous
fe2c9f7d2d
LibC: Rewrite malloc
...
The old linked list allocator with power of two pool sizes was kinda
weird. Now we use 1MiB bitmap allocators for allocations <64KiB and
directly call mmap for larger allocations. This allows userspace to
actually free unused memory on `free` :)
2026-05-15 17:03:33 +03:00
Bananymous
d7cdf3818c
LibC: Make aio.h incudable in C++
...
aio stuff is not supported but now the header is at least includable in
C++ which was not possible before as __restrict was not allowed in array
size
2026-05-15 17:03:33 +03:00
Bananymous
6a2f041858
LibC: Handle negative size in fgets
2026-05-15 17:03:33 +03:00
Bananymous
f0c5fb3a87
LibC: Don't use ScopeGuard in exec
...
These ended up pulling `operator delete` which is not available when
linking with gcc :^)
2026-05-15 17:03:33 +03:00
Bananymous
28b873b949
Kernel: Allow recursive rwlock write lock
2026-05-15 17:03:33 +03:00
Bananymous
c352fb600f
Kernel: Reduce ext2 locking
...
Replace the mutex with a rwlock and lock when its not necessary
2026-05-14 17:23:06 +03:00
Bananymous
dd8a9b1793
Kernel: clamp msync address range instead of calling contains
2026-05-13 20:03:37 +03:00
Bananymous
212ab010a5
BAN: Expose radix sort with user provided buffer
...
This can be nice if user has memory for a the temporary buffer and
doesnt want the sorting to allocate or be able to fail.
Also counts are now stack allocated, there isn't really any reason to
allocate them on the heap as 256x 64 bit values only adds up to 2 KiB
2026-05-13 05:05:11 +03:00
Bananymous
d345f96387
LibC: Optimize qsort
...
Apply same optimizations as to BAN quick sort!
2026-05-13 04:37:25 +03:00
Bananymous
d181f9e553
BAN: Optimize quick sort
...
We now use the middle element as the pivot and do three way partitioning
to improve sorting with equivalent elements
2026-05-13 04:31:31 +03:00
Bananymous
5f237abc3b
Kernel: Don't lock Ext2FS while reading and writing blocks
...
There is really no reason for this. The underlying block devices are
(should be) thread safe themselves
2026-05-09 23:28:00 +03:00
Bananymous
0bf7328e04
Kernel: Handle TIOC{G,S}WINSZ on pipes
...
GCC likes to do this a lot and debug logging is excessive
2026-05-09 23:28:00 +03:00
Bananymous
9f4271f6d8
Kernel: Remove the big inode lock
...
This moves locking to the inodes themselves which allows reducing lock
times significantly. Main inodes (ext2 and tmpfs) still do contain a
single big mutex that gets locked during operations but now we have the
architecture to optimize these.
2026-05-09 23:28:00 +03:00
Bananymous
a7356716ff
Kernel: Reduce locking FileBackedRegions
2026-05-09 15:08:26 +03:00
Bananymous
912647ce68
Shell: Fix type builtin PATH resolution
...
We were not adding a '/' between PATH dir and the command
2026-05-06 17:30:43 +03:00
Bananymous
d2e21f9380
Kernel: Fix 64 bit page table range reservation from lower->higher half
2026-05-06 17:30:43 +03:00
Bananymous
443be800b7
Kernel: Fix remote TLB shootdown for <= 32 pages
...
I was modifying the `vaddr` argument while invalidating which lead to
the smp message containing wrong virtual address. This showed up in
really weird bugs from invalid TLB
2026-05-06 17:30:43 +03:00
Bananymous
3ac955714b
Kernel: Optimize FileBackedRegion CoW
...
Just copy data from the existing page instead of locking inode's shared
data, copying to temporary buffer and finally copying to destination
2026-05-06 17:30:43 +03:00
Bananymous
62f5292f38
Kernel: Send only one TLB invalidation when creating a ByteRingBuffer
2026-05-06 17:30:43 +03:00
Bananymous
7553ede3b4
Kernel: Send only one TLB invalidation when creating a VirtualRange
2026-05-06 00:27:26 +03:00
Bananymous
eba97c1fc7
Kernel: Avoid possible dead lock while sending smp messages
...
Process own events while waiting for space on another processor. This
fixes a dead lock when processors are sending messages to each other
2026-05-06 00:09:05 +03:00
Bananymous
47650980f2
LibC: Reorder stack trace dump printing
...
If we fault while getting start of stack frame at least we now print
that we were trying to get the stack trace :^)
2026-05-05 13:54:51 +03:00
Bananymous
4b12770485
LibC: Don't leak FILEs on failed shebang exec
2026-05-05 13:52:52 +03:00
Bananymous
ba106f6bf5
LibC: Update argv[0] for shebang scripts to full path
...
This is needed so `dirname -- "$0"` works with shebang scripts found in
PATH
2026-05-05 12:48:04 +03:00
Bananymous
3a05a29294
dirname: Support options and multiple strings
...
This is not needed by POSIX but sdl2-config uses `dirname -- "$0"`
2026-05-05 01:42:28 +03:00
Bananymous
efeaafaff6
Kernel: Cleanup E1000 link speed code
2026-05-04 21:23:04 +03:00
Bananymous
6966475dcf
Kernel: Make E1000 sending lockless and mostly non-blocking
...
Now we only block if all 256 tx descriptors are waiting to be sent. This
removes TCP acks from taking 30% of profiles while DOWNLOADING files
2026-05-04 21:15:15 +03:00
Bananymous
dfe24b69e0
Kernel: Don't keep devfs locked while performing disk sync
2026-05-04 20:26:02 +03:00
Bananymous
93e1091252
Kernel: Rewrite kmalloc
...
Kmalloc is now a bitmap allocator with dynamic resizing and we dont need
to allocate 64 MiB static block of memory reserved for kmalloc :^)
2026-05-04 20:26:02 +03:00
Bananymous
f293377e31
Kernel: Dynamically allocate PCI devices
...
There was no need to prealloce almost a 5 MiB buffer for PCI all
possible pci devies :D
2026-05-04 20:26:02 +03:00
Bananymous
f4e2e62d04
Kernel: Remove kmalloc API for identity mapped results
...
This is no longer used. This finally allows me to rewrite kmalloc :^)
2026-05-04 20:26:02 +03:00
Bananymous
d42b363fb1
Kernel: Remove kmalloc identity map requirement from USB keyboard
...
This is the last place requiring kmalloc identity mapping
2026-05-04 20:26:02 +03:00
Bananymous
8773e80917
Kernel: Remove kmalloc identity map requirement from XHCI device init
2026-05-04 20:26:02 +03:00
Bananymous
0c6d713c4a
Kernel: Rewrite 32 bit paging to not depend on kmalloc
...
There are a lot of 'unnecessary' fast page mappings but at least this
works.
2026-05-04 20:26:02 +03:00
Bananymous
8091127150
Kernel: Add page table api to map multiple fast pages
...
This is not currently used, but can be handy in the future
2026-05-04 20:26:02 +03:00
Bananymous
74127c0f45
Kernel: Cleanup inline assembly accessing cpu specific data
2026-05-04 20:26:02 +03:00
Bananymous
28499b890c
LibC: Mark exit as noreturn
2026-05-04 20:26:02 +03:00
Bananymous
2f45349658
Kernel: Calculate internet checksum in host endian
...
No need to swap bytes of every 16 bit word in the packet, we can just do
one swap at the return
2026-05-04 20:26:02 +03:00
Bananymous
fde085e04b
Kernel: Pass current cpu index as a GDT limit
...
I had no idea LSL was an instruction. This cleans up code to get the
current cpu by a lot and does not require extra segment usage :D
2026-05-04 20:26:02 +03:00
Bananymous
77ca525552
BAN: Fix HashSet
2026-05-04 20:26:02 +03:00
Bananymous
3b83daef17
Kernel: Use empty string instead of nullptr for non existing proc name
2026-05-04 20:26:01 +03:00
Bananymous
f37d9dbdb1
Kernel: Remove kmalloc_vaddr_of
...
This is no longer needed. It was only used for x86_64 paging and AP
stack initialization
2026-05-04 20:26:01 +03:00
Bananymous
b7cedad891
Kernel: Wrap syscall macro value in paranthesis
2026-05-04 20:26:01 +03:00
Bananymous
cdf0de34fb
Kernel: Stop stacktrace dump on null bp
...
This makes stack traces not crash before IDT is initialized
2026-05-04 20:26:01 +03:00
Bananymous
03fccdffe1
Kernel: Rewrite paging and AP initialization
...
Initial step of paging now just prepares fast page for heap, actual page
table initialization happens after heap is initialized which allows
x86_64 to never depend on kmalloc for pages.
Processor's stacks are now also spawned with PMM/VMM allocated stacks
instead of kmalloc identity mapped.
2026-05-04 20:26:01 +03:00
Bananymous
1602b195c5
ports: Rework ssl certificates
...
ca-certificates:
- update to 2026.03.19
- install to /etc/cacert
- extract individual ceritificates from the bundle
openssl:
- depend on ca-certificates
- install hashed symlinks to individual certs
curl:
- don't depend on ca-certificates; openssl handles this
- set both ca-bundle and ca-path
2026-04-28 02:23:46 +03:00
Bananymous
1486ad7aa5
Kernel: Don't map NIC buffers as uncached
...
There is no need for them to be uncached. Having them as uncached killed
the networking performance, over 90% time was spent in kernel out of
which 80% was in checksum calculation and memcpy, half each (measured in
qemu with e1000e)
2026-04-27 19:45:16 +03:00
Bananymous
ab8bcbec3e
Kernel: Allow mapping dma regions as not uncached
2026-04-27 19:36:32 +03:00
Bananymous
0e00b72df6
BAN: Cleanup HashMap
...
Add a concept for HashMapFindable instead of manually specifying the
requries expression everywhere.
Allow HashMapFindable also for `remove`, `contains`, `operator[]`, `at`
Make Entry have a const Key. This allows iterator's operator* and
operator-> return values have const keys.
2026-04-25 22:10:01 +03:00
Bananymous
a63818ec33
BAN: Cleanup HashSet
...
Add a concept for HashSetFindable instead of manually specifying the
requries expression everywhere.
Allow HashSetFindable also for `remove` and `contains`.
Remove non-const return values from iterator; you should never modify
the hashed value in place.
Don't require key to be move assignable, move construction is enough.
2026-04-25 22:10:01 +03:00
Bananymous
cf2e8ffaff
Kernel: Remove unnecessary custom RefPtr hashes
...
RefPtr now exposes its own default hash
2026-04-25 22:10:01 +03:00
Bananymous
b5647ff258
BAN: Rewrite RefPtr,UniqPtr const semantics
...
const RefPtr<T> now allows accessing T as non-const. Also add default
hash function for RefPtr and UniqPtr based on the pointer value
2026-04-25 22:10:01 +03:00
Bananymous
bef53c726b
Userspace: Install libdl, libm, libpthread as symlinks to libc
...
Having dummy libraries was just unnecessary
2026-04-21 21:46:00 +03:00