Browse Source

Support glibc 2.20 programs

pull/3/head
Andrew Waterman 12 years ago
parent
commit
1d953bf6fc
  1. 1
      pk/elf.h
  2. 1
      pk/file.h
  3. 1
      pk/init.c
  4. 7
      pk/syscall.c
  5. 1
      pk/syscall.h

1
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];

1
pk/file.h

@ -4,7 +4,6 @@
#define _FILE_H
#include <sys/stat.h>
#include <machine/syscall.h>
#include "atomic.h"
typedef struct file

1
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}
};

7
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])

1
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))

Loading…
Cancel
Save