From 5cfeeede7cbf46dddfaac912094922c3c43d7db4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 27 Oct 2018 00:41:23 +0200 Subject: [PATCH] Remove the obsolete "Userspace" stuff. --- Kernel/Makefile | 1 - Kernel/Userspace.cpp | 60 -------------------------------------------- Kernel/Userspace.h | 17 ------------- Kernel/init.cpp | 22 ---------------- 4 files changed, 100 deletions(-) delete mode 100644 Kernel/Userspace.cpp delete mode 100644 Kernel/Userspace.h diff --git a/Kernel/Makefile b/Kernel/Makefile index 5c1a83e80f..982b9300da 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -13,7 +13,6 @@ KERNEL_OBJS = \ PIC.o \ Syscall.o \ Disk.o \ - Userspace.o \ IDEDiskDevice.o \ MemoryManager.o \ Console.o \ diff --git a/Kernel/Userspace.cpp b/Kernel/Userspace.cpp deleted file mode 100644 index 44587c38ae..0000000000 --- a/Kernel/Userspace.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "Userspace.h" -#include "Syscall.h" -#include "StdLib.h" - -namespace Userspace { - -int strlen(const char* str) -{ - int len = 0; - while (*(str++)) - ++len; - return len; -} - -int open(const char* path) -{ - return DO_SYSCALL_A2(Syscall::PosixOpen, path, strlen(path)); -} - -int close(int fd) -{ - return DO_SYSCALL_A1(Syscall::PosixClose, fd); -} - -int read(int fd, void* outbuf, size_t nread) -{ - return DO_SYSCALL_A3(Syscall::PosixRead, fd, outbuf, nread); -} - -int seek(int fd, int offset) -{ - return DO_SYSCALL_A2(Syscall::PosixRead, fd, offset); -} - -int kill(pid_t pid, int sig) -{ - return DO_SYSCALL_A2(Syscall::PosixKill, pid, sig); -} - -uid_t getuid() -{ - return DO_SYSCALL_A0(Syscall::PosixGetuid); -} - -void sleep(DWORD ticks) -{ - DO_SYSCALL_A1(Syscall::Sleep, ticks); -} - -void yield() -{ - DO_SYSCALL_A0(Syscall::Yield); -} - -void putch(char ch) -{ - DO_SYSCALL_A1(Syscall::PutCharacter, ch); -} - -} diff --git a/Kernel/Userspace.h b/Kernel/Userspace.h deleted file mode 100644 index 03ac13ea1f..0000000000 --- a/Kernel/Userspace.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "types.h" - -namespace Userspace { - -int open(const char* path); -int close(int fd); -int read(int fd, void* outbuf, size_t nread); -int seek(int fd, int offset); -int kill(pid_t pid, int sig); -uid_t getuid(); -void sleep(DWORD ticks); -void yield(); -void putch(char); - -} diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 7e220a6ced..b36563dc6d 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -11,7 +11,6 @@ #include "StdLib.h" #include "Syscall.h" #include "CMOS.h" -#include "Userspace.h" #include "IDEDiskDevice.h" #include #include @@ -31,7 +30,6 @@ #define KERNEL_MAP //#define STRESS_TEST_SPAWNING //#define TEST_ELF_LOADER -//#define TEST_CRASHY_USER_PROCESSES system_t system; @@ -98,22 +96,6 @@ static void loadKernelMap(const ByteBuffer& buffer) } } -#ifdef TEST_CRASHY_USER_PROCESSES -static void user_main() NORETURN; -static void user_main() -{ - DO_SYSCALL_A3(0x3000, 2, 3, 4); - // Crash ourselves! - char* x = reinterpret_cast(0xbeefbabe); - *x = 1; - HANG; - for (;;) { - // nothing? - Userspace::sleep(1 * TICKS_PER_SECOND); - } -} -#endif - static void undertaker_main() NORETURN; static void undertaker_main() { @@ -174,10 +156,6 @@ static void init_stage2() #endif -#ifdef TEST_CRASHY_USER_PROCESSES - new Task(user_main, "user", Task::Ring3); -#endif - #ifdef TEST_ELF_LOADER { auto testExecutable = vfs->open("/bin/id");