From bde40a348877ff33649c5335a9ebe0502a606d7c Mon Sep 17 00:00:00 2001 From: Amlal Date: Fri, 25 Oct 2024 16:52:55 +0200 Subject: IMP: Cleanup source code. Signed-off-by: Amlal --- dev/crt/src/alloca.cc | 9 ------- dev/crt/src/base_exception.cc | 9 ------- dev/crt/src/hal/x86/base_alloc.cc | 55 --------------------------------------- dev/crt/src/hal/x86/exit.cc | 19 -------------- 4 files changed, 92 deletions(-) delete mode 100644 dev/crt/src/alloca.cc delete mode 100644 dev/crt/src/base_exception.cc delete mode 100644 dev/crt/src/hal/x86/base_alloc.cc delete mode 100644 dev/crt/src/hal/x86/exit.cc (limited to 'dev/crt/src') diff --git a/dev/crt/src/alloca.cc b/dev/crt/src/alloca.cc deleted file mode 100644 index ccee07a7..00000000 --- a/dev/crt/src/alloca.cc +++ /dev/null @@ -1,9 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#include - -/// @note Just here for building. diff --git a/dev/crt/src/base_exception.cc b/dev/crt/src/base_exception.cc deleted file mode 100644 index 75699f64..00000000 --- a/dev/crt/src/base_exception.cc +++ /dev/null @@ -1,9 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#include - -/// @note Just here for building. diff --git a/dev/crt/src/hal/x86/base_alloc.cc b/dev/crt/src/hal/x86/base_alloc.cc deleted file mode 100644 index 10690d4b..00000000 --- a/dev/crt/src/hal/x86/base_alloc.cc +++ /dev/null @@ -1,55 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#include -#include - -#define kAllocSyscallId "mov $10, %%r9\n\t" -#define kFreeSyscallId "mov $11, %%r9\n\t" - -void* operator new(size_t length) -{ - void* ptr = nullptr; - - // do syscall according to PEF convention. - asm("mov %0, %%r8\n\t" kAllocSyscallId - "syscall" - : "=r"(ptr)); - - if (!ptr) - std::__throw_bad_alloc(); - - return ptr; -} - -void* operator new[](size_t length) -{ - ptr_type ptr = nullptr; - - // do syscall according to PEF convention. - asm("mov %0, %%r8\n\t" kAllocSyscallId - "syscall" - : "=r"(ptr)); - - if (!ptr) - std::__throw_bad_alloc(); - - return ptr; -} - -void operator delete(void* ptr) noexcept -{ - asm("mov %0, %%r8\n\t" kFreeSyscallId - "syscall" - : "=r"(ptr)); -} - -void operator delete[](void* ptr) noexcept -{ - asm("mov %0, %%r8\n\t" kFreeSyscallId - "syscall" - : "=r"(ptr)); -} diff --git a/dev/crt/src/hal/x86/exit.cc b/dev/crt/src/hal/x86/exit.cc deleted file mode 100644 index 8ee6744b..00000000 --- a/dev/crt/src/hal/x86/exit.cc +++ /dev/null @@ -1,19 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#include - -#define kAllocSyscallId "mov $12, %%r9\n\t" - -/// @note Just here for building. -extern "C" int exit(int code) -{ - asm("mov 0, %%r8\n\t" kAllocSyscallId - "syscall" - : "=r"(code)); - - return 1; -} -- cgit v1.2.3