Bug 11491 - _syscall_noerr do not handle syscall values in range [-EMAXERRNO; 0[ on MIPS
Summary: _syscall_noerr do not handle syscall values in range [-EMAXERRNO; 0[ on MIPS
Status: NEW
Alias: None
Product: uClibc
Classification: Unclassified
Component: Other (show other bugs)
Version: 0.9.33.2
Hardware: Other Linux
: P3 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-07 02:15 UTC by Volodymyr Boyko
Modified: 2018-11-07 13:14 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
Defining INLINE_SYSCALL_NOERR_NCS in mips/bits/syscalls.h (1.64 KB, patch)
2018-11-07 02:46 UTC, Volodymyr Boyko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Volodymyr Boyko 2018-11-07 02:15:45 UTC
On Linux/MIPS (O32 ABI) for system call we have two result registers - v0 and a3. 
v0 contains actual syscall result on success or error number on fail, a3 set to 0/1 for indicating syscall success/fail. (if a3 == 1, v0 contains errno).
Now as we can see from definition of handle_sys (arch/mips/kernel/scall32-o32.S), handler treats returned by syscall function (let's call "original") values in range [-EMAXERRNO; 0[ as -errno, a3 is set to 1 and final returned (to userspace) value is (-original).
Currently ulibc does not fully handle this mips syscall convention - wrappers declared though _syscall_noerr (time, times) are not working properly.
Comment 1 Volodymyr Boyko 2018-11-07 02:46:30 UTC
Created attachment 7866 [details]
Defining INLINE_SYSCALL_NOERR_NCS in mips/bits/syscalls.h