summaryrefslogtreecommitdiff
path: root/user/ulib.c
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-10 13:46:25 +0800
committerMole Shang <[email protected]>2024-02-10 13:50:34 +0800
commit3673a2cdfb30e1e3936e695a3fb8adee74488d6b (patch)
tree282b4677f47bbb15949e24b3bfa455b173a38a29 /user/ulib.c
parentf379c1c4c80947365eb6c4046c3ab165629dc8cd (diff)
parentc9284cd93525436cc823258ab309c1b27eeec714 (diff)
downloadxv6-labs-3673a2cdfb30e1e3936e695a3fb8adee74488d6b.tar.gz
xv6-labs-3673a2cdfb30e1e3936e695a3fb8adee74488d6b.tar.bz2
xv6-labs-3673a2cdfb30e1e3936e695a3fb8adee74488d6b.zip
Merge branch 'pgtbl' into traps
Conflicts: .gitignore Makefile conf/lab.mk
Diffstat (limited to 'user/ulib.c')
-rw-r--r--user/ulib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/user/ulib.c b/user/ulib.c
index c7b66c4..871adc9 100644
--- a/user/ulib.c
+++ b/user/ulib.c
@@ -1,8 +1,13 @@
#include "kernel/types.h"
#include "kernel/stat.h"
#include "kernel/fcntl.h"
+#ifdef LAB_PGTBL
+#include "kernel/riscv.h"
+#include "kernel/memlayout.h"
+#endif
#include "user/user.h"
+
//
// wrapper so that it's OK if main() does not call exit().
//
@@ -145,3 +150,12 @@ memcpy(void *dst, const void *src, uint n)
{
return memmove(dst, src, n);
}
+
+#ifdef LAB_PGTBL
+int
+ugetpid(void)
+{
+ struct usyscall *u = (struct usyscall *)USYSCALL;
+ return u->pid;
+}
+#endif