about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/cris/sysdep.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-09 04:55:59 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-09 04:55:59 +0000
commiteacde9d0818dac743bc5c2562e35f0a6e949327e (patch)
treed117012b09ea03667334e4fb4be8ab15c41509d5 /sysdeps/unix/sysv/linux/cris/sysdep.h
parent4c4505561671f07c4f1b9e39cc0a0fa271a6c8be (diff)
downloadglibc-eacde9d0818dac743bc5c2562e35f0a6e949327e.tar.gz
glibc-eacde9d0818dac743bc5c2562e35f0a6e949327e.tar.xz
glibc-eacde9d0818dac743bc5c2562e35f0a6e949327e.zip
Update.
2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* sysdeps/unix/sysv/linux/cris/Dist: New file.
	* sysdeps/unix/sysv/linux/cris/Makefile: New file.
	* sysdeps/unix/sysv/linux/cris/_G_config.h: New file.
	* sysdeps/unix/sysv/linux/cris/bits/fcntl.h: New file.
	* sysdeps/unix/sysv/linux/cris/bits/mman.h: New file.
	* sysdeps/unix/sysv/linux/cris/bits/resource.h: New file.
	* sysdeps/unix/sysv/linux/cris/brk.c: New file.
	* sysdeps/unix/sysv/linux/cris/chown.c: New file.
	* sysdeps/unix/sysv/linux/cris/clone.S: New file.
	* sysdeps/unix/sysv/linux/cris/fchown.c: New file.
	* sysdeps/unix/sysv/linux/cris/fcntl.c: New file.
	* sysdeps/unix/sysv/linux/cris/fxstat.c: New file.
	* sysdeps/unix/sysv/linux/cris/getegid.c: New file.
	* sysdeps/unix/sysv/linux/cris/geteuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/getgid.c: New file.
	* sysdeps/unix/sysv/linux/cris/getgroups.c: New file.
	* sysdeps/unix/sysv/linux/cris/getresgid.c: New file.
	* sysdeps/unix/sysv/linux/cris/getresuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/getrlimit.c: New file.
	* sysdeps/unix/sysv/linux/cris/getrlimit64.c: New file.
	* sysdeps/unix/sysv/linux/cris/getuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/lchown.c: New file.
	* sysdeps/unix/sysv/linux/cris/lockf64.c: New file.
	* sysdeps/unix/sysv/linux/cris/lxstat.c: New file.
	* sysdeps/unix/sysv/linux/cris/mmap.S: New file.
	* sysdeps/unix/sysv/linux/cris/mmap64.S: New file.
	* sysdeps/unix/sysv/linux/cris/msgctl.c: New file.
	* sysdeps/unix/sysv/linux/cris/profil-counter.h: New file.
	* sysdeps/unix/sysv/linux/cris/register-dump.h: New file.
	* sysdeps/unix/sysv/linux/cris/semctl.c: New file.
	* sysdeps/unix/sysv/linux/cris/setegid.c: New file.
	* sysdeps/unix/sysv/linux/cris/seteuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setfsgid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setfsuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setgid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setgroups.c: New file.
	* sysdeps/unix/sysv/linux/cris/setregid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setresgid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setresuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setreuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/setrlimit.c: New file.
	* sysdeps/unix/sysv/linux/cris/setuid.c: New file.
	* sysdeps/unix/sysv/linux/cris/shmctl.c: New file.
	* sysdeps/unix/sysv/linux/cris/socket.S: New file.
	* sysdeps/unix/sysv/linux/cris/sys/ucontext.h: New file.
	* sysdeps/unix/sysv/linux/cris/syscall.S: New file.
	* sysdeps/unix/sysv/linux/cris/sysdep.S: New file.
	* sysdeps/unix/sysv/linux/cris/sysdep.h: New file.
	* sysdeps/unix/sysv/linux/cris/vfork.S: New file.
	* sysdeps/unix/sysv/linux/cris/xstat.c: New file.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* sysdeps/cris/Dist: New file.
	* sysdeps/cris/Implies: New file.
	* sysdeps/cris/Makefile: New file.
	* sysdeps/cris/__longjmp.S: New file.
	* sysdeps/cris/_mcount.S: New file.
	* sysdeps/cris/bits/endian.h: New file.
	* sysdeps/cris/bits/setjmp.h: New file.
	* sysdeps/cris/bits/string.h: New file.
	* sysdeps/cris/dl-machine.h: New file.
	* sysdeps/cris/elf/start.S: New file.
	* sysdeps/cris/machine-gmon.h: New file.
	* sysdeps/cris/memcopy.h: New file.
	* sysdeps/cris/memusage.h: New file.
	* sysdeps/cris/setjmp.S: New file.
	* sysdeps/cris/sysdep.h: New file.
	* sysdeps/cris/wordcopy.c: New file.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* elf/elf.h: Add new relocations for CRIS.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* shlib-versions: Add cases for Linux on CRIS.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* configure.in (ASM_LINE_SEP tests): Handle CRIS assembly, with
	';' for comments and '@' for line separator.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* sysdeps/unix/sysv/linux/hppa/sysdep.h (INLINE_SYSCALL): Fix
	typo; s/==/=/ for assignment.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* malloc/Makefile: Correct comment; mtrace is Perl, not AWK.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* iconv/gconv_simple.c (internal_ucs4_loop_unaligned): Check for
	empty input before checking full output.

