Commit Graph

3605 Commits

Author SHA1 Message Date
8869cc7b8c Kernel: Stop stacktrace dump on null bp
This makes stack traces not crash before IDT is initialized
2026-05-02 15:51:12 +03:00
d2b9b49cb0 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-02 15:45:08 +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
0ee50032f3 Kernel: Fix 32 bit signal trapoline offset 2026-04-21 00:19:33 +03:00
40f3546aca BAN: Rewrite HashMap as a wrapper around HashSet
There is really no need to have two implementation of the same thing.
Only difference now is that HashMap's value type has to be movable but
this wasn't an issue
2026-04-21 00:18:18 +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
fe613e4274 BAN: Rewrite HashSet
Instead of representing the map as vector or linked lists which required
an allocation for every insertion and deallocation for removal, we now
store a single big contiguous block of memory and use hash chains to
handle collisions. This intuitively feels much better although I did not
run any benchmarks.
2026-04-21 00:14:24 +03:00
3264dcee44 BAN: Add Math::round_up_to_power_of_two 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
a24ec0da2b LibC: Don't complain about stack size until 8192 bytes
It was unnecessary as userspace stack is way bigger than that...
2026-04-19 17:52:21 +03:00
e6284c3cf3 LibC/Kernel: Bump PATH_MAX to 4096 2026-04-19 17:52:21 +03:00
DcraftBg
f527aca9d0 LibC: add strcasestr to string.h 2026-04-19 17:52:21 +03:00
DcraftBg
5fce3b64cc LibC: implemented strptime (partially) 2026-04-17 21:05:58 +03:00
c04ad65f7f LibC: Add mbsinit and wcsrtombs stubs 2026-04-17 18:40:18 +03:00
af17b29414 ports: Add xz port 2026-04-17 18:39:18 +03:00
7badcf80cf ports: Add libarchive port 2026-04-17 18:37:41 +03:00
7f122d9e89 ports: Add bzip2 port 2026-04-17 18:37:30 +03:00
984c7c0a89 LibGUI: Fix packet sending and cleanup receiving 2026-04-15 21:52:51 +03:00
ce318c7930 LibGUI: Cleanup packet {,de}serialization 2026-04-15 21:52:13 +03:00
eff6c79e9e ports/xbanan: Update to a working version
Also don't depend on mesa or Xlib. We only need the protocol headers to
compile the project
2026-04-15 19:25:54 +03:00
aaade52146 LibC: Use __builtin_thread_pointer for _get_uthread()
This generates much nicer assembly as it does not have to read thread
pointer for every access to TCB (errno, cancel_state, cancelled) and
instead it can read it once and use the same value for all accesses
2026-04-15 17:32:43 +03:00
1bf5e6a051 WindowServer: Fix xbanan access check 2026-04-15 16:40:30 +03:00
394719a909 userspace: Fix some includes found when compiling to linux 2026-04-15 16:39:36 +03:00
3ebadc5c74 LibDEFLATE: Optimize decompression
Instead of calculating bit-by-bit crc32, we now calculate a lookup table
during compile time. The old crc32 calculation was taking almost 50% of
the decompression time.

Also handle multiple symbols at once without outputting to user. It is
much more efficient to output many bytes instead of the up to 258 that a
single symbol can decode to :^)
2026-04-14 01:50:30 +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
0156d06cdc LibDEFLATE: Support decompressing to/from partial buffer
We no longer require the user to pass full compressed data in one go,
instead the decompressor reports to the user if it needs more input or
output space.
2026-04-13 03:04:55 +03:00
ad12bf3e1d LibC: Cleanup environment variable code 2026-04-13 00:36:13 +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
87979b1627 LibImage: Don't allocate zlib stream to a contiguous buffer
We can now pass multiple buffers to the decoder!
2026-04-11 19:48:46 +03:00
fed9dbefdf LibDEFLATE: Allow decompression from multiple byte spans
Before we required the compressed data to live in a single contiguous
chunch of memory.
2026-04-11 19:47:44 +03:00
2984927be5 WindowServer: Block without timeout when there is no damaged regions 2026-04-11 08:41:21 +03:00
2e654b53fa WindowServer: Use rectangular framebuffer syncs 2026-04-11 08:30:15 +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