external/linux-syscall-support/lss.git
5 weeks ago[MIPS] Fix constraint modifier for syscall clone master
petarj@mips.com [Wed, 10 Apr 2013 00:28:04 +0000 (00:28 +0000)]
[MIPS] Fix constraint modifier for syscall clone

__v0 has to be marked as read-write rather than early-clobbered.
This fixes an issue in which return value from the system call is
unexpectedly overridden.

When v0 is marked as early-clobbered,
(asm) "li    %0,%2\n"

will be coded as:
(objdump) "58:    2410ffea    li    s0,-22"

and at label '1' the value is restored to v0:
(objdump) "b0:    02001021    move  v0,s0"

However, this clobbers the return value from the syscall.

When v0 is marked as read-write, (-EINVAL) is correctly loaded in v0:

(objdump) "58:    2402ffea    li    v0,-22"

and the value is not overridden later.

BUG = described above
TEST= used by breakpad for MIPS
Review URL: https://codereview.chromium.org/13846002

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@21 829466d3-f3f5-3ae4-62ad-de35cf9bba21

7 weeks agofix up cast to fix errors w/-Wstrict-prototypes
vapier@chromium.org [Tue, 2 Apr 2013 19:34:26 +0000 (19:34 +0000)]
fix up cast to fix errors w/-Wstrict-prototypes

The NaCL bots use stricter warning flags and picked this up.

BUG=chromium:219015
TEST=built tests w/-Wstrict-prototypes and no longer warns
Review URL: https://codereview.chromium.org/13476002

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@20 829466d3-f3f5-3ae4-62ad-de35cf9bba21

7 weeks agoAdd x32 ABI support
vapier@chromium.org [Mon, 1 Apr 2013 17:52:44 +0000 (17:52 +0000)]
Add x32 ABI support

The x32 ABI has 4 byte longs/pointers, so the existing x86_64 code won't
work exactly as is.  Many of the existing syscalls are unchanged (they
still take 64bit values), and the assembly code always has to fill the
64bit registers.

For the kernel stat structs, we need to mark all the fields explicitly
as 64bit rather than relying on 'long' to be 8 bytes.  We end up having
to declare a dedicated statfs struct because it was being shared among
many other 32bit arches.

To make the syscall style easier, we end up gutting the existing syscall
macros and replacing them with a series of expandable ones (based on the
number of args).  This uses an existing style as the mips code.

The default code now all casts everything to uintptr_t first (which will
be 32bit or 64bit based on the native size) and then casting it up to
64bits (which is required to fill a 64bit register).  This works for the
vast majority of syscalls as they take native sized values.

However, there are a handful of syscalls that still take 64bit values.
We can't cast to uintptr_t first because it'd mean we'd truncate.  We
also can't cast everything straight to 64bit because it'd incur a ton
of compile time warnings.  So for these handful of syscalls, we expand
things ourselves using the new macros and take care of casting each arg
exactly as needed.

BUG=chromium:219015
TEST=compiled the code for x86_64 (64bit) & x86_64 (x32) & ran tests
Review URL: https://codereview.chromium.org/12181007

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@19 829466d3-f3f5-3ae4-62ad-de35cf9bba21

2 months agoFix building with glibc-2.16+
vapier@chromium.org [Wed, 6 Mar 2013 04:26:28 +0000 (04:26 +0000)]
Fix building with glibc-2.16+

Upstream glibc dropped 'struct siginfo' and now there is only 'siginfo_t'.

This fix comes from the gperftools project:
https://code.google.com/p/gperftools/source/detail?r=176

Review URL: https://codereview.chromium.org/12388060

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@18 829466d3-f3f5-3ae4-62ad-de35cf9bba21

6 months agoMake linux_syscall_support.h compilable with -Wstrict-prototypes
mseaborn@chromium.org [Tue, 30 Oct 2012 05:32:46 +0000 (05:32 +0000)]
Make linux_syscall_support.h compilable with -Wstrict-prototypes

Ensure that some functions are defined as taking no arguments rather
than (in C) taking unspecified arguments.  This prevents GCC from
giving errors when compiling with "-Wstrict-prototypes -Werror".

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3114
TEST=run "gcc -Wstrict-prototypes lss/linux_syscall_support.h"

