Kernel: Remove obsolete userspace stuff from kernel

This commit is contained in:
Bananymous 2023-04-22 15:37:45 +03:00
parent ec8b9640e2
commit 8c1f5bfe1e
5 changed files with 1 additions and 45 deletions

View File

@ -47,7 +47,6 @@ set(KERNEL_SOURCES
kernel/Thread.cpp kernel/Thread.cpp
kernel/Terminal/TTY.cpp kernel/Terminal/TTY.cpp
kernel/Terminal/VesaTerminalDriver.cpp kernel/Terminal/VesaTerminalDriver.cpp
userspace/userspace.cpp
icxxabi.cpp icxxabi.cpp
) )

View File

@ -25,13 +25,4 @@ SECTIONS
} }
g_kernel_end = .; g_kernel_end = .;
. = 0x00A00000;
g_userspace_start = .;
.userspace BLOCK(4K) : ALIGN(4K)
{
*(.userspace)
}
g_userspace_end = .;
} }

View File

@ -24,14 +24,4 @@ SECTIONS
*(.bss) *(.bss)
} }
g_kernel_end = .; g_kernel_end = .;
. = 0x00A00000;
g_userspace_start = .;
.userspace BLOCK(4K) : ALIGN(4K)
{
*(.userspace)
}
g_userspace_end = .;
} }

View File

@ -99,9 +99,6 @@ namespace BAN::Formatter
} }
extern "C" uintptr_t g_userspace_start;
extern "C" uintptr_t g_userspace_end;
extern "C" uintptr_t g_kernel_start; extern "C" uintptr_t g_kernel_start;
extern "C" uintptr_t g_kernel_end; extern "C" uintptr_t g_kernel_end;
@ -204,8 +201,7 @@ static void jump_userspace()
{ {
using namespace Kernel; using namespace Kernel;
MMU::get().map_range((uintptr_t)&g_userspace_start, (uintptr_t)&g_userspace_end - (uintptr_t)&g_userspace_start, MMU::Flags::UserSupervisor | MMU::Flags::Present); MMU::get().map_range((uintptr_t)&g_kernel_start, (uintptr_t)&g_kernel_end - (uintptr_t)&g_kernel_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MMU::get().map_range((uintptr_t)&g_kernel_start, (uintptr_t)&g_kernel_end - (uintptr_t)&g_kernel_start, MMU::Flags::UserSupervisor | MMU::Flags::Present);
MUST(Process::create_userspace("/bin/test"sv)); MUST(Process::create_userspace("/bin/test"sv));
} }

View File

@ -1,20 +0,0 @@
#include <BAN/Formatter.h>
#include <kernel/Syscall.h>
#include <unistd.h>
#define USERSPACE __attribute__((section(".userspace")))
USERSPACE void userspace_entry()
{
Kernel::syscall(SYS_WRITE, STDOUT_FILENO, "Hello World!", 12);
char buffer[128];
while (true)
{
long n_read = Kernel::syscall(SYS_READ, STDIN_FILENO, buffer, sizeof(buffer));
Kernel::syscall(SYS_WRITE, STDOUT_FILENO, buffer, n_read);
}
Kernel::syscall(SYS_EXIT);
}