28b873b949
Kernel: Allow recursive rwlock write lock
2026-05-15 17:03:33 +03:00
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
dd8a9b1793
Kernel: clamp msync address range instead of calling contains
2026-05-13 20:03:37 +03:00
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
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
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
a7356716ff
Kernel: Reduce locking FileBackedRegions
2026-05-09 15:08:26 +03:00
d2e21f9380
Kernel: Fix 64 bit page table range reservation from lower->higher half
2026-05-06 17:30:43 +03:00
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
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
62f5292f38
Kernel: Send only one TLB invalidation when creating a ByteRingBuffer
2026-05-06 17:30:43 +03:00
7553ede3b4
Kernel: Send only one TLB invalidation when creating a VirtualRange
2026-05-06 00:27:26 +03:00
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
efeaafaff6
Kernel: Cleanup E1000 link speed code
2026-05-04 21:23:04 +03:00
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
dfe24b69e0
Kernel: Don't keep devfs locked while performing disk sync
2026-05-04 20:26:02 +03:00
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
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
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
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
8773e80917
Kernel: Remove kmalloc identity map requirement from XHCI device init
2026-05-04 20:26:02 +03:00
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
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
b8dc199738
Kernel: Fix ByteRingBuffer->back()
2026-05-04 20:26:02 +03:00
74127c0f45
Kernel: Cleanup inline assembly accessing cpu specific data
2026-05-04 20:26:02 +03:00
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
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
3b83daef17
Kernel: Use empty string instead of nullptr for non existing proc name
2026-05-04 20:26:01 +03:00
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
b7cedad891
Kernel: Wrap syscall macro value in paranthesis
2026-05-04 20:26:01 +03:00
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
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
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
ab8bcbec3e
Kernel: Allow mapping dma regions as not uncached
2026-04-27 19:36:32 +03:00
cf2e8ffaff
Kernel: Remove unnecessary custom RefPtr hashes
...
RefPtr now exposes its own default hash
2026-04-25 22:10:01 +03:00
6b43cadf3a
Kernel: Implement stack trace dump with safe memcpy
...
This fixes kernel panic if the stack trace cannot be read. Manually
validating pointers is definitely not safe
2026-04-21 21:20:52 +03:00
b74812d669
Kernel: Remove unnused features from VirtualRange
...
On-demand paging has not been used ever since I made userspace stack be
a normal MemoryRegion.
2026-04-21 19:58:09 +03:00
8665195350
Kernel: Allow main thread to call pthread_exit
...
Apparently this is allowed. Also when last thread calls pthread_join
the process should also exit
2026-04-21 00:23:35 +03:00
72a24a0d38
Kernel: Reorder FUTEX_WAIT value and timeout check
...
Return EAGAIN rather than ETIMEDOUT if value does not match at futex
entry
2026-04-21 00:20:37 +03:00
0ee50032f3
Kernel: Fix 32 bit signal trapoline offset
2026-04-21 00:19:33 +03:00
a8e496310b
Kernel: Use HashMap for fd->epoll_event mapping
...
I don't know why it was a static array :D
2026-04-21 00:14:24 +03:00
71649ffe09
Kernel Rework ThreadBlocker
...
I don't know why I though the block chain had to be stored fully in the
ThreadBlocker, that did not even fix the problem I was trying to fix
when I last rewrote it. Roll back to doubly linked list of block chain
and now just check that the node is contained within the ThreadBlocker
before removing and after acquiring the ThreadBlocker's lock. Also there
is no need to have a separate lock the node's blocker field. We can just
perform an atomic reads and writes to it. We can still get a blocker
that the node is no longer part of, but this can be resolved with a
simple check. This patch reduces ThreadBlocker's size from over 200
bytes to just 12 bytes +4 bytes padding
2026-04-20 12:50:09 +03:00
5b7b2d7ac3
Kernel: Fix memory leak when cleaning up inodes shared page cache
2026-04-19 17:52:21 +03:00
8e543195b1
Kernel: Check for null in pthread_join
2026-04-19 17:52:21 +03:00
e6284c3cf3
LibC/Kernel: Bump PATH_MAX to 4096
2026-04-19 17:52:21 +03:00
d471bbf856
Kernel: Cleanup bootloader headers
...
Also add custom load addresses for x86_64 target. This allows qemu to
load the kernel with -kernel argument. Without these addresses qemu
would refuse to load as it only supports 32 bit ELFs, but as our kernel
starts in 32 bit mode anyway, we can just load it!
2026-04-13 16:48:57 +03:00
c849293f3d
Kernel: Add support for loading gzip compressed initrd
2026-04-13 16:48:57 +03:00
42964ad0b4
Kernel: Remove concept of OpenFile
...
This was just RefPtr<OpenFileDescription> and descriptor flags.
Descriptor flags only define O_CLOEXEC, so we can just store fd's
cloexec status in a bitmap rather than separate fields. This cuts down
the size of OpenFileDescriptorSet to basically half!
2026-04-12 04:42:08 +03:00
ac6e6f3ec1
Kernel: Add ioctl to sync rectangular areas in framebuffer
...
msync is not really the best API for framebuffer synchronization
2026-04-11 08:29:10 +03:00
2a9dad2dd8
LibC: Add SSE2 non-temporal memset and memcpy
...
Also cleanup other assembly by using local labels to emit them from the
assembled program.
2026-04-11 03:30:52 +03:00