Review URL: https://codereview.chromium.org/11301032

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@17 829466d3-f3f5-3ae4-62ad-de35cf9bba21

6 months agoRevert r15: Fix the calling conventions for the sixth argument on i386
mseaborn@chromium.org [Sat, 27 Oct 2012 17:47:38 +0000 (17:47 +0000)]
Revert r15: Fix the calling conventions for the sixth argument on i386

The change in r15 was incorrect and it breaks nacl_helper_bootstrap on
Linux, which calls mmap() (which takes 6 arguments) via
linux_syscall_support.h.

BUG=none
TEST=run_hello_world_test in NaCl on x86-32

Review URL: https://codereview.chromium.org/11313020

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@16 829466d3-f3f5-3ae4-62ad-de35cf9bba21

6 months agoFix the calling conventions for the sixth argument on i386. I am surprised, this
zodiac@gmail.com [Thu, 25 Oct 2012 08:15:48 +0000 (08:15 +0000)]
Fix the calling conventions for the sixth argument on i386. I am surprised, this
never showed up as a problem. I guess, nobody ever uses six-argument system calls
on i386.

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@15 829466d3-f3f5-3ae4-62ad-de35cf9bba21

6 months agoApplied patch provided by shenhan@google.com and previously reported by raymes@chromi...
zodiac@gmail.com [Mon, 22 Oct 2012 23:52:58 +0000 (23:52 +0000)]
Applied patch provided by shenhan@google.com and previously reported by raymes@chromium.org (code.google.com/p/linux-syscall-support/issues/detail?id=2)

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@14 829466d3-f3f5-3ae4-62ad-de35cf9bba21

8 months ago[MIPS] Ignoring 4th parameter in a3 for pread64 system calls on MIPS.
mseaborn@chromium.org [Sat, 15 Sep 2012 03:46:48 +0000 (03:46 +0000)]
[MIPS] Ignoring 4th parameter in a3 for pread64 system calls on MIPS.

Similar to ARM, MIPS also requires 64-bit parameters to be passed in even-odd
register pairs.  For pread64, MIPS ignores 4th argument and looks on stack for
it.  Issue discovered in NaCl development for MIPS.

Committed on behalf of petarj@mips.com.

BUG= http://code.google.com/p/nativeclient/issues/detail?id=2275
TEST= used by nacl_helper_bootstrap

Review URL: https://chromiumcodereview.appspot.com/10910222

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@13 829466d3-f3f5-3ae4-62ad-de35cf9bba21

8 months agoDefine sys_stat64 for Android
mseaborn@chromium.org [Wed, 5 Sep 2012 18:26:20 +0000 (18:26 +0000)]
Define sys_stat64 for Android

Committed on behalf of ted.mielczarek@gmail.com, who writes:

I patched this when I originally added Android support for Breakpad,
but it looks like in newer NDKs this doesn't break things.  Also,
sys_stat doesn't work reliably now, I get EOVERFLOW trying to use it.

Review URL: https://codereview.appspot.com/6349099/

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@12 829466d3-f3f5-3ae4-62ad-de35cf9bba21

11 months agoFix to compile successfully with -Wundef
mseaborn@chromium.org [Thu, 14 Jun 2012 19:43:32 +0000 (19:43 +0000)]
Fix to compile successfully with -Wundef

-Wundef warns about "#if FOO" when FOO is undefined.

gcc warns about this even for an #if branch that is not reached (due
to being excluded by an earlier #if), hence the checks before using
SYS_PREFIX.

BUG=http://code.google.com/p/nativeclient/issues/detail?id=2787
TEST="gcc -c linux_syscall_support.h -Wundef" on gcc 4.4.3 (Ubuntu Lucid)

Review URL: https://chromiumcodereview.appspot.com/10536175

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@11 829466d3-f3f5-3ae4-62ad-de35cf9bba21