2001-04-08  Hans-Peter Nilsson  <hp@axis.com>

	* iconv/gconv.c (__gconv): Don't derefer parameter cd before
	checking if == -1L.

2001-04-08  Ulrich Drepper  <drepper@redhat.com>

	* inet/rexec.c (rexec_af): Avoid calling perror with errno being set.
Diffstat (limited to 'sysdeps/unix/sysv/linux/cris/sysdep.h')
-rw-r--r--sysdeps/unix/sysv/linux/cris/sysdep.h214
1 files changed, 214 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/cris/sysdep.h b/sysdeps/unix/sysv/linux/cris/sysdep.h
new file mode 100644
index 0000000000..d388665286
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/cris/sysdep.h
@@ -0,0 +1,214 @@
+/* Assembler macros for CRIS.
+   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <asm/unistd.h>
+#include <sysdeps/cris/sysdep.h>
+#include <sys/syscall.h>
+#include "config.h"
+
+#undef SYS_ify
+#define SYS_ify(syscall_name)	(__NR_##syscall_name)
+
+
+#ifdef __ASSEMBLER__
+
+/* For Linux we can use the system call table in the header file
+	/usr/include/asm/unistd.h
+   of the kernel.  But these symbols do not follow the SYS_* syntax
+   so we have to redefine the `SYS_ify' macro here.  */
+#undef SYS_ify
+#define SYS_ify(syscall_name)	__NR_##syscall_name
+
+/* ELF-like local names start with `.L'.  */
+#undef L
+#define L(name)	.L##name
+
+/* Linux uses a negative return value to indicate syscall errors,
+   unlike most Unices, which use the condition codes' carry flag.
+
+   Since version 2.1 the return value of a system call might be
+   negative even if the call succeeded.  E.g., the `lseek' system call
+   might return a large offset.  Therefore we must not anymore test
+   for < 0, but test for a real error by making sure the value in %eax
+   is a real error number.  Linus said he will make sure the no syscall
+   returns a value in -1 .. -4095 as a valid result so we can safely
+   test with -4095.  */
+
+/* Syscall wrappers consist of
+	#include <sysdep.h>
+	PSEUDO (...)
+	 ret
+	PSEUDO_END (...)
+
+   which expand to the following.  */
+
+/* Linux takes system call arguments in registers:
+	syscall number	R9
+	arg 1		R10
+	arg 2		R11
+	arg 3		R12
+	arg 4		R13
+	arg 5		MOF
+	arg 6		SRP
+
+   The compiler calls us by the C convention:
+	syscall number	in the DO_CALL macro
+	arg 1		R10
+	arg 2		R11
+	arg 3		R12
+	arg 4		R13
+	arg 5		[SP]
+	arg 6		[SP + 4]
+   */
+
+/* Note that we use "bhs", since we want to match
+   (unsigned) -4096 .. 0xffffffff.  Using "ble" would match
+   -4096 .. -2**31.  */
+#define	PSEUDO(name, syscall_name, args) \
+  ENTRY	(name)						@ \
+  DOARGS_##args						@ \
+  movu.w SYS_ify (syscall_name),$r9			@ \
+  break	13						@ \
+  cmps.w -4096,$r10					@ \
+  bhs	0f						@ \
+  nop							@ \
+  UNDOARGS_return_##args
+
+/* Ouch!  We have to remember not to use "ret" in assembly-code.
+   ("Luckily", mnemonics are case-insensitive.)
+   Note that we assume usage is exactly:
+	PSEUDO (...)
+	ret
+	PSEUDO_END (...)
+   so we can put all payload into PSEUDO (except for error handling).  */
+
+#define ret
+
+#define	PSEUDO_END(name) \
+0:							@ \
+  SETUP_PIC						@ \
+  PLTJUMP (syscall_error)				@ \
+  END (name)
+
+#define DOARGS_0
+#define DOARGS_1
+#define DOARGS_2
+#define DOARGS_3
+#define DOARGS_4
+#define DOARGS_5 \
+  move	[$sp],$mof
+
+/* To avoid allocating stack-space, we re-use the arg 5 (MOF) entry by
+   storing SRP into it.  If called with too-few arguments, we will crash,
+   but that will happen in the general case too.  */
+#define DOARGS_6 \
+  DOARGS_5						@ \
+  move	$srp,[$sp]					@ \
+  move	[$sp+4],$srp
+
+#define UNDOARGS_return_0 \
+  Ret							@ \
+  nop
+
+#define UNDOARGS_return_1 UNDOARGS_return_0
+#define UNDOARGS_return_2 UNDOARGS_return_0
+#define UNDOARGS_return_3 UNDOARGS_return_0
+#define UNDOARGS_return_4 UNDOARGS_return_0
+#define UNDOARGS_return_5 UNDOARGS_return_0
+
+/* We assume the following code will be "ret" and "PSEUDO_END".  */
+#define UNDOARGS_return_return_6 \
+  jump	[$sp]
+
+#else  /* not __ASSEMBLER__ */
+
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...)	\
+  ({						\
+     unsigned long __sys_res;			\
+     register unsigned long __res asm ("r10");	\
+     LOAD_ARGS_c_##nr (args)			\
+     register unsigned long __callno asm ("r9")	\
+       = SYS_ify (name);			\
+     asm volatile (LOAD_ARGS_asm_##nr (args)	\
+		   "break 13"			\
+		   : "=r" (__res)		\
+		   : ASM_ARGS_##nr (args)	\
+		   : ASM_CLOBBER_##nr);		\
+     __sys_res = __res;				\
+						\
+     if (__sys_res >= (unsigned long) -4096)	\
+       {					\
+	 __set_errno (- __sys_res);		\
+	 __sys_res = (unsigned long) -1;	\
+       }					\
+     __sys_res;					\
+   })
+
+#define LOAD_ARGS_c_0()
+#define LOAD_ARGS_asm_0()
+#define ASM_CLOBBER_0 "memory"
+#define ASM_ARGS_0() "r" (__callno)
+
+#define LOAD_ARGS_c_1(r10) \
+	LOAD_ARGS_c_0()						\
+	register unsigned long __r10 __asm__ ("r10") = (unsigned long) (r10);
+#define LOAD_ARGS_asm_1(r10) LOAD_ARGS_asm_0 ()
+#define ASM_CLOBBER_1 ASM_CLOBBER_0
+#define ASM_ARGS_1(r10) ASM_ARGS_0 (), "0" (__r10)
+
+#define LOAD_ARGS_c_2(r10, r11) \
+	LOAD_ARGS_c_1(r10)					\
+	register unsigned long __r11 __asm__ ("r11") = (unsigned long) (r11);
+#define LOAD_ARGS_asm_2(r10, r11) LOAD_ARGS_asm_1 (r10)
+#define ASM_CLOBBER_2 ASM_CLOBBER_1
+#define ASM_ARGS_2(r10, r11) ASM_ARGS_1 (r10), "r" (__r11)
+
+#define LOAD_ARGS_c_3(r10, r11, r12) \
+	LOAD_ARGS_c_2(r10, r11)					\
+	register unsigned long __r12 __asm__ ("r12") = (unsigned long) (r12);
+#define LOAD_ARGS_asm_3(r10, r11, r12) LOAD_ARGS_asm_2 (r10, r11)
+#define ASM_CLOBBER_3 ASM_CLOBBER_2
+#define ASM_ARGS_3(r10, r11, r12) ASM_ARGS_2 (r10, r11), "r" (__r12)
+
+#define LOAD_ARGS_c_4(r10, r11, r12, r13) \
+	LOAD_ARGS_c_3(r10, r11, r12)				\
+	register unsigned long __r13 __asm__ ("r13") = (unsigned long) (r13);
+#define LOAD_ARGS_asm_4(r10, r11, r12, r13) LOAD_ARGS_asm_3 (r10, r11, r12)
+#define ASM_CLOBBER_4 ASM_CLOBBER_3
+#define ASM_ARGS_4(r10, r11, r12, r13) ASM_ARGS_3 (r10, r11, r12), "r" (__r13)
+
+#define LOAD_ARGS_c_5(r10, r11, r12, r13, mof) \
+	LOAD_ARGS_c_4(r10, r11, r12, r13)
+#define LOAD_ARGS_asm_5(r10, r11, r12, r13, mof) \
+	LOAD_ARGS_asm_4 (r10, r11, r12, r13) "move %5,$mof\n\t"
+#define ASM_CLOBBER_5 ASM_CLOBBER_4
+#define ASM_ARGS_5(r10, r11, r12, r13, mof) \
+	ASM_ARGS_4 (r10, r11, r12, r13), "g" (mof)
+
+#define LOAD_ARGS_c_6(r10, r11, r12, r13, mof, srp)		\
+	LOAD_ARGS_c_5(r10, r11, r12, r13, mof)
+#define LOAD_ARGS_asm_6(r10, r11, r12, r13, mof, srp)		\
+	LOAD_ARGS_asm_5(r10, r11, r12, r13, mof)		\
+	"move %6,$srp\n\t"
+#define ASM_CLOBBER_6 ASM_CLOBBER_5, "srp"
+#define ASM_ARGS_6(r10, r11, r12, r13, mof, srp) \
+	ASM_ARGS_5 (r10, r11, r12, r13, mof), "g" (srp)
+
+#endif	/* not __ASSEMBLER__ */