[libc][syscalls] Add new syscalls
Add read() and ioctl() syscalls. Also remove unused timespec
structure from std file.
Change-Id: I4dd44478e682f51b9ac65ec2978d611224bf2dde
Signed-off-by: Satya Popuri <popuri@google.com>
diff --git a/include/trusty_std.h b/include/trusty_std.h
index eabf4f4..7641e1b 100644
--- a/include/trusty_std.h
+++ b/include/trusty_std.h
@@ -29,11 +29,6 @@
#include <stdint.h>
#include <sys/types.h>
-struct timespec {
- long tv_sec; /* seconds */
- long tv_nsec; /* nanoseconds */
-};
-
#include "trusty_syscalls.h"
__NO_RETURN void exit(int status);
diff --git a/include/trusty_syscalls.h b/include/trusty_syscalls.h
index a8bcb55..7503edf 100644
--- a/include/trusty_syscalls.h
+++ b/include/trusty_syscalls.h
@@ -26,11 +26,15 @@
#define __NR_write 0x1
#define __NR_brk 0x2
#define __NR_exit_group 0x3
+#define __NR_read 0x4
+#define __NR_ioctl 0x5
#ifndef ASSEMBLY
long write (uint32_t fd, void* msg, uint32_t size);
long brk (uint32_t brk);
long exit_group (void);
+long read (uint32_t fd, void* msg, uint32_t size);
+long ioctl (uint32_t fd, uint32_t req, void* buf);
#endif
\ No newline at end of file
diff --git a/lib/libc-trusty/arch/arm/trusty_syscall.S b/lib/libc-trusty/arch/arm/trusty_syscall.S
index 2b2d555..4077156 100644
--- a/lib/libc-trusty/arch/arm/trusty_syscall.S
+++ b/lib/libc-trusty/arch/arm/trusty_syscall.S
@@ -40,3 +40,13 @@
ldr r12, =__NR_exit_group
swi #0
bx lr
+
+FUNCTION(read)
+ ldr r12, =__NR_read
+ swi #0
+ bx lr
+
+FUNCTION(ioctl)
+ ldr r12, =__NR_ioctl
+ swi #0
+ bx lr