aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@eecs.berkeley.edu>2014-09-11 15:42:54 -0700
committerAndrew Waterman <waterman@eecs.berkeley.edu>2014-09-11 15:43:05 -0700
commit1d953bf6fc012167be65cdc8c6fe1197cf1d2ecc (patch)
treed753df45ccb27374c2a90a29bf5dd9e12af7dda6
parent024053cd98c3bfc0bf6a9c4c219c9fb030f4a660 (diff)
downloadpk-1d953bf6fc012167be65cdc8c6fe1197cf1d2ecc.zip
pk-1d953bf6fc012167be65cdc8c6fe1197cf1d2ecc.tar.gz
pk-1d953bf6fc012167be65cdc8c6fe1197cf1d2ecc.tar.bz2
Support glibc 2.20 programs
-rw-r--r--pk/elf.h1
-rw-r--r--pk/file.h1
-rw-r--r--pk/init.c1
-rw-r--r--pk/syscall.c7
-rw-r--r--pk/syscall.h1
5 files changed, 9 insertions, 2 deletions
diff --git a/pk/elf.h b/pk/elf.h
index cb55307..dfe6c63 100644
--- a/pk/elf.h
+++ b/pk/elf.h
@@ -22,6 +22,7 @@
#define AT_PAGESZ 6
#define AT_ENTRY 9
#define AT_SECURE 23
+#define AT_RANDOM 25
typedef struct {
uint8_t e_ident[16];
diff --git a/pk/file.h b/pk/file.h
index c5b0f4b..cc7838d 100644
--- a/pk/file.h
+++ b/pk/file.h
@@ -4,7 +4,6 @@
#define _FILE_H
#include <sys/stat.h>
-#include <machine/syscall.h>
#include "atomic.h"
typedef struct file
diff --git a/pk/init.c b/pk/init.c
index e6a97c3..53a014f 100644
--- a/pk/init.c
+++ b/pk/init.c
@@ -98,6 +98,7 @@ static void user_init(struct mainvars* args)
{AT_PHDR, current.phdr},
{AT_PAGESZ, RISCV_PGSIZE},
{AT_SECURE, 0},
+ {AT_RANDOM, stack_top},
{AT_NULL, 0}
};
diff --git a/pk/syscall.c b/pk/syscall.c
index add12ce..f9e0664 100644
--- a/pk/syscall.c
+++ b/pk/syscall.c
@@ -379,12 +379,16 @@ ssize_t sys_writev(int fd, const void* iov, int cnt)
return ret;
}
-
int sys_getdents(int fd, void* dirbuf, int count)
{
return 0; //stub
}
+int sys_nosys()
+{
+ return -ENOSYS;
+}
+
long syscall(long a0, long a1, long a2, long a3, long a4, long a5, long n)
{
const static void* syscall_table[] = {
@@ -426,6 +430,7 @@ long syscall(long a0, long a1, long a2, long a3, long a4, long a5, long n)
[SYS_fcntl] = sys_fcntl,
[SYS_getdents] = sys_getdents,
[SYS_dup] = sys_dup,
+ [SYS_readlinkat] = sys_nosys,
};
if(n >= ARRAY_SIZE(syscall_table) || !syscall_table[n])
diff --git a/pk/syscall.h b/pk/syscall.h
index 5d6bbf0..79c4eb1 100644
--- a/pk/syscall.h
+++ b/pk/syscall.h
@@ -45,6 +45,7 @@
#define SYS_fcntl 25
#define SYS_getdents 61
#define SYS_dup 23
+#define SYS_readlinkat 78
#define IS_ERR_VALUE(x) ((unsigned long)(x) >= (unsigned long)-4096)
#define ERR_PTR(x) ((void*)(long)(x))