From 735169091f6826413e6b7adb07b08bf66475e5b0 Mon Sep 17 00:00:00 2001 From: brabo Date: Mon, 13 Mar 2017 23:59:17 +0100 Subject: [PATCH] switched gettimeofday syscall to clock_gettime and added clock_settime, insane-adding-machines/frosted#120 --- include/sys/frosted.h | 169 ++++++++++++++++++++--------------------- sys/frosted_syscalls.c | 27 ++----- 2 files changed, 89 insertions(+), 107 deletions(-) diff --git a/include/sys/frosted.h b/include/sys/frosted.h index d655220..d028e28 100644 --- a/include/sys/frosted.h +++ b/include/sys/frosted.h @@ -12,89 +12,86 @@ #define SYS_SEEK (8) #define SYS_MKDIR (9) #define SYS_UNLINK (10) -#define SYS_GETTIMEOFDAY (11) -#define SYS_MALLOC (12) -#define SYS_FREE (13) -#define SYS_CALLOC (14) -#define SYS_REALLOC (15) -#define SYS_OPENDIR (16) -#define SYS_READDIR (17) -#define SYS_CLOSEDIR (18) -#define SYS_STAT (19) -#define SYS_POLL (20) -#define SYS_IOCTL (21) -#define SYS_LINK (22) -#define SYS_CHDIR (23) -#define SYS_GETCWD (24) -#define SYS_SEM_INIT (25) -#define SYS_SEM_POST (26) -#define SYS_SEM_WAIT (27) -#define SYS_SEM_TRYWAIT (28) -#define SYS_SEM_DESTROY (29) -#define SYS_MUTEX_INIT (30) -#define SYS_MUTEX_UNLOCK (31) -#define SYS_MUTEX_LOCK (32) -#define SYS_MUTEX_DESTROY (33) -#define SYS_SOCKET (34) -#define SYS_BIND (35) -#define SYS_ACCEPT (36) -#define SYS_CONNECT (37) -#define SYS_LISTEN (38) -#define SYS_SENDTO (39) -#define SYS_RECVFROM (40) -#define SYS_SETSOCKOPT (41) -#define SYS_GETSOCKOPT (42) -#define SYS_SHUTDOWN (43) -#define SYS_DUP (44) -#define SYS_DUP2 (45) -#define SYS_MOUNT (46) -#define SYS_UMOUNT (47) -#define SYS_KILL (48) -#define SYS_ISATTY (49) -#define SYS_EXEC (50) -#define SYS_TTYNAME_R (51) -#define SYS_EXIT (52) -#define SYS_TCSETATTR (53) -#define SYS_TCGETATTR (54) -#define SYS_TCSENDBREAK (55) -#define SYS_PIPE2 (56) -#define SYS_SIGACTION (57) -#define SYS_SIGPROCMASK (58) -#define SYS_SIGSUSPEND (59) -#define SYS_VFORK (60) -#define SYS_WAITPID (61) -#define SYS_LSTAT (62) -#define SYS_UNAME (63) -#define SYS_GETADDRINFO (64) -#define SYS_FREEADDRINFO (65) -#define SYS_FSTAT (66) -#define SYS_GETSOCKNAME (67) -#define SYS_GETPEERNAME (68) -#define SYS_READLINK (69) -#define SYS_FCNTL (70) -#define SYS_SETSID (71) -#define SYS_PTRACE (72) -#define SYS_REBOOT (73) -#define SYS_GETPRIORITY (74) -#define SYS_SETPRIORITY (75) -#define SYS_FTRUNCATE (76) -#define SYS_TRUNCATE (77) -#define SYS_PTHREAD_CREATE (78) -#define SYS_PTHREAD_EXIT (79) -#define SYS_PTHREAD_JOIN (80) -#define SYS_PTHREAD_DETACH (81) -#define SYS_PTHREAD_CANCEL (82) -#define SYS_PTHREAD_SELF (83) -#define SYS_PTHREAD_SETCANCELSTATE (84) -#define SYS_SCHED_YIELD (85) -#define SYS_PTHREAD_MUTEX_INIT (86) -#define SYS_PTHREAD_MUTEX_DESTROY (87) -#define SYS_PTHREAD_MUTEX_LOCK (88) -#define SYS_PTHREAD_MUTEX_TRYLOCK (89) -#define SYS_PTHREAD_MUTEX_UNLOCK (90) -#define SYS_PTHREAD_KILL (91) -#define SYS_CLOCK_SETTIME (92) -#define SYS_PTHREAD_KEY_CREATE (93) -#define SYS_PTHREAD_SETSPECIFIC (94) -#define SYS_PTHREAD_GETSPECIFIC (95) -#define _SYSCALLS_NR (96) /* We have 96 syscalls! */ +#define SYS_MALLOC (11) +#define SYS_FREE (12) +#define SYS_CALLOC (13) +#define SYS_REALLOC (14) +#define SYS_OPENDIR (15) +#define SYS_READDIR (16) +#define SYS_CLOSEDIR (17) +#define SYS_STAT (18) +#define SYS_POLL (19) +#define SYS_IOCTL (20) +#define SYS_LINK (21) +#define SYS_CHDIR (22) +#define SYS_GETCWD (23) +#define SYS_SEM_INIT (24) +#define SYS_SEM_POST (25) +#define SYS_SEM_WAIT (26) +#define SYS_SEM_TRYWAIT (27) +#define SYS_SEM_DESTROY (28) +#define SYS_MUTEX_INIT (29) +#define SYS_MUTEX_UNLOCK (30) +#define SYS_MUTEX_LOCK (31) +#define SYS_MUTEX_DESTROY (32) +#define SYS_SOCKET (33) +#define SYS_BIND (34) +#define SYS_ACCEPT (35) +#define SYS_CONNECT (36) +#define SYS_LISTEN (37) +#define SYS_SENDTO (38) +#define SYS_RECVFROM (39) +#define SYS_SETSOCKOPT (40) +#define SYS_GETSOCKOPT (41) +#define SYS_SHUTDOWN (42) +#define SYS_DUP (43) +#define SYS_DUP2 (44) +#define SYS_MOUNT (45) +#define SYS_UMOUNT (46) +#define SYS_KILL (47) +#define SYS_ISATTY (48) +#define SYS_EXEC (49) +#define SYS_TTYNAME_R (50) +#define SYS_EXIT (51) +#define SYS_TCSETATTR (52) +#define SYS_TCGETATTR (53) +#define SYS_TCSENDBREAK (54) +#define SYS_PIPE2 (55) +#define SYS_SIGACTION (56) +#define SYS_SIGPROCMASK (57) +#define SYS_SIGSUSPEND (58) +#define SYS_VFORK (59) +#define SYS_WAITPID (60) +#define SYS_LSTAT (61) +#define SYS_UNAME (62) +#define SYS_GETADDRINFO (63) +#define SYS_FREEADDRINFO (64) +#define SYS_FSTAT (65) +#define SYS_GETSOCKNAME (66) +#define SYS_GETPEERNAME (67) +#define SYS_READLINK (68) +#define SYS_FCNTL (69) +#define SYS_SETSID (70) +#define SYS_PTRACE (71) +#define SYS_REBOOT (72) +#define SYS_GETPRIORITY (73) +#define SYS_SETPRIORITY (74) +#define SYS_FTRUNCATE (75) +#define SYS_TRUNCATE (76) +#define SYS_PTHREAD_CREATE (77) +#define SYS_PTHREAD_EXIT (78) +#define SYS_PTHREAD_JOIN (79) +#define SYS_PTHREAD_DETACH (80) +#define SYS_PTHREAD_CANCEL (81) +#define SYS_PTHREAD_SELF (82) +#define SYS_PTHREAD_SETCANCELSTATE (83) +#define SYS_SCHED_YIELD (84) +#define SYS_PTHREAD_MUTEX_INIT (85) +#define SYS_PTHREAD_MUTEX_DESTROY (86) +#define SYS_PTHREAD_MUTEX_LOCK (87) +#define SYS_PTHREAD_MUTEX_TRYLOCK (88) +#define SYS_PTHREAD_MUTEX_UNLOCK (89) +#define SYS_PTHREAD_KILL (90) +#define SYS_CLOCK_SETTIME (91) +#define SYS_CLOCK_GETTIME (92) +#define _SYSCALLS_NR (93) /* We have 93 syscalls! */ diff --git a/sys/frosted_syscalls.c b/sys/frosted_syscalls.c index cd31a5e..8bc8fbe 100644 --- a/sys/frosted_syscalls.c +++ b/sys/frosted_syscalls.c @@ -58,11 +58,6 @@ int sys_unlink(uint32_t arg1){ return syscall(SYS_UNLINK, arg1, 0, 0, 0, 0); } -/* Syscall: gettimeofday(1 arguments) */ -int sys_gettimeofday(uint32_t arg1){ - return syscall(SYS_GETTIMEOFDAY, arg1, 0, 0, 0, 0); -} - /* Syscall: malloc(1 arguments) */ int sys_malloc(uint32_t arg1){ return syscall(SYS_MALLOC, arg1, 0, 0, 0, 0); @@ -463,23 +458,13 @@ int sys_pthread_kill(uint32_t arg1, uint32_t arg2){ return syscall(SYS_PTHREAD_KILL, arg1, arg2, 0, 0, 0); } -/* Syscall: clock_settime(1 arguments) */ -int sys_clock_settime(uint32_t arg1){ - return syscall(SYS_CLOCK_SETTIME, arg1, 0, 0, 0, 0); -} - -/* Syscall: pthread_key_create(2 arguments) */ -int sys_pthread_key_create(uint32_t arg1, uint32_t arg2){ - return syscall(SYS_PTHREAD_KEY_CREATE, arg1, arg2, 0, 0, 0); -} - -/* Syscall: pthread_setspecific(2 arguments) */ -int sys_pthread_setspecific(uint32_t arg1, uint32_t arg2){ - return syscall(SYS_PTHREAD_SETSPECIFIC, arg1, arg2, 0, 0, 0); +/* Syscall: clock_settime(2 arguments) */ +int sys_clock_settime(uint32_t arg1, uint32_t arg2){ + return syscall(SYS_CLOCK_SETTIME, arg1, arg2, 0, 0, 0); } -/* Syscall: pthread_getspecific(2 arguments) */ -int sys_pthread_getspecific(uint32_t arg1, uint32_t arg2){ - return syscall(SYS_PTHREAD_GETSPECIFIC, arg1, arg2, 0, 0, 0); +/* Syscall: clock_gettime(2 arguments) */ +int sys_clock_gettime(uint32_t arg1, uint32_t arg2){ + return syscall(SYS_CLOCK_GETTIME, arg1, arg2, 0, 0, 0); }