Bananymous
ae24fb1dd0
Kernel: Use BAN::Math::{ctz,popcount} instead of builtins
2026-08-22 14:39:42 +03:00
Bananymous
fe64639842
Kernel/LibC: Make ino_t 32 bit integer
...
32 bit target could not use atomic ino_t when it was 32 bit. There isn't
really any reason to have 64 bit ino_t as there aren't really
filesystems with that large numbers :D
2026-08-22 14:39:42 +03:00
Bananymous
db9beac740
BAN: Add math functions for clz, ctz, popcount
2026-08-22 14:39:42 +03:00
Bananymous
471b6a6c40
Kernel: Replace __atomic builtins with BAN::atomic wrappers
2026-08-22 13:28:56 +03:00
Bananymous
fe2b130915
Kernel: Fix __cxa_guard_* implementations
2026-08-22 13:27:25 +03:00
Bananymous
67fdd24a19
Kernel: Prefer 32 bit HPET timers on 32 bit target
2026-08-22 13:23:43 +03:00
Bananymous
0d6b32dc3c
Kernel: Fix HPET validation
2026-08-22 13:23:43 +03:00
Bananymous
ffceb300db
Kernel: Cleanup xHCI debug printing
2026-08-22 11:57:19 +03:00
Bananymous
b818e2764c
Kernel: Only update USB max packet size for FS devices
2026-08-22 11:57:19 +03:00
Bananymous
4b7d90f939
Kernel: Ignore SET_PROTOCOL(1) errors on HID devices
...
One of my USB mice is a boot protocol device but stalls on SET_PROTOCOL
request. USB HID is supposed to be in report protocol on initialization
so an error *should* not be an issue
2026-08-22 11:57:19 +03:00
Bananymous
6a7c1c1281
Kernel: Reset xHCI control endpoint on command stall
2026-08-22 11:57:19 +03:00
Bananymous
fdbfda189f
Kernel: Map non-us hashtag to backspace on HID keyboards
...
Apparently one of my laptops advertise this key as non-us hashtag
instead of backslash while the key layout is the exact same as my other
keyboards :D
2026-08-22 11:57:19 +03:00
Bananymous
e496d889ba
Kernel: Deduplicate USB keyboard input code
2026-08-22 11:57:19 +03:00
Bananymous
9967878886
Kernel: Handle array usages for consumer page
...
Also map consumer page mute button in variable case
2026-08-22 11:57:19 +03:00
Bananymous
51badd75f0
Kernel: Move HID led handling from keyboard to usb device
...
Apparently some keyboards can have led control on another interface from
the one where input is received. Now led mask is global to the usb
devices instead of per keyboard instance.
2026-08-22 11:57:19 +03:00
Bananymous
f6e841e623
Kernel: Don't reset iHDA stream after running out of samples
...
We can just stop the stream :D This also broke restarting the stream on
some hardware when ig you need to reprogram the DAC after resetting
stream(?)
2026-08-22 11:57:19 +03:00
Bananymous
28bd9cf353
Kernel: Fix PS/2 scancode set detection logic
...
If we cannot determine current scancode set because either the keyboard
does not respond or responds with bogus value, assume scancode set 1 and
mark the scancode set as uncertain. If we receive the byte 0xF0 while
having the uncertain flag set, swap to scancode set 2. 0xF0 is unused in
scancode set 1 but indicates key release in scancode set 2, so it will
be sent after every key press.
2026-08-22 11:57:19 +03:00
Bananymous
892829adeb
Kernel: Fix PS/2 device detection
...
If we cannot find PS/2 devices in the acpi namespace check 8042 bit in
FADT. Also if user explicitly specified PS/2 scancode set, assume that
we do have a PS/2 controller even when other detection mechanisms fail
2026-08-22 11:57:19 +03:00
Bananymous
82fd57af9e
Kernel: Use local labels in assembly
2026-08-22 11:57:19 +03:00
Bananymous
2f25bfb2db
Kernel: Use min heap for scheduler block list
...
This makes insertion to block list O(log n) instead of O(n) when
blocking with wake time. This is more heavy and currently slower than
the previous implementation, but that is just because we don't really
have too many threads running at any given time. This will be more
scalable in the future and even allows implementing priorities if I ever
wish so
2026-08-19 21:32:36 +03:00
Bananymous
7f12e5aaf3
Kernel: Report actual hw volume from AC97
2026-08-19 21:32:36 +03:00
Bananymous
78e40ca353
AudioServer: Add software volume control
2026-08-19 21:32:36 +03:00
Bananymous
1231b16cc3
Kernel: Add mixer support to IHDA
...
This has not been tested as I don't have any hardware with mixers on
output paths :P
2026-08-19 21:32:36 +03:00
Bananymous
6cd3638a85
Kernel: Send set channel count on IHDA
2026-08-19 21:32:36 +03:00
Bananymous
4aead25970
Kernel: Cleanup IHDA volume control and report the actual volume
2026-08-19 21:32:36 +03:00
Bananymous
36b34b0df0
Kernel: Don't store copy of palette in virtual TTY
...
It can be just queried from the terminal driver
2026-08-19 21:32:36 +03:00
Bananymous
bf0bd19289
Kernel: Refactor includes to reduce include dependencies
...
Now modifying Scheduler.h or Thread.h doesnt trigger practically a full
kernel rebuild. This required moving Mutex and RWLock of of line but
that should be fine :^)
2026-08-19 21:32:36 +03:00
Bananymous
8cd9e6dfa8
Kernel: Keep track of thread user and system time separately
2026-08-19 21:32:36 +03:00
Bananymous
f0a114f4e5
Kernel: Fix shm object freeing and track lpid
...
I was deleting based on the key instead of the id which of course does
not work :D
2026-08-19 21:32:36 +03:00
Bananymous
ac99bf128b
LibAudio: Rename AudioLoader -> AudioStream
2026-08-19 21:32:36 +03:00
Bananymous
2c66de888f
BuildSystem: Add option to generate an ISO file
...
This creates ISO file with compressed initrd and grub files that can be
live booted easily
2026-08-19 21:32:36 +03:00
Bananymous
8f4db57ed8
WindowServer: Mark old window area as damaged on resize
2026-08-17 04:58:35 +03:00
Bananymous
b6f922895f
AudioServer: Queue more than 4k bytes per write
...
Before this I was writing audio data to kernel in ~20 ms chuncks. This
feels like way too many syscalls, so now we allow sending upto 1 second
per syscall :D
2026-08-17 04:44:15 +03:00
Bananymous
7aa8eb1778
Kernel: Use 64 bit write on HPET on x86_64
2026-08-17 04:33:20 +03:00
Bananymous
1128e440d2
Kernel: Fix typos and fix power button status clear
2026-08-17 04:32:26 +03:00
Bananymous
ac052fe1c1
Kernel: Program missing entries from redirection entries
...
This wasnt an issue but could be in the future
2026-08-17 04:23:04 +03:00
Bananymous
c915c064e8
BuildSystem: Compile cross gcc with optimizations
...
I guess because I now pass explicit CXXFLAGS, gcc did not add the
default optimization flags
2026-08-11 18:26:06 +03:00
Bananymous
895c586736
LibC: Add uchar.h
...
This was added in POSIX issue 8 and some ports end up with very weird
compile errors if this does not exist :D
2026-08-08 05:43:34 +03:00
Bananymous
04b8f9d7a3
LibC: Fix stdc++ requirement in getpagesize
2026-08-08 03:44:27 +03:00
Bananymous
6e99eed541
WindowServer: Cleanup damaged areas
2026-08-08 01:53:07 +03:00
Bananymous
fc40820150
Kernel/Userspace: Replace my custom SHM system with SysV shm
...
This allows xbanan to use shm!
2026-08-08 01:52:12 +03:00
Bananymous
2c4fee4a82
Kernel: Expose Inode::can_access as static member
2026-08-08 01:41:48 +03:00
Bananymous
2be915a1df
ports: Update xbanan
2026-08-08 01:30:09 +03:00
Bananymous
1a8351eae0
LibC: Cache page size in getpagesize
2026-08-05 05:41:31 +03:00
Bananymous
328771ae29
Kernel: Fix AC97 issues
...
Set last entry bit on the last entry :D
Verify that allocated DMA buffer fits in a 32 bit integer
2026-07-20 11:30:06 +03:00
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