Bananymous
0b53fba991
Kernel: Fix PCI PIN interrupt allocation and handling
...
We now use the correct PIN interrupt from the interrupt line field
instead of writing to it, this had no effect :D
PIN interrupts are now mapped as shared and level triggered, this
properly allows PIN interrupt sharing with multiple devices
2026-07-20 10:45:32 +03:00
Bananymous
0d390e2246
Kernel: Send EOI after handling the interrupt
...
There is no need to send it prior to handling. This required us to not
yield from HPET/PIT irq so that the EOI actually gets sent
2026-07-20 10:43:50 +03:00
Bananymous
a3b7a758eb
Kernel: Allow allocating shared interrupts and setting trigger mode
2026-07-20 10:28:18 +03:00
Bananymous
d46d7a5123
Kernel: Cleanup entering acpi mode
...
There is no need to pass the current mode as an argument as ACPI has
access to that info either way.
Only route INTx objects when using ACPI, they won't be used otherwise
2026-07-20 09:02:18 +03:00
Bananymous
b611c3fe48
LibC: Support in-place realloc for mmap backed allocations
...
When shrinking a mmap based allocation, we can just unmap the trailing
pages that will no longer be needed. When extending an allocation we try
to MMAP_FIXED_NOREPLACE the need extra data to avoid memcpy between old
and new allocation. I'm not sure if the extension logic is really worth
it but it is just 15 lines of code to avoid possibly very large memcpys.
2026-07-20 06:58:30 +03:00
Bananymous
8c6e402ee8
LibC: page align mmap backed malloc sizes
...
This will make reallocations cleaner
2026-07-20 06:58:30 +03:00
Bananymous
bd5be982e9
LibC: Don't memset 0 mmap'd callocs
...
There is no reason to page everything in and the kernel already
guarantees that the memory is zeroed in mmap
2026-07-20 06:58:30 +03:00
Bananymous
33f941f2fd
LibC: Unmap unused pages in aligned mallocs
2026-07-20 06:58:30 +03:00
Bananymous
8368dec30b
LibC: Fix posix_memalign return value
...
I was returning -1 with errno instead of the error code :P
2026-07-20 06:58:30 +03:00
Bananymous
7f25350c62
LibC: Fix malloc mmap byte tracking
...
I was incrementing instead of decrementing when freeing mmap allocs
2026-07-20 06:58:30 +03:00
Bananymous
64523b6c70
LibC: Fix futex return value handling
2026-07-20 06:58:30 +03:00
Bananymous
a9cf0134b7
Kernel: Don't block thread if the wake time has already passed
2026-07-20 06:58:30 +03:00
Bananymous
2e8239fefa
Kernel: Fix thread block timeout
...
I was comparint ms against ns making timeouts practically never wake up
:)
2026-07-20 06:58:30 +03:00
Bananymous
f2bf406db7
ports: Add ccleste port
2026-07-20 06:58:30 +03:00
Bananymous
63a8f40e67
ports/quake2: Clenaup build script and patches
2026-07-20 06:58:30 +03:00
Bananymous
2ddee7016e
Kernel: Fix another scheduler bug :^)
2026-07-20 06:58:30 +03:00
Bananymous
bc622c8b51
LibC: Fix pthread default guard size and name
2026-07-20 06:58:30 +03:00
Bananymous
6ebd3a8aca
Kernel: Rewrite the AHCI driver
...
There was a lot of stuff wrong with this driver and it was only getting
speeds of ~2.5 MB/s. Now 4K blocks get ~17 MB/s which is not good but
definitely better. I'm pretty sure the issue is qemu's emulation as 85%
of time is spent between sending the command and it to complete.
Large blocks are now supported too, qemu with block size 1M gets around
600 MB/s read speeds.
2026-07-20 06:58:30 +03:00
Bananymous
96e5779182
Kernel: Fix out of bounds reads on storage devices
2026-07-20 04:07:23 +03:00
Bananymous
02f05436fc
Kernel: Fix zero sized reads from a partition
2026-07-20 04:07:23 +03:00
Bananymous
51251e492e
Kernel: Fix fallback PS/2 interrupt numbers
...
I haven't used the fallbacks in so long that I didn't realize they were
wrong :D
2026-07-20 04:07:23 +03:00
Bananymous
20e36125c8
Kernel: Cleanup very old AHCI code
2026-07-20 04:07:23 +03:00
Bananymous
19c228362b
Kernel: Make ext2 block buffers page aligned
2026-07-20 04:07:23 +03:00
Bananymous
cf9a495f1d
ports: Add ClassiCube port
2026-07-20 04:07:23 +03:00
Bananymous
5329ec5912
Kernel: Rework spinlock usage when blocking the current thread
...
The old SpinLockAsMutex was pretty confusing first of all. It also was
causing the issue thats been around for maybe a year now which is the
only consistently happening kernel panic. I've been pretty confused
about this and finally figured out what was causing this.
The main issue was that we were accidentally enabling interrupts when
blocking a thread that passed SpinLockAsMutex from normally interrupt
enabled context. This led to receiving IPI for thread unblock while
we were actively blocking the thread. I'm very suprized this had't
caused any more serious issues than occasional kernel panics :^)
2026-07-20 04:07:23 +03:00
Bananymous
edc95e1c09
Kernel: Disable SMP message handling while blocking a thread
...
There were some race conditions on a thread getting unblocked before
being moved to the block queue
2026-07-20 04:07:23 +03:00
Bananymous
46e2d665e9
LibC: Make pthread_once block with a futex instead of yielding
2026-07-20 04:07:23 +03:00
Bananymous
0242a4f968
DynamicLoader: Fix master and initial TLS setup
2026-07-20 04:07:23 +03:00
Bananymous
390a7674b1
LibC: Fix uthread deallocation
...
Update dtv[0] to the max loadad module when loading dynamic modules
Free uthread if stack allocation or mprotect fails on pthread_create
Don't unmap the currently used stack when detached thread exits
2026-07-20 04:07:23 +03:00
Bananymous
f96f2b4cac
ports: Split dejavu fonts to their own port
2026-07-20 04:07:23 +03:00
Bananymous
51b9dcebbc
Kernel: Support FIONBIO ioctl
2026-07-20 04:07:23 +03:00
Bananymous
583c2437b4
LibC: Don't munmap nullptr with 0 size in malloc
2026-07-20 04:07:23 +03:00
Bananymous
efb25e5666
BAN/LibC: Move ldexp, scalbn to libc
...
They are now implemented with float decompostion to modify the exponent
bits directly
2026-07-20 04:07:23 +03:00
Bananymous
f0e95ffe48
LibC: Make qsort_swap static
...
There is no need to export this
2026-07-20 04:07:23 +03:00
Bananymous
511ab7e99c
LibC: Define locale_t as an poiter
...
A lot of ports seem to depend on this casting nullptr into locale_t
2026-07-20 04:07:23 +03:00
Bananymous
4df58c5155
Kernel: Check for overflow in seek syscall
2026-07-20 04:07:23 +03:00
Bananymous
f6e27e5f05
toolchain: Update gcc 15.2.0->15.3.0
...
There was an ICE bug in gcc 15.2.x when compiling webkitgtk
2026-07-20 04:07:23 +03:00
Bananymous
87006e277f
LibC: Define winsize in both termios.h and sys/ioctl.h
2026-07-20 04:07:23 +03:00
Bananymous
2c340c5532
BAN: Implement more numerically stable hypot
2026-07-20 04:07:23 +03:00
Bananymous
f6b91578ae
LibC: Enable backtrace dumping by default
...
I'm not sure why I had turned this off
2026-07-20 04:07:23 +03:00
Bananymous
73a95bd725
ports/lynx: Update 2.9.2->2.9.3 and fix compilation
2026-07-20 04:07:23 +03:00
Bananymous
130c4f681c
ports/ncurses: Enable widec support and disable test compilation
...
There is one test with buggy macros that does not compile and im not
feeling like making a patch for it now :^)
2026-07-20 04:07:23 +03:00
Bananymous
e03a26cf01
LibC: Don't ASSERT in times
...
Return the current process CPU time as user time. We don't have a way to
get system/user time separation or CPU times of child processes
2026-07-20 04:07:23 +03:00
Bananymous
2a3eca5b36
LibC: Implement POSIX binary search trees
...
I used RB tree for this. The implementation is based on the code on
wikipedia about RB trees.
2026-07-20 04:07:23 +03:00
Bananymous
658e74b507
bootloader: Check that VESA mode is linear
...
I don't think there are any graphical non-linear framebuffers but good
to be sure
2026-07-20 04:07:23 +03:00
Bananymous
9bdf60bb88
bootloader: Fix stack corruption when pressing non ascii keys
2026-07-20 04:07:23 +03:00
Bananymous
3148c28c3d
userspace: Add basic find utility
...
This is mostly working but is missing -exec and -ok support. It can
search files though :^)
2026-07-08 21:48:14 +03:00
Bananymous
fa89645542
userspace: Implement simple sort utility
...
This supports most(?) options except for the separate fields. Should
work for simple use cases
Also merge is currently just a wrapper around sort so its not optimized
:D
2026-07-08 21:48:14 +03:00
Bananymous
ddf8fbc085
BuildSystem: Use ccache if found
2026-07-08 21:48:14 +03:00
Bananymous
ecfd98fad0
bootloader: Don't use random packing in memory map
2026-07-08 21:48:14 +03:00
Bananymous
2e9f7077c9
TaskBar: Fix division by zero error
...
If a CPU does not have updated stats to show, just display ??.??%
2026-07-07 17:50:00 +03:00
Bananymous
132b75c2d0
ports/bash: Fix compilation with moved winsize
2026-07-07 16:59:20 +03:00
Bananymous
bc8f0f373e
ports: Add tar port
2026-07-07 16:59:20 +03:00
Bananymous
e352bfbb23
mkdir: Don't fail the target exists and -p was given
2026-07-07 16:59:20 +03:00
Bananymous
3ee6240806
Kernel: Prioritize EEXISTS sys_mkdir
...
This fixes `mkdir -p ...` failing to create existing parents which are
not writable
2026-07-07 16:59:20 +03:00
Bananymous
304f94f3b1
LibC: Implement __fpending
...
Some gnu programs want this and I don't want to make FILE non-opaque
2026-07-07 16:59:20 +03:00
Bananymous
89fa957297
BuildSystem: Fix keymap in base sysroot
2026-07-07 16:59:20 +03:00
Bananymous
7348511ed3
ports/llvm: Add support for pthread_setname_np and cpu count
...
Also package the llvm into the format mesa expects. This was kinda
tedious to always do manually
2026-07-07 10:30:07 +03:00
Bananymous
20392c6cc1
LibC: Add malloc.h with some GNU extension
...
This adds `reallocarray`, `malloc_usable_size`, `mallinfo`, `mallinfo2`
2026-07-07 10:30:07 +03:00
Bananymous
0843b8989d
Kernel: Fix timer deadline issues in scheduler
...
Don't wake up threads when getting the next timer deadline.
If we are idling this can: remove thread from block list, get the
deadline for the next blocked thread, return to idle thread. This will
end up sleeping until the next wake up condition which in the worst
case would be rebalance, or indefinitely when not running SMP.
Make sure we always set the next timer deadline. I was not doing that if
the timer interrupt did not lead to a yield
2026-07-07 10:30:07 +03:00
Bananymous
1c8112f1a7
ports: Update xbanan
2026-07-07 05:07:36 +03:00
Bananymous
49662aa994
Kernel: Don't use peridic interrupts for scheduling
...
Scheduler will now set a timer interrupt deadline for when it should get
interrupted next. This fixes a big issue I've had for a long time where
sleeping on an idle core would have to wait for the next periodic
interrupt to wake up. This could cause 1 ms sleeps to be close to 10 ms.
This currently only supports lapic timers and will still fallback to
periodic interrupts when running with PIC. I should add deadline support
to PIT/HPET but why would you run with APIC disabled ;)
2026-07-07 04:53:41 +03:00
Bananymous
bcf1c6d110
BAN: Add print formatter for Span
2026-07-07 04:53:41 +03:00
Bananymous
b62687f5e7
LibC: Cleanup backtrace code
2026-07-07 04:44:44 +03:00
Bananymous
7b4b5a3440
BAN: Cleanup intro_sort and quick_sort
...
Only recurse to the smaller partition. This prevents worst case O(n)
recursion
2026-07-07 04:43:06 +03:00
Bananymous
896bb05073
LibC: Cleanup qsort implementation
...
Remove random template and just make qsort be a wrapper around qsort_r
Recurse only into the smaller partition. This removes the possibility of
O(n) recursion in the worst case
Use insertion sort for ranges shorter than 16 elements.
Split qsort_swap into qsort_swap_fixed and qsort_swap_general
- fixed one handles 1, 2, 4 and 8 byte elements which can be done directly
with mov instructions
- general copies 64 bytes at a time followed by a single copy for the
rest. the 64 byte chunk loop gets nicely optimized into sse
2026-07-07 04:39:06 +03:00
Bananymous
fc10de7ccb
LibC: Implement pause
2026-07-07 04:36:55 +03:00
Bananymous
e8a490336c
ports: Build release binaries with meson
2026-07-07 04:36:55 +03:00
Bananymous
e741ab0fa1
ports: Replace libjpeg with libjpeg turbo
...
This is faster and adds some extensions on top of that
2026-07-07 04:36:55 +03:00
Bananymous
7d7b1f0319
ports: Add libspng port
2026-07-07 04:36:55 +03:00
Bananymous
97d26b5d4e
ports: Split mesa into two packages: osmesa, glx
...
Now SDL and other stuff that use opengl dont have to pull X11 libraries
We now also compile glx backend with DRI instead of xlib. This allows
building EGL support as well!
2026-07-07 04:36:55 +03:00
Bananymous
e78fcf63b6
ports: Update mesa 25.0.7->26.1.4
...
This required bringing back osmesa code from 25.0.7 which was the last
version where it was supported. Seems to work fine though
2026-07-07 04:36:55 +03:00
Bananymous
bfad22211f
ports: Add libdrm port
2026-07-07 03:12:39 +03:00
Bananymous
6e2542d896
ports: Add libxshfence port
2026-07-07 03:12:39 +03:00
Bananymous
659bc50aec
ports: Update and dont build static freetype
2026-07-07 03:12:39 +03:00
Bananymous
f6c5e3e640
ports: Update and dont build static expat
2026-07-07 03:12:39 +03:00
Bananymous
8957408890
ports: Update and dont build static libpng, libjpeg, libtiff
2026-07-07 03:12:39 +03:00
Bananymous
db8544065e
ports: Don't build static zlib and zstd
2026-07-07 03:12:39 +03:00
Bananymous
eee0b7c3ff
Kernel: Make ioctl take unsigned long instead of int
...
this is what linux does :D
also fix one or two `return ioctl` instead of `return ioctl_impl`
2026-07-07 03:12:39 +03:00
Bananymous
ea4e016b1e
DynamicLoader: Fix TLS memory initialization
...
I was reading the TLS data before performing relocations so any TLS
variables pointing to relocated objects would not get the correct data
2026-07-05 13:53:20 +03:00
Bananymous
9fd015a84e
ports/tuxracer: Use osmesa as the gl library
2026-07-05 07:38:27 +03:00
Bananymous
090ab99903
ports/glu: Use osmesa as the gl provider
2026-07-05 07:34:22 +03:00
Bananymous
3e16e69602
LibC: Implement qsort_r
...
This is not really required by anything but i've seen few ports
optionally use it if available. This was trivial to implement so why not
add it :^)
2026-07-05 01:55:57 +03:00
Bananymous
58c58bcccf
BuildSystem: Add missing pkg-config file and update .gitignore
2026-07-05 00:45:43 +03:00
Bananymous
f173b7bccc
ports/harfbuzz: Fix infinite circular dependency loop
2026-07-05 00:40:43 +03:00
Bananymous
fde0eb0964
ports: Update vim 9.1.1485->9.2.0538
2026-07-05 00:40:43 +03:00
Bananymous
05ee0a7f49
ports: Update ncurses 6.5->6.6
2026-07-05 00:40:43 +03:00
Bananymous
a863b2ca13
ports/openssh: Add missing patches
...
I just noticed I had some uncommited patches that are required for the
compilation. Also remove the ifaddrs.h fixup as we now support those!
2026-07-05 00:40:43 +03:00
Bananymous
15f6158cea
ports/doom: Update and install to /usr/share/games
2026-07-05 00:24:20 +03:00
Bananymous
c7eb2dbdf3
ports: Replace SDL2 with sdl2-compat
...
There is no need to keep two SDL versions around
2026-07-05 00:24:20 +03:00
Bananymous
380b172968
ports: Update butterscotch and use SDL3
2026-07-05 00:00:11 +03:00
Bananymous
ae0e79aa01
ports: Update openal-soft 1.24.3->1.25.2 and use SDL3
...
No need to use SDL2 anymore :^)
2026-07-04 23:57:00 +03:00
Bananymous
01f0871a83
ports: Add SDL3 port
...
I've been planning on doing this for a long time :D This is mostly based
on the SDL2 backend but there are a bunch of fixes
2026-07-04 23:55:23 +03:00
Bananymous
ac1fafedcc
LibC: Cleanup and fix random functions
...
I was getting the size of random state incorrectly and ended up with
double the size user gave us leading to OOB access :D
Also remove hardcoded type -> size mappings and just use a looup table
2026-07-04 23:12:52 +03:00
Bananymous
7a696c4d63
Kenrel: Cleanup locking in close
2026-07-04 19:19:10 +03:00
Bananymous
89d3ee7b92
Kernel: Use per cpu fast page when clearing SMO pages
2026-07-04 19:18:31 +03:00
Bananymous
879783052d
Terminal: Use gnu <start> ... <end> syntax in switch cases
2026-07-04 19:17:41 +03:00
Bananymous
b480f783ec
LibC: Fix regex anchor parsing
2026-07-04 19:17:07 +03:00
Bananymous
2957206718
LibC: Fix and cleanup stdio mode string parsing
...
The code is now much cleaner andd we are not as strict with the mode
string. Also add support for new 'e' and 'x' modifiers
2026-07-04 19:13:26 +03:00
Bananymous
a41a3eeb66
LibGUI: Add query keymap request
2026-07-04 19:12:56 +03:00