Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2020-02-05 07:34:13 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-02-06 13:02:38 +0300
commitcd78225a50205aa07d726b7310b333e9c07471bc (patch)
tree69d3df41ad7a1c82269fe5eaa8e0c8e825cb0195 /libgloss/m68k
parent65ad1c0ab0a434fb52d23b96fb072634ac263471 (diff)
libgloss: Fix lseek semihosting bug on nios2 and m68k
When off_t is 32 bits, the value needs to be sign-extended to 64 bits before shifting right to extract the high-order word. Previously negative offsets were incorrectly encoded. Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
Diffstat (limited to 'libgloss/m68k')
-rw-r--r--libgloss/m68k/io-lseek.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libgloss/m68k/io-lseek.c b/libgloss/m68k/io-lseek.c
index 63ec56451..eaaf55746 100644
--- a/libgloss/m68k/io-lseek.c
+++ b/libgloss/m68k/io-lseek.c
@@ -38,7 +38,7 @@ off_t lseek (int fd, off_t offset, int whence)
#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
- parameters[1] = (uint32_t) ((offset >> 32) & 0xffffffff);
+ parameters[1] = (uint32_t) ((int64_t)offset >> 32);
parameters[2] = (uint32_t) (offset & 0xffffffff);
parameters[3] = __hosted_to_gdb_lseek_flags (whence);
__hosted (HOSTED_LSEEK, parameters);