[kernel] Make channels stream based

Multiple changes regarding channels. Mainly channels are now stream
based and can handle partial reads or writes. Channels now use the
kernel buffers area with the related buffer_cache. Added a fake stdout
stream channel and kernel task to read its contents to the screen in
preparation for handing channels as stdin/stdout to processes.
This commit is contained in:
2020-08-30 18:04:19 -07:00
parent f27b133089
commit 724b846ee4
10 changed files with 117 additions and 78 deletions

View File

@@ -11,25 +11,34 @@ namespace memory {
constexpr size_t frame_size = 0x1000;
/// Start of kernel memory.
constexpr uintptr_t kernel_offset = 0xffff800000000000;
constexpr uintptr_t kernel_offset = 0xffff800000000000ull;
/// Offset from physical where page tables are mapped.
constexpr uintptr_t page_offset = 0xffffc00000000000;
constexpr uintptr_t page_offset = 0xffffc00000000000ull;
/// Number of pages for a kernel stack
/// Max number of pages for a kernel stack
constexpr unsigned kernel_stack_pages = 1;
/// Max number of pages for a kernel buffer
constexpr unsigned kernel_buffer_pages = 16;
/// Max size of the kernel heap
constexpr size_t kernel_max_heap = 0x8000000000; // 512GiB
constexpr size_t kernel_max_heap = 0x8000000000ull; // 512GiB
/// Start of the kernel heap
constexpr uintptr_t heap_start = page_offset - kernel_max_heap;
/// Start of the kernel stacks
constexpr uintptr_t stacks_start = heap_start - kernel_max_heap;
/// Max size of the kernel stacks area
constexpr size_t kernel_max_stacks = 0x8000000000; // 512GiB
constexpr size_t kernel_max_stacks = 0x8000000000ull; // 512GiB
/// Start of the kernel stacks
constexpr uintptr_t stacks_start = heap_start - kernel_max_stacks;
/// Max size of kernel buffers area
constexpr size_t kernel_max_buffers = 0x10000000000ull; // 1TiB
/// Start of kernel buffers
constexpr uintptr_t buffers_start = stacks_start - kernel_max_buffers;
/// First kernel space PML4 entry
constexpr unsigned pml4e_kernel = 256;

View File

@@ -15,5 +15,5 @@ SYSCALL(0x1c, thread_sleep, uint64_t)
SYSCALL(0x20, channel_create, j6_handle_t *)
SYSCALL(0x21, channel_close, j6_handle_t)
SYSCALL(0x22, channel_send, j6_handle_t, size_t, void *)
SYSCALL(0x22, channel_send, j6_handle_t, size_t *, void *)
SYSCALL(0x23, channel_receive, j6_handle_t, size_t *, void *)