Commit Graph

112 Commits

Author SHA1 Message Date
40d1d20cd6 Kernel: Move cursor handling from TTY -> TerminalDriver 2025-04-18 02:43:41 +03:00
c0942d78cb Kernel: Fix TTY ANSI ? handling 2025-04-18 02:42:49 +03:00
cef8779bf7 Kernel: Improve error handling when setting TTY font 2025-04-18 02:42:24 +03:00
554b13ac50 Kernel: Restructure terminal initialization
This is still very ugly and will be rewritten in the future :D
2025-04-18 01:19:59 +03:00
439fb57d88 Kernel: Fix ANSI CSI @ and b for VirtualTTY 2025-04-17 23:24:17 +03:00
f9b70d1b5b Kernel: Don't enter infinite loop on unexpected serial behaviour 2025-02-06 20:59:17 +02:00
faa5252191 Kernel: Fix TTY ANSI CSI m and prevent crash :) 2025-02-06 20:58:03 +02:00
d1c3d3d5aa Kernel: Fix ANSI CSI L
With my new memcpy implementation this crashed. I have no idea how this
was not crashing before :D
2025-01-28 18:41:53 +02:00
69137cddab Kernel: Implement TIOCSWINSZ for pseudo terminals
I have no idea how I had forgotten this
2024-12-21 03:22:48 +02:00
12a37500b0 Kernel: Fix triple-fault in vitual tty
This was happening when printing non-utf8 data while having virtual tty
as the debug console.
2024-12-09 03:35:51 +02:00
51b6329c86 Kernel: Make backspace \b and delete 0x7F
This is what `vim` seems to expect and imo makes way more sense.
2024-12-05 17:34:37 +02:00
aaff5a65e1 Kernel/init: /dev/tty is now custom symlink to controlling terminal
kernel now passes the name of default console to init process so init
knows which file to open as stdio. before /dev/tty was referencing the
system wide current terminal which was inherited from cmdline. This
doesn't work anymore as we have pseudo terminals implemented that can
chage the current terminal during runtime :D
2024-11-17 22:38:52 +02:00
1838ea5c30 Kernel: Fix pseudo terminal leaks 2024-11-04 15:35:07 +02:00
b6e040dfc2 Kernel/Shell: Fix backspace and delete key byte sequences 2024-10-04 04:14:47 +03:00
2d11ce9669 Kernel: Fix interrupt system
I had not understood how MSIs work and I was unnecessarily routing them
through IOAPIC. This is not necessary and should not be done :D

Also MSIs were reserving interrupts that IOAPIC was capable of
generating. Now IOAPIC and MSIs use different set of interrupts so
IOAPIC can use more interrupts if needed.
2024-09-27 15:31:31 +03:00
b89fc3fe87 Kernel: Implement ANSI SGR 7 to invert colors
This allows vim's visual selection to show up
2024-09-26 15:08:11 +03:00
348d04f7f5 Kernel: Implement static Process::kill()
This allows killing processes even when there does not exist a current
thread.
2024-09-24 13:16:43 +03:00
d59463d11b Kernel: Fix TTY reading one keyevent after disabling input handling 2024-09-22 17:13:10 +03:00
8e08046519 Kernel: Add asserts about having locked TTY's write lock
This for some reason fixes booting on real hardware? :D
2024-09-18 00:56:48 +03:00
2911d1f018 Kernel: Cleanup and fix pseudo terminals 2024-09-15 02:38:07 +03:00
d68ad893f0 Kernel/Shell: Add support for delete key 2024-09-14 22:45:48 +03:00
7c4b9218f2 Kernel: VirtualTTY now resets ansi state before printing anything 2024-08-25 17:56:06 +03:00
37cd4ed504 Kernel: Add support for CSI @, b, d to VirtualTerminal 2024-08-22 14:04:45 +03:00
723e458bd7 Kernel/Terminal: Update terminal color themes and fix TTY bright/dark 2024-08-12 21:15:55 +03:00
a5a097fa4a Kernel/LibC: Add initial pseudo terminal support
This patch implements posix_openpt() and ptsname()

