kboot: Reimplement older system calls in terms of newer ones
aarch64 doesn't have open, just openat, etc. Cope. Sponsored by: Netflix
This commit is contained in:
parent
f5ed1b0f84
commit
edc23ddf9c
@ -1,13 +1,13 @@
|
||||
#define SYS_close 3
|
||||
#define SYS_getdents 78
|
||||
#define SYS_gettimeofday 96
|
||||
#define SYS_lseek 8
|
||||
#define SYS_kexec_load 246
|
||||
#define SYS_lseek 8
|
||||
#define SYS_mmap 9
|
||||
#define SYS_open 2
|
||||
#define SYS_openat 257
|
||||
#define SYS_pselect6 270
|
||||
#define SYS_read 0
|
||||
#define SYS_reboot 169
|
||||
#define SYS_select 23
|
||||
#define SYS_uname 63
|
||||
#define SYS_write 1
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
#define SYS_kexec_load 268
|
||||
#define SYS_llseek 140
|
||||
#define SYS_mmap 90
|
||||
#define SYS_open 5
|
||||
#define SYS_openat 286
|
||||
#define SYS_pselect6 280
|
||||
#define SYS_read 3
|
||||
#define SYS_reboot 88
|
||||
#define SYS_select 142
|
||||
#define SYS_uname 120
|
||||
#define SYS_write 4
|
||||
|
||||
|
@ -48,6 +48,8 @@ struct host_timeval {
|
||||
long tv_usec;
|
||||
};
|
||||
|
||||
#define HOST_AT_FDCWD -100 /* Relative to current directory */
|
||||
|
||||
/*
|
||||
* System Calls
|
||||
*/
|
||||
|
@ -54,7 +54,7 @@ host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off)
|
||||
int
|
||||
host_open(const char *path, int flags, int mode)
|
||||
{
|
||||
return host_syscall(SYS_open, (uintptr_t)path, flags, mode);
|
||||
return host_syscall(SYS_openat, HOST_AT_FDCWD, (uintptr_t)path, flags, mode);
|
||||
/* XXX original overrode errors */
|
||||
}
|
||||
|
||||
@ -75,7 +75,15 @@ int
|
||||
host_select(int nfds, long *readfds, long *writefds, long *exceptfds,
|
||||
struct host_timeval *timeout)
|
||||
{
|
||||
return host_syscall(SYS_select, nfds, (uintptr_t)readfds, (uintptr_t)writefds, (uintptr_t)exceptfds, (uintptr_t)timeout, 0);
|
||||
struct timespec ts = { .tv_sec = timeout->tv_sec, .tv_nsec = timeout->tv_usec * 1000 };
|
||||
|
||||
/*
|
||||
* Note, final arg is a sigset_argpack since most arch can only have 6
|
||||
* syscall args. Since we're not masking signals, though, we can just
|
||||
* pass a NULL.
|
||||
*/
|
||||
return host_syscall(SYS_pselect6, nfds, (uintptr_t)readfds, (uintptr_t)writefds,
|
||||
(uintptr_t)exceptfds, (uintptr_t)&ts, (uintptr_t)NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
x
Reference in New Issue
Block a user