aboutsummaryrefslogtreecommitdiff
path: root/sim/cris
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2010-10-06 23:44:33 +0000
committerHans-Peter Nilsson <hp@axis.com>2010-10-06 23:44:33 +0000
commit7cf1d8af2f630bd1959cb16a6ddc50650239d0de (patch)
tree4795b264d66296d368a4557938e055f94999c555 /sim/cris
parent1c3e1c03eed0fd378b0b8f7933a3f898a1c25189 (diff)
downloadbinutils-7cf1d8af2f630bd1959cb16a6ddc50650239d0de.zip
binutils-7cf1d8af2f630bd1959cb16a6ddc50650239d0de.tar.gz
binutils-7cf1d8af2f630bd1959cb16a6ddc50650239d0de.tar.bz2
* traps.c (cris_break_13_handler): Pass lseek
offset parameter as sign-extended.
Diffstat (limited to 'sim/cris')
-rw-r--r--sim/cris/ChangeLog5
-rw-r--r--sim/cris/traps.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 699e9e8..2963b90 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-07 Hans-Peter Nilsson <hp@axis.com>
+
+ * traps.c (cris_break_13_handler): Pass lseek
+ offset parameter as sign-extended.
+
2010-05-26 Ozkan Sezer <sezeroz@gmail.com>
* dv-rv.c (hw_rv_init_socket): Check error return from socket() call
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index dfaaeed..1e17ce3 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -1478,6 +1478,14 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1,
s.arg2 = arg2;
s.arg3 = arg3;
+ /* The type of s.arg2 is long, so for hosts with 64-bit longs, we need
+ to sign-extend the lseek offset to be passed as a signed number,
+ else we'll truncate it to something > 2GB on hosts where sizeof
+ long > sizeof USI. We avoid doing it for all syscalls, as arg2 is
+ e.g. an address for some syscalls. */
+ if (callnum == TARGET_SYS_lseek)
+ s.arg2 = (SI) arg2;
+
if (callnum == TARGET_SYS_exit_group
|| (callnum == TARGET_SYS_exit && current_cpu->m1threads == 0))
{