Commit Graph

212 Commits

Author SHA1 Message Date
Bananymous b89bafa165 Kernel: Add support for power button shutdown
This patch implements basic support for power button using ACPI
fixed events. I still need to implement general purpose events
and embedded controller for full power button support.
2024-04-15 23:55:25 +03:00
Bananymous cdbdc1a822 Kernel: Remove lai as a dependecy
I don't think lai is needed anymore, since my own AML interpreter
can do ACPI poweroff which was all that lai was used for.
2024-04-10 04:39:48 +03:00
Bananymous 5050047cef Kernel: Rewrite whole scheduler
Current context saving was very hacky and dependant on compiler
behaviour that was not consistent. Now we always use iret for
context saving. This makes everything more clean.
2024-03-29 18:02:12 +02:00
Bananymous 1b65f850ee Kernel: Rename thread stacks to more appropriate names 2024-03-27 15:06:24 +02:00
Bananymous 93975fdc45 Kernel: Process signal mask is now 2 32 bit values
This allows signal mask to be atomic on 32 bit target
2024-03-26 02:46:51 +02:00
Bananymous fe17958b9f Kernel: Rename rsp->sp and rip->ip
This makes more sense if we support i386
2024-03-22 15:41:15 +02:00
Bananymous 0424082e7b Kernel: Only compile lai for x86_64 targets
I will be dropping lai entirely soon. Once I get to writing AML
interpreter.
2024-03-22 15:41:15 +02:00
Bananymous 9607b4205a Kernel: Fix kernel panic on signal
Signals are now added/handled without Scheduler's lock
2024-03-18 16:05:47 +02:00
Bananymous e636dce919 Kernel: Rewrite scheduler thread lists
Scheduler now has its own data SchedulerQueue which holds active nad
blocking thread lists. This removes need for BAN/Errors.h and making
current thread separate element instead of iterator into linked list.
This makes it possible to have current_thread on each processor
instead of a global one in Scheduler.
2024-03-08 22:13:45 +02:00
Bananymous 8141b9977d Kernel: Per processor information is now stored in class Processor
This allows us to allocate processor stacks, and other per processor
structures dynamically in runtime. Giving processor stack to
ap_trampoline feels super hacky, but it works for now.
2024-03-03 22:30:06 +02:00
Bananymous 8d7dd577ab Kernel: Replace last CriticalScopes in kernel with SpinLocks 2024-03-01 15:49:39 +02:00
Bananymous 02ad199138 Kernel: Move interrupt status functions to kernel/Interrupts.h 2024-03-01 02:13:28 +02:00
Bananymous 65c4f9db5b Kernel: Replace CriticalScopes with SpinLocks in Process/Thread 2024-03-01 02:13:28 +02:00
Bananymous d94f6388b7 Kernel: Fix all broken locks from new mutexes 2024-02-28 22:45:34 +02:00
Bananymous 2ab3eb4109 Kernel: Fix bugs in select
Unix domain socket is now select readable when it has pending
connection
2024-02-12 23:46:27 +02:00
Bananymous 9314528b9b Kernel: Improve syscall handling
Syscalls are now called from a list of function pointers
2024-02-12 21:51:11 +02:00
Bananymous 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
Bananymous ff49d8b84f Kernel: Cleanup OSI layer overlapping 2024-02-09 17:05:07 +02:00
Bananymous ed0b1a86aa Kernel: Semaphores and Threads can now be blocked with timeout 2024-02-09 15:28:15 +02:00
Bananymous e7dd03e551 Kernel: Implement basic connection-mode unix domain sockets 2024-02-08 02:28:19 +02:00
Bananymous 572c4052f6 Kernel: Fix Process APIs 2024-02-07 15:57:45 +02:00
Bananymous 132286895f Kernel: Implement Socket inodes for tmpfs 2024-02-07 15:57:45 +02:00
Bananymous 41cad88d6e Kernel/LibC: Implement dummy syscalls for accept, connect, listen 2024-02-07 15:57:45 +02:00
Bananymous e1ffbb710b Kernel/LibC: Implement basic ioctl for network addresses 2024-02-03 01:50:10 +02:00
Bananymous 0f154c3173 Kernel: Implement basic recvfrom 2024-02-02 13:50:00 +02:00
Bananymous ec2f21bb9f Kernel/LibC: Implement SYS_SENDTO 2024-02-02 03:16:01 +02:00
Bananymous ab150b458a Kernel/LibC: Implement basic socket binding 2024-02-02 01:31:58 +02:00
Bananymous cf28ecd5a6 Kernel/LibC: Add SYS_SOCKET 2024-02-01 23:39:09 +02:00
Bananymous 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
Bananymous 5001fa58e0 Kernel: Fix wait syscall with atomics 2024-01-24 14:32:52 +02:00
Bananymous ab39c6541a Kernel: Require keymap loading superuser privileges 2024-01-10 14:50:30 +02:00
Bananymous 51214ea1bf Kernel: Add load_keymap syscall and load Finnish keymap in init 2024-01-10 14:46:29 +02:00
Bananymous d2d12d5281 Kernel: validate_{string,pointer}_access now return ErrorOr<void>
Now that signals are only processed when returning to userspace,
address validation has to do an early return.
2024-01-03 23:53:04 +02:00
Bananymous 0ba278041b Kernel: Start exec by loading the ELF file. It might not exist... 2024-01-03 23:50:02 +02:00
Bananymous 9fa13079f2 Kernel: Implement supplementary groups
This code has very ugly file parsing code. I have to create API
for reading files line by line in kernel space...

