Skip to content

Commit

Permalink
os_emulation: correct ftruncate syscall arguments for 64 and 32-bit ABI
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
  • Loading branch information
ppisa committed Nov 30, 2023
1 parent e025a95 commit e891c5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/os_emulation/ossyscall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,10 @@ int OsSyscallExceptionHandler::do_sys_ftruncate(

result = 0;
int fd = a1;
uint64_t length = ((uint64_t)a2 << 32) | a3;
uint64_t length = core->get_xlen_from_reg(a2);
if (core->get_xlen() == Xlen::_32) {
length |= core->get_xlen_from_reg(a3) << 32;
}

printf("sys_ftruncate fd %d\n", fd);

Expand Down

0 comments on commit e891c5f

Please sign in to comment.