13 months agoWhile adding MIPS support to breakpad I came across a few problems with the
zodiac@gmail.com [Fri, 13 Apr 2012 01:29:30 +0000 (01:29 +0000)]
While adding MIPS support to breakpad I came across a few problems with the
current version of lss support:

* LSS_ERRNO may involve a function call so LSS_RETURN must preserve $v0 value
* syscall clobbers $25/t9
* __v0 needs "+r" constraint when it contains the system call number
* Simplified and made consistent the O32 versions of syscall5/syscall6
* __r7 needs "+r" constraint in clone syscall
* __r7/__v1 need "+r" constraint in pipe syscall

AUTHOR=chris.jw.dearman
Review URL: https://chromiumcodereview.appspot.com/10067027

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@10 829466d3-f3f5-3ae4-62ad-de35cf9bba21

17 months agoFix pread64, pwrite64, readahead for ARM. git-svn
mcgrathr@google.com [Mon, 21 Nov 2011 22:26:20 +0000 (22:26 +0000)]
Fix pread64, pwrite64, readahead for ARM.

The system calls taking a 64-bit argument have a special quirk on ARM.
The 64-bit argument is passed in a pair of two registers that must be
an even/odd pair.  If it's an odd-numbered argument, then there is a
dummy argument first that is ignored to consume the odd-numbered argument
register before the even/odd pair.

BUG= none
TEST= sys_pread64 now works correctly on ARM

R=markus@chromium.org
Review URL: http://codereview.chromium.org/8621001

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@9 829466d3-f3f5-3ae4-62ad-de35cf9bba21

19 months agoFix a text relocation when SYS_SYSCALL_ENTRYPOINT is defined.
agl@chromium.org [Wed, 12 Oct 2011 14:43:04 +0000 (14:43 +0000)]
Fix a text relocation when SYS_SYSCALL_ENTRYPOINT is defined.

http://codereview.chromium.org/8230025/

BUG=87704

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@8 829466d3-f3f5-3ae4-62ad-de35cf9bba21

19 months agoMake clone() compatible with ARM's Thumb-2 instruction set. Bug reported and
zodiac@gmail.com [Thu, 6 Oct 2011 05:34:19 +0000 (05:34 +0000)]
Make clone() compatible with ARM's Thumb-2 instruction set. Bug reported and
fixed by mkrebs@chromium.org
Review URL: http://codereview.chromium.org/8165010

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@7 829466d3-f3f5-3ae4-62ad-de35cf9bba21

2 years agoMake the code more friendly to Clang and other modern compilers:
zodiac@gmail.com [Fri, 10 Dec 2010 00:22:03 +0000 (00:22 +0000)]
Make the code more friendly to Clang and other modern compilers:

 - remove the use of register allocation for auto variables

 - remove extraneous semicolons

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@6 829466d3-f3f5-3ae4-62ad-de35cf9bba21

2 years agoThis patch contains (mostly) minor fixes for compiling linux_syscall_support
zodiac@gmail.com [Wed, 13 Oct 2010 03:47:54 +0000 (03:47 +0000)]
This patch contains (mostly) minor fixes for compiling linux_syscall_support
with the Android NDK. The assembly changes are required for building with
-mthumb-interwork or some such compiler flag, I've been assured that compilers
will ignore them if they're unnecessary (and that newer toolchains would
autogenerate them where necessary, but alas, not the NDK GCC).

AUTHOR=Ted Mielczarek
ISSUE=3656004
Review URL: http://codereview.chromium.org/3773001

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@5 829466d3-f3f5-3ae4-62ad-de35cf9bba21

2 years agoRemoved duplicated lines.
zodiac@gmail.com [Tue, 21 Sep 2010 00:41:17 +0000 (00:41 +0000)]
Removed duplicated lines.
Review URL: http://codereview.chromium.org/3421022

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@3 829466d3-f3f5-3ae4-62ad-de35cf9bba21

2 years agoInitial release
zodiac@gmail.com [Wed, 15 Sep 2010 01:31:22 +0000 (01:31 +0000)]
Initial release

git-svn-id: http://linux-syscall-support.googlecode.com/svn/trunk/lss@2 829466d3-f3f5-3ae4-62ad-de35cf9bba21