Commit Graph

3638 Commits

Author SHA1 Message Date
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
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
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
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
4b12770485 LibC: Don't leak FILEs on failed shebang exec 2026-05-05 13:52:52 +03:00
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
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
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
28499b890c LibC: Mark exit as noreturn 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
77ca525552 BAN: Fix HashSet 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
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
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
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
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
cf2e8ffaff Kernel: Remove unnecessary custom RefPtr hashes
RefPtr now exposes its own default hash
2026-04-25 22:10:01 +03:00
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
bef53c726b Userspace: Install libdl, libm, libpthread as symlinks to libc
Having dummy libraries was just unnecessary
2026-04-21 21:46:00 +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
eea0154f18 LibC: Cleanup RNG and properly initialize to srand(1) at startup 2026-04-21 00:26:41 +03:00
ea4c34fc0b LibC: Fix printf thread safety
I don't know why I was using a static buffer for value conversions :D
2026-04-21 00:25:56 +03:00
558ed8fd44 LibC: Define pthread_{equal,self} as macros
These really should get inlined :D
2026-04-21 00:25:16 +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