Commit Diff


commit - a568a333b09a164552a0b93a45d0f71fc1145672
commit + 146b0cdc58cadf7ec01bb6db345d09d2abea732c
blob - 7fab238b7561daa9397f8661042946dfbc82a782
blob + 840836c075358b7082c9693ef9ce756746c17ac6
--- src/data.dst
+++ src/data.dst
@@ -54,3 +54,8 @@ struct linux_stat64 {
 	__unused4:	u32,
 	__unused5:	u32,
 };
+
+struct linux_timespec {
+	sec: i64,
+	nsec: i32,
+};
blob - 78f2155e83608163d1b6f16b7280709090b1b650
blob + 30d466cc95e28088882917ce801b01528131ff42
--- src/ecall.c
+++ src/ecall.c
@@ -28,11 +28,6 @@ struct linux_utsname {
 	char machine[65];
 };
 
-struct linux_timespec {
-	time_t ltv_sec;
-	long ltv_nsec;
-};
-
 static int map_errno (int err)
 {
 	const int errnos[] = {
@@ -257,15 +252,21 @@ static int map_access (int x)
 	return o;
 }
 
-static void timespec_from_linux (struct timespec *out, const struct linux_timespec *in)
+static void timespec_from_linux (struct timespec *out, const uint8_t *in)
 {
-	out->tv_sec = in->ltv_sec;
-	out->tv_nsec = in->ltv_nsec;
-}
-static void timespec_to_linux (struct linux_timespec *out, const struct timespec *in)
+	struct linux_timespec ts;
+
+	decode_linux_timespec (&ts, in);
+	out->tv_sec = ts.sec;
+	out->tv_nsec = ts.nsec;
+}
+static void timespec_to_linux (uint8_t *out, const struct timespec *in)
 {
-	out->ltv_sec = in->tv_sec;
-	out->ltv_nsec = in->tv_nsec;
+	struct linux_timespec ts;
+
+	ts.sec = in->tv_sec;
+	ts.nsec = in->tv_nsec;
+	encode_linux_timespec (out, &ts);
 }
 
 int mysigaction (int sig, const void *act, void *oact);
@@ -606,8 +607,8 @@ void ecall (void)
 		break;
 	case SYS_nanosleep:
 	{
-		const struct linux_timespec *lin = ptr (const void, a0);
-		struct linux_timespec *lout = ptr (void, a1);
+		const uint8_t *lin = ptr (const uint8_t, a0);
+		uint8_t *lout = ptr (uint8_t, a1);
 		struct timespec in, out;
 
 		timespec_from_linux (&in, lin);