Commit Graph

932 Commits

Author SHA1 Message Date
869de7283f 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
faf14b880e LibC: Rewrite all the headers.
We now have more or less posix issue 2018 conforming libc headers.

This was a really time consuming and boring operation but it had to
be done.

Now we get to actually start implementing libc :)
2023-05-26 22:31:21 +03:00
1658e925f2 Kernel: Add bareboness possibility to set termios 2023-05-26 22:31:21 +03:00
80d9f6131b Kernel/LibC: move file offset back to kernel
This makes keeping track of offsets easier and more proper
2023-05-26 22:31:21 +03:00
e0a72defa2 Kernel: Add argc and argv to process entry 2023-05-16 00:27:49 +03:00
e0a7e242f8 Kernel: Add MMUScope
This disables interrupts and loads specified mmu for the
scope it lives in
2023-05-16 00:26:39 +03:00
6acb86c14b Kernel: MMU keeps track of the current 2023-05-16 00:26:39 +03:00
729ff267d7 LibC: add function declarations to sys/stat.h 2023-05-11 15:11:33 +03:00
ff2e2937a5 Kernel: Remove offset from OpenFileDescriptor
This is now handled on the libc side. There might be reasons to
have it in kernel side, but for simplicity's sake I'm moving it
to libc for now :)
2023-05-09 20:31:22 +03:00
512be884ed Kernel: Add barebones GeneralAllocator for >4096B 2023-05-08 22:10:49 +03:00
f1667b398a Kernel: FixedWidthAllocator operates on MMU
Instead of Process* we use MMU& in FixedWidthAllocator since it is
everything it actually needs :)
2023-05-08 00:06:56 +03:00
b0ec0f1a1a Kernel: We add FixedWidthAllocators on demand
On SYS_ALLOC we will add a new FixedWidthAllocator if the old ones
are already full or we don't have one with proper size. This allows
arbitary number of allocations as long as you have enough memory
available :)

Next I will be writing a general allocator for allocations larger
than 4096 bytes which should make SYS_ALLOC syscall complete :)
2023-05-07 23:57:01 +03:00
12e42f40c5 Kernel/LibC: add free function for FixedWidthAllocator
I have to rework the syscall API and allocators in process. For
now this works well enough :)
2023-05-07 01:21:50 +03:00
bcfd838131 Kernel: Add basic fixed width allocator for userspace
We have to move process stacks to the general heap and maybe map
kernel to higher half.
2023-05-06 19:58:08 +03:00
9c07add00f Kernel: Invalid physical addresses from heap are specified now by 0 2023-05-06 17:34:22 +03:00
f36b94d039 Kernel: MMU can now provide info about virtual address space 2023-05-06 17:34:22 +03:00
e7a170c89f Kernel: 64 bit MMU now properly identity maps kernel 2023-05-05 14:19:28 +03:00
55bb0084aa Kernel: namespace and function renames
MMU moved to namespace kernel
Kernel::Memory::Heap moved to just Kernel
MMU::map_{page,range} renamed to identity_map_{page,range}

Add MMU::get_page_flags
2023-04-28 14:48:38 +03:00
dc0f8b383f Kernel: Usespace threads now have an interrupt stack 2023-04-25 14:49:18 +03:00
f1a0625b61 Kernel: TSS stack can be set after initialization 2023-04-25 14:48:12 +03:00
02b961fd7e Kernel: Stack pointer out of bounds now panics with a message 2023-04-25 13:40:55 +03:00
cd74b2167d LibC: Write mostly functioning stdio 2023-04-23 14:32:37 +03:00
792fad2a03 Kernel: d{print,warn,error}ln(...) now has a spinlock 2023-04-22 17:58:51 +03:00
cc04990ce3 Kernel: Process now frees up its pages on destruction 2023-04-22 16:54:46 +03:00
7530482cc2 Kernel: Cleanup process creation for userspace 2023-04-22 16:51:50 +03:00
fadce063a7 Kernel: Usespace programs are now ran through ELF files
only 64 bit elf files are supported for now.
2023-04-22 15:35:32 +03:00
9c506ef85b Kernel: Stack pointer is validated when updated
This allows us not to fail stack pointer when in syscall since
interrupts use their own stack
2023-04-21 10:40:24 +03:00
b1c7af38d0 Kernel: Add barebones per process virtual addresses
We now assign every (userspace) process its own MMU which we load
in scheduler. This allows every process to have separate virtual
address space.

