aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-04-24 14:35:14 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-14 21:05:36 -0400
commit00330cd18a4ba83beabad4cb9f4215170828cd29 (patch)
tree5e2c26d6fa4f383e0ac7e933f33005d6b136fbcd /sim
parentfcf102ba7abe6c8a64b2db41bfd02ac80e79e094 (diff)
downloadfsf-binutils-gdb-00330cd18a4ba83beabad4cb9f4215170828cd29.zip
fsf-binutils-gdb-00330cd18a4ba83beabad4cb9f4215170828cd29.tar.gz
fsf-binutils-gdb-00330cd18a4ba83beabad4cb9f4215170828cd29.tar.bz2
sim: callback: convert time interface to 64-bit
PR sim/27705 Rather than rely on time_t being the right size between the host & target, have the interface always be 64-bit. We can figure out if we need to truncate when actually outputting it to the right target.
Diffstat (limited to 'sim')
-rw-r--r--sim/arm/ChangeLog4
-rw-r--r--sim/arm/armos.c6
-rw-r--r--sim/common/ChangeLog9
-rw-r--r--sim/common/callback.c10
-rw-r--r--sim/common/sim-io.c7
-rw-r--r--sim/common/sim-io.h2
-rw-r--r--sim/common/syscall.c2
-rw-r--r--sim/cris/ChangeLog5
-rw-r--r--sim/cris/traps.c11
9 files changed, 35 insertions, 21 deletions
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 7124a6d..5282e70 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,5 +1,9 @@
2021-05-14 Mike Frysinger <vapier@gentoo.org>
+ * armos.c (ARMul_OSHandleSWI): Delete 2nd arg to time callback.
+
+2021-05-14 Mike Frysinger <vapier@gentoo.org>
+
* armos.c: Update include path.
* wrapper.c: Likewise.
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index 77b256f..72bdf59 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -437,7 +437,7 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
case SWI_Time:
if (swi_mask & SWI_MASK_DEMON)
{
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback);
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
}
else
@@ -592,7 +592,7 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
break;
case AngelSWI_Reason_Time:
- state->Reg[0] = (ARMword) sim_callback->time (sim_callback, NULL);
+ state->Reg[0] = (ARMword) sim_callback->time (sim_callback);
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
break;
@@ -781,7 +781,7 @@ ARMul_OSHandleSWI (ARMul_State * state, ARMword number)
break;
case 17: /* Utime. */
- state->Reg[0] = state->Reg[1] = (ARMword) sim_callback->time (sim_callback, NULL);
+ state->Reg[0] = state->Reg[1] = (ARMword) sim_callback->time (sim_callback);
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
break;
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index ac80464..879aac9 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,14 @@
2021-05-14 Mike Frysinger <vapier@gentoo.org>
+ * callback.c (os_time): Change return to int64_t. Delete 2nd arg.
+ (os_fstat): Delete 2nd arg to time callback.
+ * sim-io.c (sim_io_time): Change return to int64_t. Delete 2nd arg
+ to time callback.
+ * sim-io.h (sim_io_time): Change return to int64_t.
+ * syscall.c (cb_syscall): Delete 2nd arg to time callback.
+
+2021-05-14 Mike Frysinger <vapier@gentoo.org>
+
* callback.c (cb_host_to_target_stat): Change PTR to void*.
* sim-syscall.c (sim_syscall_multi): Delete (PTR) casts.
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 1b53823..fb5e864 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -420,12 +420,12 @@ os_system (host_callback *p, const char *s)
return result;
}
-static long
-os_time (host_callback *p, long *t)
+static int64_t
+os_time (host_callback *p)
{
- long result;
+ int64_t result;
- result = time (t);
+ result = time (NULL);
p->last_errno = errno;
return result;
}
@@ -466,7 +466,7 @@ os_fstat (host_callback *p, int fd, struct stat *buf)
if (p->ispipe[fd])
{
#if defined (HAVE_STRUCT_STAT_ST_ATIME) || defined (HAVE_STRUCT_STAT_ST_CTIME) || defined (HAVE_STRUCT_STAT_ST_MTIME)
- time_t t = (*p->time) (p, NULL);
+ time_t t = (*p->time) (p);
#endif
/* We have to fake the struct stat contents, since the pipe is
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index f418c37..e5da7f1 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -68,11 +68,10 @@ sim_io_unlink (SIM_DESC sd,
}
-long
-sim_io_time (SIM_DESC sd,
- long *t)
+int64_t
+sim_io_time (SIM_DESC sd)
{
- return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
+ return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd));
}
diff --git a/sim/common/sim-io.h b/sim/common/sim-io.h
index f018538..a091fd0 100644
--- a/sim/common/sim-io.h
+++ b/sim/common/sim-io.h
@@ -31,7 +31,7 @@ int sim_io_shutdown (SIM_DESC sd);
int sim_io_unlink (SIM_DESC sd, const char *);
-long sim_io_time (SIM_DESC sd, long *);
+int64_t sim_io_time (SIM_DESC sd);
int sim_io_system (SIM_DESC sd, const char *);
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 258b3d6..0a1d3f4 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -588,7 +588,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
We might also want gettimeofday or times, but if system calls
can be built on others, we can keep the number we have to support
here down. */
- time_t t = (*cb->time) (cb, (time_t *) 0);
+ time_t t = (*cb->time) (cb);
result = t;
/* It is up to target code to process the argument to time(). */
}
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 81ae5e6..68cd0bf 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-14 Mike Frysinger <vapier@gentoo.org>
+
+ * traps.c (cris_break_13_handler): Delete 2nd arg to time callback.
+ (cris_time): Change return to int64_t. Delete 2nd arg.
+
2021-05-04 Tom Tromey <tromey@adacore.com>
* mloop.in: Include <stdlib.h>.
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index 1c8ca41..483747f 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -2234,7 +2234,7 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1,
case TARGET_SYS_time:
{
- retval = (int) (*cb->time) (cb, 0L);
+ retval = (int) (*cb->time) (cb);
/* At time of this writing, CB_SYSCALL_time doesn't do the
part of setting *arg1 to the return value. */
@@ -3327,13 +3327,10 @@ cris_pipe_empty (host_callback *cb,
/* We have a simulator-specific notion of time. See TARGET_TIME. */
-static long
-cris_time (host_callback *cb ATTRIBUTE_UNUSED, long *t)
+static int64_t
+cris_time (host_callback *cb ATTRIBUTE_UNUSED)
{
- long retval = TARGET_TIME (current_cpu_for_cb_callback);
- if (t)
- *t = retval;
- return retval;
+ return TARGET_TIME (current_cpu_for_cb_callback);
}
/* Set target-specific callback data. */