diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-10-25 16:52:55 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-10-25 16:52:55 +0200 |
| commit | bde40a348877ff33649c5335a9ebe0502a606d7c (patch) | |
| tree | 0aaf2821c8436afd9ba7f74a28b6e97ae2a795d2 /dev/crt/src | |
| parent | 5c319a1b4d08ce784f164aa5d073af71336e1547 (diff) | |
IMP: Cleanup source code.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/crt/src')
| -rw-r--r-- | dev/crt/src/alloca.cc | 9 | ||||
| -rw-r--r-- | dev/crt/src/base_exception.cc | 9 | ||||
| -rw-r--r-- | dev/crt/src/hal/x86/base_alloc.cc | 55 | ||||
| -rw-r--r-- | dev/crt/src/hal/x86/exit.cc | 19 |
4 files changed, 0 insertions, 92 deletions
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 <crt/alloca.h>
-
-/// @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 <crt/base_exception.h>
-
-/// @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 <crt/base_alloc.h> -#include <crt/base_exception.h> - -#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 <crt/exit.h>
-
-#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;
-}
|
