Commit Graph

1056 Commits

Author SHA1 Message Date
bf2121e166 LibC: Implement tc{get,set}winsize
These were added in POSIX issue 8 :^)
2026-05-15 17:08:02 +03:00
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
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
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
6a2f041858 LibC: Handle negative size in fgets 2026-05-15 17:03:33 +03:00
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
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
d345f96387 LibC: Optimize qsort
Apply same optimizations as to BAN quick sort!
2026-05-13 04:37:25 +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
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
28499b890c LibC: Mark exit as noreturn 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
bef53c726b Userspace: Install libdl, libm, libpthread as symlinks to libc
Having dummy libraries was just unnecessary
2026-04-21 21:46:00 +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
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
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
f527aca9d0 LibC: add strcasestr to string.h 2026-04-19 17:52:21 +03:00
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
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
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
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
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
2b97587e9f WindowServer: Rewrite damaged region tracking
Instead of immediately doing rerender of client data and syncing 60 Hz,
we now only keep track of the damaged regions and also do the rerender
step 60 Hz.
2026-04-11 08:26:22 +03:00
4bde088b28 WindowServer: Store rectangles as min and max bounds
This makes some math easier than x,y and w,h
2026-04-11 06:35:45 +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
7333008f40 LibC: Use IP instead of si_addr for faulting instruction
si_addr only means faulting instruction for SIGILL. For SIGSEGV it is
the faulting memory address.
2026-04-11 03:30:52 +03:00
a4ba1da65a LibGUI/WindowServer: Rework packet serialization
Instead of sending while serializing (what even was that), we serialize
the whole packet into a buffer which can be sent in one go. First of all
this reduces the number of sends by a lot. This also fixes WindowServer
ending up sending partial packets when client is not responsive.
Previously we would just try sending once, if any send failed the send
was aborted while partial packet was already transmitted. This lead to
packet stream being out of sync leading to the client killing itself.
Now we allow 64 KiB outgoing buffer per client. If this buffer ever fills
up, we will not send partial packets.
2026-04-11 03:30:52 +03:00
2f9b8b6fc9 Kernel/LibC: Rework userspace syscall interface
Kernel syscall API no longer zeros all unused argument registers and
libc now uses inlined syscall macro internally. This significantly
cleans up generated code for basic syscall wrapper functions.
2026-04-11 03:30:52 +03:00
80c4213501 LibC: Make errno macro directly access uthread
This allows inlining errno usages

This breaks libc ABI and requires toolchain rebuild
2026-04-11 03:30:32 +03:00
e0af23a924 LibC: Move uthread definition to its own header
Use `__asm__` instead of `asm` to allow compilation with --std=c99 and
before
2026-04-11 03:30:32 +03:00
7fb27b16e8 LibC: Fix pthread cancellation
Install SIGCANCEL handler for all threads.

Remove unneeded atomic stores and loads. States are only changed within
the thread itself.

Define pthread_testcancel as a macro so it gets inlined inside
cancellation points
2026-04-07 03:41:25 +03:00
3fb903d991 LibGUI: Optimize invalidate and set alpha channel
If the window does not have an alpha channel, we now set every pixel's
alpha to 0xFF. This is needed by the WindowServer when it does alpha
blending, there used to be some weird stuff happening on overlapping
windows.

Also when we are invalidating a region with width of the whole window,
we can do a single memcpy instead of a memcpy for each row separately.
2026-04-06 19:29:34 +03:00
2a4a688c2d WindowServer: Optimize rendering
We now use SSE2 to do alpha blending on 4 pixels at a time where
possible and use memcpy instead of manual loops for non blended regions.
2026-04-06 19:29:34 +03:00
4d3751028b LibInput: Honor chroot and credentials when loading keymap 2026-04-06 19:29:34 +03:00