Commit Graph

281 Commits

Author SHA1 Message Date
388f530edd Kernel: Add GeneralAllocator::paddr_of
Yoy can now query physical address of a virtual address for general
allocator allocation
2023-06-18 23:25:51 +03:00
714305ef56 Kernel: General allocator takes first valid vaddr as parameter 2023-06-17 22:23:34 +03:00
32e1473c94 Kernel: Make disk IO blocking thread safe
This was causing a lot of deadlocks on vms without kvm accel
2023-06-12 18:57:47 +03:00
bf617036c7 Kernel: Rework syscall calling
I removed the intermediate function when calling syscalls. Now syscall
handler calls the current process automatically. Only exception is
sys_fork, since it needs a assembly trampoline for the new thread.
2023-06-12 14:16:48 +03:00
ce55422a24 Kernel: Remove Shell from kernel
This is now obsolete since we have a userspace Shell.
2023-06-12 02:04:52 +03:00
0f63cfa43f Kernel/LibC: add SYS_{SET,GET}_PWD and chdir, getpwd 2023-06-12 02:02:52 +03:00
b254ade69b Kernel: Add SYS_GET_{,E}{UID,GID} 2023-06-11 22:37:00 +03:00
ef4ebaa969 Kernel: Add syscalls for set{,e,re}{uid,gid} 2023-06-11 22:37:00 +03:00
c62e820bcf Kernel: Add basic Credentials for the system
Now filesystem access/open, etc confirm that you have access for rwxs
2023-06-11 20:06:06 +03:00
5aed186827 Kernel: Add SYS_OPENAT 2023-06-11 03:29:22 +03:00
e209ca7c82 Kernel: Rewrite directory listing so it can be integrated to libc 2023-06-11 00:17:18 +03:00
db49cbd6e2 Kernel: We now store the processes exit code 2023-06-10 17:31:56 +03:00
27cef23823 Kernel: Scheduler now has reschedule()
This can be called from anywhere and just causes the scheduler to
schedule the next thread. This is more efficient and verbose version
of Scheduler::set_current_thread_sleeping(0), since we don't have
to wake other threads or do other verifications.
2023-06-09 00:47:17 +03:00
b7fc2dc3d0 Kenrel: Rename Scheduler::reschedule -> Scheduler::timer_reschedule 2023-06-09 00:41:43 +03:00
8af390e0f6 Kernel: Big commit. Rewrite ELF loading code
We now load ELF files to VirtualRanges instead of using kmalloc.
We have only a fixed 1 MiB kmalloc for big allocations and this
allows loading files even when they don't fit in there.

This caused me to rewrite the whole ELF loading process since the
loaded ELF is not in memory mapped by every process.

Virtual ranges allow you to zero out the memory and to copy into
them from arbitary byte buffers.
2023-06-09 00:37:43 +03:00
96d6453ea8 Kernel: PageTableScope locks the PageTable before disabling interrupts
This allows replacing some PageTableScopes with PageTable::lock()
2023-06-09 00:34:41 +03:00
86f58f60cb LibC: implement setenv, unsetenv, putenv 2023-06-05 22:51:02 +03:00
064ce568c2 Kernel: add basic support for environment variables
exec functions will search files from PATH
2023-06-05 22:51:02 +03:00
0b1b4d8f7e Kernel: exec now has better posix errors 2023-06-05 21:12:08 +03:00
b0e9ab0519 Kernel/LibC: pass environ pointer to process 2023-06-05 21:12:08 +03:00
5425394880 Kernel: TTY now supports CSI s and u
These are commonly supported values to save and load cursor
position
2023-06-05 18:19:13 +03:00
9d64dbd5c2 Kernel/LibC: add SYS_STAT and stat(), lstat() 2023-06-05 14:37:14 +03:00
b68d5a5833 Kernel: Add SYS_WAIT
This syscall waits for a given pid.
2023-06-04 18:00:52 +03:00
924fc2118c Kernel: Allocators are now stored in UniqPtr
This allows proper memory management, we had some memory leak
2023-06-04 01:25:57 +03:00
51f4c0c750 Kernel: make load_elf() its own function 2023-06-04 01:24:11 +03:00
37b93da650 Kernel: PhysicalRange maps its nodes to kernel vaddr space
This keeps the lower half of address space cleaner
2023-06-04 01:20:47 +03:00
8352392b38 Kernel: You can specify first vaddr for getting free pages 2023-06-04 01:15:48 +03:00
dc1aff58ed Kernel: PAGE_FLAG_MASK is now only 0xF
We don't care currenly about anything but the last few bits
2023-06-03 20:08:13 +03:00
9f75d9cfe5 Kernel: PageTable now has debug_dump
This dumps all the mapped pages and their flags
2023-06-03 20:08:13 +03:00
a4cb5d8360 Kernel: Inode/Device detection is done with overridden bool functions 2023-06-03 13:28:15 +03:00
59b807189f Kernel: add basic disk cache
ATADevices now add disk cache to themselves
2023-06-03 02:23:14 +03:00
fb1c7015b1 Kernel: Shell 'memory' now prints heap memory usage 2023-06-03 02:22:18 +03:00
4d4d0e26a9 Kernel: Symlinks are now working
We still have to implement loop or depth detection
2023-06-02 11:43:46 +03:00
232fdcb82c Kernel: add basic support for symlinks 2023-06-01 00:24:45 +03:00
4da1d6fd27 Kernel: Implement Process::exec() 2023-05-31 20:56:29 +03:00
909e847369 Kernel: Move userspace entry functions to Process instead of Thread 2023-05-31 19:31:10 +03:00
ed0dcacab3 Kernel: Move V2P and P2V to Memory/Types.h 2023-05-30 23:57:03 +03:00
57f7da6ce1 Kernel: Booting with higher half kernel gets to Heap initialization 2023-05-30 22:21:12 +03:00
e640344d7a Kernel: Rename MMU to PageTable
This is more descriptive name for what it actually represents
2023-05-29 21:06:09 +03:00
7151bb86a8 Kernel/LibC: opening standard files is done in libc 2023-05-29 20:21:19 +03:00
dd3f34cb2c Kernel: Make RecursiveSpinLock thread safe
also SpinLock is now implemented with gcc builtins
2023-05-29 19:38:09 +03:00
282bf24f65 Kernel: fork() now copies allocations through FixedWidthAllocator 2023-05-28 21:34:35 +03:00
f964f6be8d Kernel: Move page macros to Types.h 2023-05-28 21:03:08 +03:00
0202ccec5f Kernel: ISR will now crash userspace process instead of panicing kernel 2023-05-28 20:53:10 +03:00
636c308993 Kernel: fork() now copies allocation done through GeneralAllocator 2023-05-28 20:37:39 +03:00
6fdbe6f9c2 Kernel: Add bareboness fork() function 2023-05-28 18:08:49 +03:00
c19f4c019a Kernel: Add invalidate() to MMU 2023-05-28 18:05:49 +03:00
0129619d9a Kernel: Processes and Threads use VirtualRange memory allocations 2023-05-28 17:48:34 +03:00
e0479b291d Kernel: Move PhysicalRange to its own file and add VirtualRange 2023-05-28 17:48:34 +03:00
b847d7dfd5 Kernel: MMU::get() is now MMU::kernel
MMU is can now be locked with RecursiveSpinLock.

Scheduler now has get_current_tid() that works before the Scheduler
is initialized. This allows RecursiveSpinLock usage early on.
2023-05-28 16:18:18 +03:00