kernel: getpid syscall

This commit is contained in:
Matheus
2023-05-13 22:27:53 -03:00
parent 145df46088
commit 4cc16b8462
3 changed files with 24 additions and 5 deletions
+11 -4
View File
@@ -133,10 +133,10 @@ index 0000000..e5b087a
+
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
new file mode 100644
index 0000000..30fd3b0
index 0000000..81ba749
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -0,0 +1,157 @@
@@ -0,0 +1,163 @@
+#include <bits/ensure.h>
+#include <mlibc/debug.hpp>
+#include <mlibc/all-sysdeps.hpp>
@@ -200,6 +200,12 @@ index 0000000..30fd3b0
+ return 0;
+ }
+
+ pid_t sys_getpid() {
+ long ret;
+ syscall(SYSCALL_GETPID, &ret);
+ return ret;
+ }
+
+ void sys_libc_log(const char *message) {
+ long ret;
+ syscall(SYSCALL_PRINT, &ret, (uint64_t)message);
@@ -313,10 +319,10 @@ index 0000000..990eca0
+#endif
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
new file mode 100644
index 0000000..ce00d62
index 0000000..fe5ea34
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
@@ -0,0 +1,31 @@
@@ -0,0 +1,32 @@
+#ifndef _SYSCALL_H_INCLUDE
+#define _SYSCALL_H_INCLUDE
+
@@ -328,6 +334,7 @@ index 0000000..ce00d62
+#define SYSCALL_CLOSE 5
+#define SYSCALL_ARCHCTL 6
+#define SYSCALL_WRITE 7
+#define SYSCALL_GETPID 8
+
+#include <stddef.h>
+#include <stdint.h>