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
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
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
7a696c4d63
Kenrel: Cleanup locking in close
2026-07-04 19:19:10 +03:00
89d3ee7b92
Kernel: Use per cpu fast page when clearing SMO pages
2026-07-04 19:18:31 +03:00
879783052d
Terminal: Use gnu <start> ... <end> syntax in switch cases
2026-07-04 19:17:41 +03:00
5256fd2e0a
LibInput: Add support for right super and application keys
2026-07-04 19:11:30 +03:00
63b2284324
Kernel/LibC: support RDTSCP based clock_gettime
...
RDTSCP seems to be faster than LSL and it removes the need for getting
the current cpu twice to make sure TSC is read on the correct CPU
2026-07-03 06:32:04 +03:00
7219eac65f
Kernel: Remove unnecessary page table validation
...
Processes always have a page table when they are initialized. This was
not true a long time ago when kernel threads could also be processes
2026-07-02 20:02:24 +03:00
0dc74beb0f
Kernel/LibC: Allocate thread stacks in userspace
...
This adds support for pthread function for stack manipulation.
Also keep track of main threads stack in the uthread
2026-07-02 20:02:24 +03:00
991f7024d5
Kernel: Allow fork to fail at any point
2026-07-02 20:02:24 +03:00
6d1696b77e
Kernel: Don't allocate userspace stacks in Thread
...
Thread only cares about stack's vaddr and size. Stacks are now allocated
before creating the threads.
2026-07-02 20:02:24 +03:00
b19b7f064a
LibC: Make pthread_t pointer to uthread instead of a thread id
...
This will allow getting info about other threads in userspace!
2026-07-02 20:02:24 +03:00
f449ca8161
Kenrel: Separate pthread API from kernel API
...
It didn't really make sense for the syscalls to be named as the pthread
equivalents. Now the kernel just uses thread ids
2026-07-02 20:02:24 +03:00
5540bc4147
Kernel: Fix USB SCSI device naming
2026-07-02 20:02:24 +03:00
d8f136a76f
Kernel: Remove the weird StorageController base class
...
This wasn't really used for anything and broke nvme controller as it was
now doubly ref counted :P
2026-07-02 20:02:24 +03:00
59c59c3316
Kernel: Expose stack base/size and page size in auxv
2026-07-02 20:02:24 +03:00
d241975ce1
Kernel: Remove SYS_SLEEP and cleanup SYS_NANOSLEEP
...
`sleep` is now implemented in terms of `nanosleep`. `nanosleep` is now
more precise and handles overflow when calculating wakeup time. I don't
think anything was depending on this, but I could see a program sleeping
for max time to block until signal.
2026-07-02 15:22:52 +03:00
20663b533b
Kernel: Rework sleeping API
...
instead of sleep_{ns,ms} we now have sleep_{for,until}_{ns,ms}. This
makes code cleaner that just wants to sleep until some timestamp
2026-07-02 15:22:52 +03:00
f121e80bfd
Kernel: Fix PROT_EXEC flags in sys_mprotect
2026-06-30 20:14:38 +03:00
4e28a35af9
Kernel: Support hardware checksum offload on RTL8169 receive
2026-06-30 20:14:38 +03:00
ddb7641b05
Kernel: Support hardware checksum offload on E1000 receive
2026-06-30 20:14:38 +03:00
a6ad9b9b2e
Kernel: Add system for hardware checksum offload on received packets
2026-06-30 20:14:38 +03:00
c0bd07174d
Kernel: Reduce the number of E1000 register reads while receiving
...
There is no need to read and write the receive tail pointer for every
packet. This change bumped my TCP speed from ~11MB/s to ~40MB/s which is
my network speed limit
2026-06-30 20:14:38 +03:00
8f4e15b78e
Kernel: Use spinlocks and disable interrupts with loopback interface
...
This makes sure we don't get pre-empted after acquiring a descriptor but
before finishing marking it ready
2026-06-30 20:14:38 +03:00
17e6e53948
Kernel: Move Ethernet header prepending from NIC to helper
2026-06-30 20:14:38 +03:00
223835c37d
Kernel: Fix TCP stack sending a lot of DUP-ACKs
2026-06-30 20:14:37 +03:00
aedd53b3e0
Kernel: Disable interrupts while appending packet in E1000
...
This avoids getting rescheduled and having other packets waiting to get
sent because of that
2026-06-30 20:14:37 +03:00
6339044e4c
Kernel: Fix RTL8169 driver
...
This now works properly on real hardware. Main issue was a race
condition with now ISR was handled in the interrupt handler. We now loop
until we read back ISR as zero
2026-06-30 20:14:37 +03:00
6e47fa084b
Kernel: Fix ext2 indirect block lookup math
...
This was broken for doubly and triply indirect blocks :D
2026-06-30 20:14:37 +03:00
9919cbf66e
Kernel: Pass interpreter base address in auxiliary vector
2026-06-30 20:14:37 +03:00
fc1a6cacdc
Kernel: Optimize process stopping
2026-06-27 03:24:15 +03:00
040bdea08e
Kernel: Support volume keys from USB consumer page
2026-06-27 03:24:15 +03:00
579cd07109
Kernel: Expose process cpu time in proc filesystem
2026-06-27 03:24:15 +03:00
7bf7de44d2
Kernel: Support SO_TYPE and SO_KEEPALIVE getsockopt in UNIX socket
2026-06-27 03:24:15 +03:00
58aff97c28
Kernel: Implement getsockname for UNIX sockets
2026-06-27 03:24:15 +03:00
2bb9b9b4b3
Kernel: Don't read CR registers on every exception
2026-06-27 03:24:15 +03:00
59ec05c898
Kernel: Make TSC based timer monotonic
...
Prior to this I was just blindly rebasing the current TSC stats every
once in a while. Now I check for drift and scale the multiplier
accordingly to keep the timer from drifting
2026-06-27 03:24:15 +03:00
ac0ef53e87
Kernel: Fix HPET interrupt routing
...
If the HPET did not support legacy routing we would still use IRQ0 which
lead to using PIT irq which fired ~18 times per second
2026-06-27 03:24:15 +03:00
92d10f612e
Kernel: Make sure PCIeInfo is zero initialized
2026-06-25 01:42:02 +03:00
f3f40a465b
Kernel: Fix HDA amplifier step size calculation
...
step size is zero based, 0 means 250 mdB
2026-06-25 01:41:41 +03:00
d3130884b6
Kernel: Hack TTY to work as debug console
...
debug printing takes the debug lock, but TTY uses mutex for its lock
2026-06-25 01:41:41 +03:00
98fd86477a
Kernel: Remove allocations from path lookup
...
this bumped looped /usr/bin/ls stat performance from 750k->1100k/s
2026-05-26 19:10:16 +03:00
16a442f473
Kernel: Fix Thread::will_exit_because_of_signal
...
I was not checking whether the signal handler has been overwritten to
ignore the signal leading to infinite busy loops :)
2026-05-26 03:31:20 +03:00
becfa228fe
Kernel: fix signal handler block mask restoration
2026-05-26 03:31:20 +03:00
585e021c7f
Kernel: Don't panic when stack trace leads to GPF
...
if there is was a uncanonical address in stack trace we ended up in an
infinite recursive loop trying to print stack trace
2026-05-25 02:19:56 +03:00
954898b14d
Kernel: Fix file backed mmap syncing, my if condition was inverted
2026-05-25 02:14:04 +03:00
d266d2ca88
Kernel: Allow network interface ioctls on interfaces
...
previously it was only on the sockets
2026-05-25 02:14:04 +03:00
8fccb74542
Kernel: Add indirect block cache to ext2 inode
...
This reduces indirect block lookup by a lot :)
2026-05-25 02:14:04 +03:00
bc8ecbd6fa
Kernel: Add directory entry cache for ext2 inodes
2026-05-25 02:14:04 +03:00