about summary refs log tree commit diff
path: root/sysdeps/unix/bsd/sequent
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
committerRoland McGrath <roland@gnu.org>1995-02-18 01:27:10 +0000
commit28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch)
tree15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/unix/bsd/sequent
downloadglibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.xz
glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip
initial import
Diffstat (limited to 'sysdeps/unix/bsd/sequent')
-rw-r--r--sysdeps/unix/bsd/sequent/i386/getgroups.S44
-rw-r--r--sysdeps/unix/bsd/sequent/i386/sigvec.S45
-rw-r--r--sysdeps/unix/bsd/sequent/i386/syscall.S31
-rw-r--r--sysdeps/unix/bsd/sequent/i386/sysdep.h82
4 files changed, 202 insertions, 0 deletions
diff --git a/sysdeps/unix/bsd/sequent/i386/getgroups.S b/sysdeps/unix/bsd/sequent/i386/getgroups.S
new file mode 100644
index 0000000000..b68bcbdbaa
--- /dev/null
+++ b/sysdeps/unix/bsd/sequent/i386/getgroups.S
@@ -0,0 +1,44 @@
+/* Copyright (C) 1994, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sysdep.h>
+#include <limits.h>
+
+/* Dynix erroneously reports `getgroups (0, 0)' as an error.
+   We fix up for that case.  */
+
+#define syscall_error myerror
+SYSCALL__ (getgroups, 2)
+#undef syscall_error
+	ret
+myerror:
+	tstl 4(%esp)		/* Was the first arg 0?  */
+	jnz syscall_error	/* If not, go to the normal error case.  */
+	/* When called with (0, 0), we want to return the number of groups
+	   without storing anything.  The Dynix system call gives an error
+	   for this case, so we fix up by calling it with a local array we
+	   never use, and just use the return value.  */
+	subl %esp, $(NGROUPS_MAX * 4) /* Allocate a local array.  */
+	movl $NGROUPS_MAX, %ecx	/* Pass NGROUPS_MAX for first arg.  */
+	movl %esp, %edx		/* Pass local array for second arg.  */
+	DO_CALL (getgroups, 2)	/* Do the system call.  */
+	addl %esp, $(NGROUPS_MAX * 4) /* Pop the local array.  */
+	jb syscall_error	/* Check for error from the system call.  */
+	ret			/* Return its value.  */
+
+weak_alias (__getgroups, getgroups)
diff --git a/sysdeps/unix/bsd/sequent/i386/sigvec.S b/sysdeps/unix/bsd/sequent/i386/sigvec.S
new file mode 100644
index 0000000000..1bb57c2074
--- /dev/null
+++ b/sysdeps/unix/bsd/sequent/i386/sigvec.S
@@ -0,0 +1,45 @@
+/* Copyright (C) 1993, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sysdep.h>
+
+/* The Dynix `sigvec' system call takes an extra argument,
+   which is the address of the trampoline function.  */
+
+.text
+.align 4
+trampoline:
+	cld			/* Clear direction flag.  */
+	call %eax		/* Call the handler, address in %eax.  */
+	addl $8, %esp		/* Pop signum & code off the stack.  */
+	/* __sigreturn will restore the context, and never return here.  */
+	call C_SYMBOL_NAME (__sigreturn)
+
+.globl syscall_error
+ENTRY (__sigvec)
+	pushl $trampoline	/* Push fourth arg: trampoline address.  */
+	pushl 16(%esp)		/* Push third arg: our third arg.  */
+	pushl 16(%esp)		/* Push second arg: our second arg.  */
+	pushl 16(%esp)		/* Push first arg: our first arg.  */
+	mov %esp, %ecx 		/* Point the syscall at the arguments.  */
+	addl $16, %esp		/* Pop those four args.  */
+	DO_CALL (sigvec, 4)	/* Do the system call.  */
+	jb syscall_error	/* Check for error.  */
+	ret
+
+weak_alias (__sigvec, sigvec)
diff --git a/sysdeps/unix/bsd/sequent/i386/syscall.S b/sysdeps/unix/bsd/sequent/i386/syscall.S
new file mode 100644
index 0000000000..bebab8ee51
--- /dev/null
+++ b/sysdeps/unix/bsd/sequent/i386/syscall.S
@@ -0,0 +1,31 @@
+/* `syscall' function for Sequent Symmetry running Dynix version 3.
+Copyright (C) 1994 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sysdep.h>
+
+.text
+.globl syscall_error
+.align 4
+ENTRY (syscall)
+	leal 8(%esp), %ecx	/* Load address of second argument.  */
+	movl $SYS_HANDLER, %eax	/* Use BSD system calls.  */
+	movw 4(%esp), %ax	/* Load system call number into low word.  */
+	int $T_SVC6		/* Pretend it takes six args.  */
+	jb syscall_error
+	ret
diff --git a/sysdeps/unix/bsd/sequent/i386/sysdep.h b/sysdeps/unix/bsd/sequent/i386/sysdep.h
new file mode 100644
index 0000000000..f1365e764e
--- /dev/null
+++ b/sysdeps/unix/bsd/sequent/i386/sysdep.h
@@ -0,0 +1,82 @@
+/* System call interface code for Sequent Symmetry running Dynix version 3.
+Copyright (C) 1993, 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sysdeps/unix/i386/sysdep.h>
+
+#ifdef	ASSEMBLER
+
+/* Get the symbols for system call interrupts.  */
+#include <machine/trap.h>
+  
+/* Use the BSD versions of system calls, by setting the high 16 bits
+   of the syscall number (see /usr/include/syscall.h).  */
+#define SYS_HANDLER (SYS_bsd << 16)
+
+/* Dynix uses an interrupt interface to system calls.
+   "int $T_SVCn" are syscall interfaces for 0-6 arg functions.
+   (see /usr/include/machine/trap.h).  */
+
+#undef	DO_CALL
+
+#ifdef	__STDC__
+#define DO_CALL(syscall_name, args) 					      \
+  movl $(SYS_HANDLER | SYS_##syscall_name), %eax;			      \
+  int $T_SVC##args;
+#else
+#define DO_CALL(syscall_name, args)					      \
+  movl $(SYS_HANDLER | SYS_/**/syscall_name), %eax;			      \
+  int $T_SVC/**/args;
+#endif
+
+#undef	PSEUDO
+#define	PSEUDO(name, syscall_name, args)				      \
+  .text;								      \
+  .globl syscall_error;							      \
+  .align 4;								      \
+  ENTRY (name)								      \
+  ARGS (args)								      \
+  DO_CALL (syscall_name, args)						      \
+  jb syscall_error
+
+/* For one and two-argument calls, Dynix takes the arguments in %ecx and
+   %edx.  For 3-6 argument calls, Dynix takes the address of the first
+   argument in %ecx.  */
+
+#ifdef __STDC__
+#define ARGS(n) ARGS_##n
+#else
+#define ARGS(n) ARGS_/**/n
+#endif
+
+#define ARGS_0
+#define ARGS_1	movl 4(%esp), %ecx;
+#define ARGS_2	movl 4(%esp), %ecx; movl 8(%esp), %edx;
+#define ARGS_3	leal 4(%esp), %ecx;
+#define ARGS_4	ARGS_3
+#define ARGS_5	ARGS_3
+#define ARGS_6	ARGS_3
+  
+/* Dynix reverses %ecx and %edx relative to most i386 Unices. */
+
+#undef	r1
+#define	r1		%ecx	/* Secondary return-value register.  */
+#undef	scratch
+#define scratch 	%edx	/* Call-clobbered register for random use.  */
+
+#endif	/* ASSEMBLER */