diff options
| author | Frans Kaashoek <kaashoek@mit.edu> | 2022-09-19 17:19:32 -0400 |
|---|---|---|
| committer | Frans Kaashoek <kaashoek@mit.edu> | 2022-09-19 17:19:32 -0400 |
| commit | b1083ee059a2aa0e018676f4f3790cb3bafaa1c5 (patch) | |
| tree | cfacff0e94df41b092fcfda9cdabd854b5b38945 /user/ulib.c | |
| parent | 4b46c0c6eb464782faa36d158246ba4e3238c970 (diff) | |
| download | xv6-labs-2022-origin/pgtbl.tar.xz xv6-labs-2022-origin/pgtbl.zip | |
pgtblorigin/pgtbl
Diffstat (limited to 'user/ulib.c')
| -rw-r--r-- | user/ulib.c | 14 |
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 |