grantpt() and unlockpt() are left in LibC as stubs, as posix_openpt
currently does all of the needed work.
2024-08-11 01:02:59 +03:00
7e7c3a1bb3 Kernel: VirtualTTY now handles dark colors
I have seemingly forgot to add these before
2024-08-09 15:52:42 +03:00
e72424e01a Kernel: Implement ANSI CSI M and fix ANSI CSI L
There are not maybe not correct, but work much better than the old ones
2024-08-05 15:53:01 +03:00
a578527012 Kernel/LibC: Implement ioctl(TIOCGWINSZ)
This allows ncurses to get the window size!
2024-08-01 22:56:26 +03:00
af78a2d080 Kernel: Implement ANSI CSI L for TTY
vim seems to be using this, so I decided its needed
2024-08-01 22:08:46 +03:00
9ea4c777ad Kernel: TTY now handles ESC key presses
This allows exiting vim :D
2024-08-01 21:41:11 +03:00
681d8327f5 LibC/Kernel: Cleanup termios code
This is still not correct, but much better than it used to be
2024-07-30 11:10:43 +03:00
f8261c60c0 Kernel: Rewrite the whole scheduler and re-architecture SMP handling
Change Semaphore -> ThreadBlocker
  This was not a semaphore, I just named it one because I didn't know
  what semaphore was. I have meant to change this sooner, but it was in
  no way urgent :D

Implement SMP events. Processors can now be sent SMP events through
IPIs. SMP events can be sent either to a single processor or broadcasted
to every processor.

PageTable::{map_page,map_range,unmap_page,unmap_range}() now send SMP
event to invalidate TLB caches for the changed pages.

Scheduler no longer uses a global run queue. Each processor has its own
scheduler that keeps track of the load on the processor. Once every
second schedulers do load balancing. Schedulers have no access to other
processors' schedulers, they just see approximate loads. If scheduler
decides that it has too much load, it will send a thread to another
processor through a SMP event.

Schedulers are currently run using the timer interrupt on BSB. This
should be not the case, and each processor should use its LAPIC timer
for interrupts. There is no reason to broadcast SMP event to all
processors when BSB gets timer interrupt.

Old scheduler only achieved 20% idle load on qemu. That was probably a
very inefficient implementation. This new scheduler seems to average
around 1% idle load. This is much closer to what I would expect. On my
own laptop idle load seems to be only around 0.5% on each processor.
2024-07-22 00:33:50 +03:00
7a0fb9a57f Kernel: Fix TTY scroll clearing first and/or last characters from line 2024-07-16 22:49:49 +03:00
58fcd2b2fe Kernel: Fix multi-interface USB device initialization 2024-07-16 22:29:18 +03:00
a5cb4057f9 Kernel: Implement unified input files for device hot-plugging support
/dev/keyboard and /dev/mouse can be read for events from any attached
keyboard or mouse respectively. This makes device hot-plugging support
pretty much automatic for TTY, GUI, and whatever takes input.
2024-07-15 22:11:15 +03:00
a97a574718 Kernel: Rewrite the whole input system
PS/2 code is now kind of messed up, but it works. Keyboards and mice are
now an abstract class that is automatically exposed to userspace. This
will make adding USB input much nicer.
2024-07-14 01:53:50 +03:00
5dc441c4af Kernel/userspace: Implement KD_LOADFONT and loadfont program 2024-07-03 09:02:49 +03:00
42237a3bc8 Kernel: Implement fast scrolling for TTY 2024-06-28 23:15:03 +03:00
67dfe0bcf3 BAN: Allow String::formatted to fail 2024-06-25 11:04:03 +03:00
318ce5dec8 All: Fix a lot of compiler warnings from header files
While reworking build system, header files started to report warnings.
2024-06-18 23:02:10 +03:00
511fc870a1 BAN: Mark RefPtr and WeakPtr operator bool() as explicit 2024-06-17 20:19:36 +03:00
0501f3bd99 Kernel: Move font code to its own library LibFont 2024-05-31 10:47:05 +03:00
8bc6c2eb20 Kernel: Move KeyEvent/MouseEvent from kernel to LibInput 2024-05-28 23:30:08 +03:00
51e38b7614 Kernel: Replace CriticalScope with SpinLock in SerialTTY 2024-02-29 19:17:28 +02:00
d94f6388b7 Kernel: Fix all broken locks from new mutexes 2024-02-28 22:45:34 +02:00
9594ee8e47 Kernel: Start making device numbers unique for each device 2024-02-22 15:53:48 +02:00
9314528b9b Kernel: Improve syscall handling
Syscalls are now called from a list of function pointers
2024-02-12 21:51:11 +02:00
3fc1edede0 Kernel/LibC: Implement super basic select
This does not really even block but it works... :D
2024-02-12 17:26:33 +02:00
ed0b1a86aa Kernel: Semaphores and Threads can now be blocked with timeout 2024-02-09 15:28:15 +02:00
dfe5a2d665 All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00