This allows users to open framebuffer/input files without root.

Mounting has to be moved to userspace soon. It makes no sense to
hard code permissions for every (device) file.
2024-01-02 23:24:32 +02:00
Bananymous 96d831c31a Kernel/LibC/Userspace: Implement chown and set tty owner on login 2024-01-02 22:19:38 +02:00
Bananymous e227a87140 Kernel: Allow creating directories if path ends with '/'
Also create and create_dir will now fail with EEXISTS if file exists
2023-12-14 10:56:53 +02:00
Bananymous 24b71d1170 Kernel: Appreciate setuid and setgid bits executables 2023-12-06 18:14:27 +02:00
Bananymous 393ac33e3c Kernel: Make sys_nanosleep interruptable by signals 2023-12-06 16:22:24 +02:00
Bananymous deeb6d2756 Kernel: Cleanup sys_sleep() and TTY::read_impl 2023-12-06 16:21:22 +02:00
Bananymous a12ffaa8a2 Kernel: Make sleep syscall interruptable 2023-12-06 13:13:37 +02:00
Bananymous 1c78671078 Kernel: Rework all signal code
Signal handling code was way too complex. Now everything is
simplified and there is no need for ThreadBlockers.

Only complication that this patch includes is that blocking syscalls
have to manually be made interruptable by signal. There might be some
clever solution to combat this is make this happen automatically.
2023-12-06 13:02:17 +02:00
Bananymous cdcc36efde Kernel: Remove unnecessary raise syscall 2023-12-06 13:00:45 +02:00
Bananymous 4a87d6052b Kernel: Add API for implementing mmappable devices 2023-11-28 23:50:49 +02:00
Bananymous 09b7cb2f33 Kernel/LibC: Implement pread() 2023-11-28 23:47:30 +02:00
Bananymous 60e755210c Kernel/LibC: Implement very basic msync 2023-11-22 22:44:06 +02:00
Bananymous c084ce8b01 Kernel/LibC: Implement readlink and readlinkat 2023-11-11 23:16:52 +02:00
Bananymous 87ff38664a Kernel/LibC: Add syscall and wrapper for unlink 2023-10-25 21:45:04 +03:00
Bananymous 6ee4d10651 Kernel/LibC/Userspace: Implement mkdir and creat
Touch now uses creat insteadd of open with O_CREAT flag
2023-10-25 21:07:26 +03:00
Bananymous 18e90d305d Kernel: Add Inode API for creating directories 2023-10-25 19:36:04 +03:00