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>
#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);
#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);
__io_hosted (HOSTED_LSEEK, parameters);