diff options
author | Maciej W. Rozycki <macro@codesourcery.com> | 2013-02-27 23:45:07 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@codesourcery.com> | 2013-02-27 23:45:07 +0000 |
commit | 43301bd3c281036ba97eef384c9340cc7b6130d3 (patch) | |
tree | 263f0cc7e01c33c72e626480a52b2bfc1dce78f0 /ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | |
parent | 85bd816a603a437aedeb688a60a3e0dba4439c50 (diff) | |
download | glibc-43301bd3c281036ba97eef384c9340cc7b6130d3.tar.gz glibc-43301bd3c281036ba97eef384c9340cc7b6130d3.tar.xz glibc-43301bd3c281036ba97eef384c9340cc7b6130d3.zip |
Add support for building as MIPS16 code.
Diffstat (limited to 'ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h')
-rw-r--r-- | ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index c8bfe5dc8e..0faf68c4fc 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -95,17 +95,46 @@ #endif #undef INTERNAL_SYSCALL -#define INTERNAL_SYSCALL(name, err, nr, args...) \ +#undef INTERNAL_SYSCALL_NCS + +#ifdef __mips16 +/* There's no MIPS16 syscall instruction, so we go through out-of-line + standard MIPS wrappers. These do use inline snippets below though, + through INTERNAL_SYSCALL_MIPS16. Spilling the syscall number to + memory gives the best code in that case, avoiding the need to save + and restore a static register. */ + +# include <mips16-syscall.h> + +# define INTERNAL_SYSCALL(name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS (SYS_ify (name), err, nr, args) + +# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +({ \ + union __mips16_syscall_return ret; \ + ret.val = __mips16_syscall##nr (args, number); \ + err = ret.reg.v1; \ + ret.reg.v0; \ +}) + +# define INTERNAL_SYSCALL_MIPS16(number, err, nr, args...) \ + internal_syscall##nr ("lw\t%0, %2\n\t", \ + "R" (number), \ + 0, err, args) + +#else /* !__mips16 */ +# define INTERNAL_SYSCALL(name, err, nr, args...) \ internal_syscall##nr ("li\t%0, %2\t\t\t# " #name "\n\t", \ "IK" (SYS_ify (name)), \ 0, err, args) -#undef INTERNAL_SYSCALL_NCS -#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ +# define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \ internal_syscall##nr (MOVE32 "\t%0, %2\n\t", \ "r" (__s0), \ number, err, args) +#endif /* !__mips16 */ + #define internal_syscall0(v0_init, input, number, err, dummy...) \ ({ \ long _sys_result; \ |