mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +00:00
jinx: update mlibc port to include new system calls
This commit is contained in:
+22
-19
@@ -1,6 +1,6 @@
|
|||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/crt-x86_64/crt0.S mlibc/sysdeps/astral/crt-x86_64/crt0.S
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/crt-x86_64/crt0.S mlibc/sysdeps/astral/crt-x86_64/crt0.S
|
||||||
--- mlibc-2.3.0/sysdeps/astral/crt-x86_64/crt0.S 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/crt-x86_64/crt0.S 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/crt-x86_64/crt0.S 2022-09-17 18:39:48.098303500 -0300
|
+++ mlibc/sysdeps/astral/crt-x86_64/crt0.S 2022-09-20 15:01:45.554352200 -0300
|
||||||
@@ -0,0 +1,7 @@
|
@@ -0,0 +1,7 @@
|
||||||
+
|
+
|
||||||
+.section .text
|
+.section .text
|
||||||
@@ -11,7 +11,7 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/crt-x86_64/crt0.S mlibc/sy
|
|||||||
+
|
+
|
||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/astral.cpp mlibc/sysdeps/astral/generic/astral.cpp
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/astral.cpp mlibc/sysdeps/astral/generic/astral.cpp
|
||||||
--- mlibc-2.3.0/sysdeps/astral/generic/astral.cpp 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/generic/astral.cpp 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/generic/astral.cpp 2022-09-17 18:39:48.098303500 -0300
|
+++ mlibc/sysdeps/astral/generic/astral.cpp 2022-09-20 15:01:45.554352200 -0300
|
||||||
@@ -0,0 +1,6 @@
|
@@ -0,0 +1,6 @@
|
||||||
+#include <astral/syscall.h>
|
+#include <astral/syscall.h>
|
||||||
+
|
+
|
||||||
@@ -21,7 +21,7 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/astral.cpp mlibc/s
|
|||||||
+}
|
+}
|
||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/entry.cpp mlibc/sysdeps/astral/generic/entry.cpp
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/entry.cpp mlibc/sysdeps/astral/generic/entry.cpp
|
||||||
--- mlibc-2.3.0/sysdeps/astral/generic/entry.cpp 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/generic/entry.cpp 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/generic/entry.cpp 2022-09-17 18:39:48.098303500 -0300
|
+++ mlibc/sysdeps/astral/generic/entry.cpp 2022-09-20 15:01:45.554352200 -0300
|
||||||
@@ -0,0 +1,34 @@
|
@@ -0,0 +1,34 @@
|
||||||
+
|
+
|
||||||
+#include <stdint.h>
|
+#include <stdint.h>
|
||||||
@@ -59,8 +59,8 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/entry.cpp mlibc/sy
|
|||||||
+
|
+
|
||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/generic.cpp mlibc/sysdeps/astral/generic/generic.cpp
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/generic.cpp mlibc/sysdeps/astral/generic/generic.cpp
|
||||||
--- mlibc-2.3.0/sysdeps/astral/generic/generic.cpp 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/generic/generic.cpp 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/generic/generic.cpp 2022-09-19 21:23:54.472028200 -0300
|
+++ mlibc/sysdeps/astral/generic/generic.cpp 2022-09-20 15:34:43.778641500 -0300
|
||||||
@@ -0,0 +1,183 @@
|
@@ -0,0 +1,184 @@
|
||||||
+#include <bits/ensure.h>
|
+#include <bits/ensure.h>
|
||||||
+#include <mlibc/debug.hpp>
|
+#include <mlibc/debug.hpp>
|
||||||
+#include <mlibc/all-sysdeps.hpp>
|
+#include <mlibc/all-sysdeps.hpp>
|
||||||
@@ -72,11 +72,6 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/generic.cpp mlibc/
|
|||||||
+
|
+
|
||||||
+namespace mlibc {
|
+namespace mlibc {
|
||||||
+
|
+
|
||||||
+ int sys_waitpid(pid_t pid, int *status, int flags, pid_t *ret_pid){
|
|
||||||
+ sys_libc_log("libc: waitpid is not implemented.");
|
|
||||||
+ while(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // stub
|
+ // stub
|
||||||
+
|
+
|
||||||
+ uid_t sys_getuid(){
|
+ uid_t sys_getuid(){
|
||||||
@@ -147,6 +142,14 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/generic.cpp mlibc/
|
|||||||
+ return ENOSYS;
|
+ return ENOSYS;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ int sys_waitpid(pid_t pid, int *status, int flags, pid_t *ret_pid){
|
||||||
|
+ long ret;
|
||||||
|
+ long err = syscall(SYSCALL_WAITPID, &ret, pid, (uint64_t)status, flags);
|
||||||
|
+ *ret_pid = ret;
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+
|
||||||
+ int sys_execve(const char* name, char* const argv[], char* const envp[]){
|
+ int sys_execve(const char* name, char* const argv[], char* const envp[]){
|
||||||
+ long ret;
|
+ long ret;
|
||||||
+ return syscall(SYSCALL_EXECVE, &ret, (uint64_t)name, (uint64_t)argv, (uint64_t)envp);
|
+ return syscall(SYSCALL_EXECVE, &ret, (uint64_t)name, (uint64_t)argv, (uint64_t)envp);
|
||||||
@@ -165,16 +168,14 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/generic.cpp mlibc/
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ [[noreturn]] void sys_libc_panic(){
|
+ [[noreturn]] void sys_libc_panic(){
|
||||||
+ for(;;);
|
+ sys_libc_log("libc: panic");
|
||||||
+ sys_libc_log("LIBC PANIC!");
|
|
||||||
+ sys_exit(1);
|
+ sys_exit(1);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+
|
|
||||||
+ [[noreturn]] void sys_exit(int status){
|
+ [[noreturn]] void sys_exit(int status){
|
||||||
+ sys_libc_log("libc: Program requested exit");
|
+ syscall(SYSCALL_EXIT, NULL, status);
|
||||||
+ while(1);
|
+ __builtin_unreachable();
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ int sys_tcb_set(void* pointer){
|
+ int sys_tcb_set(void* pointer){
|
||||||
@@ -246,7 +247,7 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/generic/generic.cpp mlibc/
|
|||||||
+
|
+
|
||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/archctl.h mlibc/sysdeps/astral/include/astral/archctl.h
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/archctl.h mlibc/sysdeps/astral/include/astral/archctl.h
|
||||||
--- mlibc-2.3.0/sysdeps/astral/include/astral/archctl.h 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/include/astral/archctl.h 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/include/astral/archctl.h 2022-09-17 18:39:48.098303500 -0300
|
+++ mlibc/sysdeps/astral/include/astral/archctl.h 2022-09-20 15:01:45.554352200 -0300
|
||||||
@@ -0,0 +1,11 @@
|
@@ -0,0 +1,11 @@
|
||||||
+#ifndef _ASTRAL_SYSCALL_ARCHCTL_INCLUDE
|
+#ifndef _ASTRAL_SYSCALL_ARCHCTL_INCLUDE
|
||||||
+#define _ASTRAL_SYSCALL_ARCHCTL_INCLUDE
|
+#define _ASTRAL_SYSCALL_ARCHCTL_INCLUDE
|
||||||
@@ -261,8 +262,8 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/archctl.h m
|
|||||||
+#endif
|
+#endif
|
||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/syscall.h mlibc/sysdeps/astral/include/astral/syscall.h
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/syscall.h mlibc/sysdeps/astral/include/astral/syscall.h
|
||||||
--- mlibc-2.3.0/sysdeps/astral/include/astral/syscall.h 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/include/astral/syscall.h 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/include/astral/syscall.h 2022-09-19 21:21:41.042028200 -0300
|
+++ mlibc/sysdeps/astral/include/astral/syscall.h 2022-09-20 15:31:27.548641500 -0300
|
||||||
@@ -0,0 +1,39 @@
|
@@ -0,0 +1,41 @@
|
||||||
+#ifndef _SYSCALL_H_INCLUDE
|
+#ifndef _SYSCALL_H_INCLUDE
|
||||||
+#define _SYSCALL_H_INCLUDE
|
+#define _SYSCALL_H_INCLUDE
|
||||||
+
|
+
|
||||||
@@ -280,6 +281,8 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/syscall.h m
|
|||||||
+#define SYSCALL_FSTAT 11
|
+#define SYSCALL_FSTAT 11
|
||||||
+#define SYSCALL_FORK 12
|
+#define SYSCALL_FORK 12
|
||||||
+#define SYSCALL_EXECVE 13
|
+#define SYSCALL_EXECVE 13
|
||||||
|
+#define SYSCALL_WAITPID 14
|
||||||
|
+#define SYSCALL_EXIT 15
|
||||||
+
|
+
|
||||||
+#include <stddef.h>
|
+#include <stddef.h>
|
||||||
+#include <stdint.h>
|
+#include <stdint.h>
|
||||||
@@ -304,7 +307,7 @@ diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/include/astral/syscall.h m
|
|||||||
+#endif
|
+#endif
|
||||||
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/meson.build mlibc/sysdeps/astral/meson.build
|
diff -ruN --no-dereference mlibc-2.3.0/sysdeps/astral/meson.build mlibc/sysdeps/astral/meson.build
|
||||||
--- mlibc-2.3.0/sysdeps/astral/meson.build 1969-12-31 21:00:00.000000000 -0300
|
--- mlibc-2.3.0/sysdeps/astral/meson.build 1969-12-31 21:00:00.000000000 -0300
|
||||||
+++ mlibc/sysdeps/astral/meson.build 2022-09-17 18:39:48.098303500 -0300
|
+++ mlibc/sysdeps/astral/meson.build 2022-09-20 15:01:45.554352200 -0300
|
||||||
@@ -0,0 +1,55 @@
|
@@ -0,0 +1,55 @@
|
||||||
+
|
+
|
||||||
+rtdl_sources += files(
|
+rtdl_sources += files(
|
||||||
|
|||||||
Reference in New Issue
Block a user