mlibc port: libc logs go to stderr now

This commit is contained in:
Matheus
2022-09-22 14:52:39 -03:00
parent 7fc34a2e66
commit b23d4f7c5b
+14 -9
View File
@@ -1,6 +1,6 @@
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/crt-x86_64/crt0.S mlibc/sysdeps/astral/crt-x86_64/crt0.S
--- mlibc-3.0.0-rc1/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-21 18:37:56.035233535 -0300
+++ mlibc/sysdeps/astral/crt-x86_64/crt0.S 2022-09-22 14:41:12.779845943 -0300
@@ -0,0 +1,7 @@
+
+.section .text
@@ -11,7 +11,7 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/crt-x86_64/crt0.S mlib
+
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/astral.cpp mlibc/sysdeps/astral/generic/astral.cpp
--- mlibc-3.0.0-rc1/sysdeps/astral/generic/astral.cpp 1969-12-31 21:00:00.000000000 -0300
+++ mlibc/sysdeps/astral/generic/astral.cpp 2022-09-21 18:37:56.035233535 -0300
+++ mlibc/sysdeps/astral/generic/astral.cpp 2022-09-22 14:41:12.779845943 -0300
@@ -0,0 +1,6 @@
+#include <astral/syscall.h>
+
@@ -21,7 +21,7 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/astral.cpp mli
+}
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/entry.cpp mlibc/sysdeps/astral/generic/entry.cpp
--- mlibc-3.0.0-rc1/sysdeps/astral/generic/entry.cpp 1969-12-31 21:00:00.000000000 -0300
+++ mlibc/sysdeps/astral/generic/entry.cpp 2022-09-21 18:37:56.035233535 -0300
+++ mlibc/sysdeps/astral/generic/entry.cpp 2022-09-22 14:41:12.779845943 -0300
@@ -0,0 +1,34 @@
+
+#include <stdint.h>
@@ -59,14 +59,15 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/entry.cpp mlib
+
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/generic.cpp mlibc/sysdeps/astral/generic/generic.cpp
--- mlibc-3.0.0-rc1/sysdeps/astral/generic/generic.cpp 1969-12-31 21:00:00.000000000 -0300
+++ mlibc/sysdeps/astral/generic/generic.cpp 2022-09-21 19:25:33.425106934 -0300
@@ -0,0 +1,184 @@
+++ mlibc/sysdeps/astral/generic/generic.cpp 2022-09-22 14:48:18.236509081 -0300
@@ -0,0 +1,189 @@
+#include <bits/ensure.h>
+#include <mlibc/debug.hpp>
+#include <mlibc/all-sysdeps.hpp>
+#include <errno.h>
+#include <astral/syscall.h>
+#include <astral/archctl.h>
+#include <string.h>
+
+#define STUB_ONLY { __ensure(!"STUB_ONLY function was called"); __builtin_unreachable(); }
+
@@ -163,8 +164,12 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/generic.cpp ml
+ }
+
+ void sys_libc_log(const char *message){
+ size_t len = strlen(message);
+ char str[len+1];
+ memcpy(str, message, len);
+ str[len] = '\n';
+ long ret;
+ syscall(SYSCALL_LIBC_LOG, &ret, (uint64_t)message);
+ sys_write(2, str, len+1, &ret);
+ }
+
+ [[noreturn]] void sys_libc_panic(){
@@ -247,7 +252,7 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/generic/generic.cpp ml
+
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/include/astral/archctl.h mlibc/sysdeps/astral/include/astral/archctl.h
--- mlibc-3.0.0-rc1/sysdeps/astral/include/astral/archctl.h 1969-12-31 21:00:00.000000000 -0300
+++ mlibc/sysdeps/astral/include/astral/archctl.h 2022-09-21 18:37:56.035233535 -0300
+++ mlibc/sysdeps/astral/include/astral/archctl.h 2022-09-22 14:41:12.779845943 -0300
@@ -0,0 +1,11 @@
+#ifndef _ASTRAL_SYSCALL_ARCHCTL_INCLUDE
+#define _ASTRAL_SYSCALL_ARCHCTL_INCLUDE
@@ -262,7 +267,7 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/include/astral/archctl
+#endif
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/include/astral/syscall.h mlibc/sysdeps/astral/include/astral/syscall.h
--- mlibc-3.0.0-rc1/sysdeps/astral/include/astral/syscall.h 1969-12-31 21:00:00.000000000 -0300
+++ mlibc/sysdeps/astral/include/astral/syscall.h 2022-09-21 18:37:56.035233535 -0300
+++ mlibc/sysdeps/astral/include/astral/syscall.h 2022-09-22 14:41:12.779845943 -0300
@@ -0,0 +1,41 @@
+#ifndef _SYSCALL_H_INCLUDE
+#define _SYSCALL_H_INCLUDE
@@ -307,7 +312,7 @@ diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/include/astral/syscall
+#endif
diff -ruN --no-dereference mlibc-3.0.0-rc1/sysdeps/astral/meson.build mlibc/sysdeps/astral/meson.build
--- mlibc-3.0.0-rc1/sysdeps/astral/meson.build 1969-12-31 21:00:00.000000000 -0300
+++ mlibc/sysdeps/astral/meson.build 2022-09-21 18:37:56.035233535 -0300
+++ mlibc/sysdeps/astral/meson.build 2022-09-22 14:41:12.779845943 -0300
@@ -0,0 +1,63 @@
+
+rtdl_sources += files(