Commit Graph
2062 Commits
Author SHA1 Message Date
Bananymous 4e9cfdde97 Kernel: Fix 32 bit target compilation
banos is written with only 64 bit in mind so it has to be disabled
2026-08-22 15:33:49 +03:00
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 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 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 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 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 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 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 2ddee7016e Kernel: Fix another scheduler bug :^) 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 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 51b9dcebbc Kernel: Support FIONBIO ioctl 2026-07-20 04:07:23 +03:00