This is very hackish implementations but it works for now
2023-04-20 00:45:41 +03:00
ea0c9b639f Kernel: Add some bareboness functionality to map virtual addresses 2023-04-19 23:51:36 +03:00
0030f035be Kernel: Rename MMU::{un,}allocate... to MMU::{un,}map
This is more appropriate name for the behaviour :D
2023-04-19 21:50:30 +03:00
e8a0df54b1 Kernel: ATAController will fail to initialize in native mode 2023-04-19 17:29:36 +03:00
33393335c8 Kernel: PCI devices now report their prog_if 2023-04-19 16:43:05 +03:00
a9a15ea2c0 Kernel: init2 is now launched as a process instead of thread
Also only process can now add threads to scheduler. Nobody should
have raw access to scheduler and everything should be through
Process::current() or irqs (reschedules)
2023-04-19 00:39:06 +03:00
d63716db96 Kernel: Process is not reference counted any more
This was not necessary and it made things needlessly complicated
2023-04-19 00:34:18 +03:00
96ac072166 Kernel: Heap allows us to take free pages.
The API is kinda weird and will probably be reworked in near future
but this will work for now :)
2023-04-18 10:18:15 +03:00
295a27f16a Kernel: Panic wont print stacktrace if it has already paniced
This prevents stack trace dump to panic and loop
2023-04-18 10:18:15 +03:00
88f60b5e41 Kernel: Map all ACPI tables on initialization
This makes their usage much easier and less error prone

They won't mapped be processes when we get to there, so this won't be
a problem
2023-04-18 10:18:15 +03:00
c5347e6707 Kernel: Reorder boot initialization
We now create the TTY as soon as possible so we can show console
output without serial port.
2023-04-18 10:18:15 +03:00
bf0c7b9ae8 Kernel: Heap implementation can now give free pages from all of RAM 2023-04-18 10:18:15 +03:00
633929629c Kernel: Start working on heap 2023-04-18 10:18:15 +03:00
fdb4eb6042 Kernel: Move kmalloc and MMU to Memory directory 2023-04-18 10:18:15 +03:00
8ee63f8264 Kernel: We can create basic userspace processes
These are still allocated on the kernel memory
2023-04-12 17:52:36 +03:00
34358b8471 Kernel: Scheduler can now terminate processes threads 2023-04-12 17:49:04 +03:00
3201c3654e Kernel: Threads now use only 4 KiB stack :) 2023-04-12 00:22:08 +03:00
5810a77cbf Kernel: Mark Scheduler::start() as noreturn as appropriate 2023-04-11 23:33:20 +03:00
aa2aee684b Kernel: remove message from BAN::Error
We don't store the error message anymore in BAN::Error.
Instead we store a error code that can be mapped into a string.
This allows BAN::Error to only take 4 bytes instead of 128.

We should also make some kernel initialization just panic instead
of returning errors since they are required for succesfull boot
anyway.
2023-04-11 23:25:21 +03:00
cfa025acae BAN: Move RefPtr to its own file and create New.h
New.h contains definitions for placement new operators and
BAN::allocator and BAN::dealloctor
2023-04-10 21:07:25 +03:00
f924ac9265 Kernel: Threads can now be terminated mid execution 2023-04-10 21:07:25 +03:00
f281543255 Kernel: Add tty to process and make termios modifiable 2023-04-05 02:53:28 +03:00
4f522d337a Kernel: Add partial support for shell
We don't handle arrow keys, and the tty does not know how to clear
the screeen :D
2023-04-05 01:30:58 +03:00