From 1d953bf6fc012167be65cdc8c6fe1197cf1d2ecc Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 11 Sep 2014 15:42:54 -0700 Subject: Support glibc 2.20 programs --- pk/elf.h | 1 + pk/file.h | 1 - pk/init.c | 1 + pk/syscall.c | 7 ++++++- pk/syscall.h | 1 + 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 -#include #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)) -- cgit v1.1