summaryrefslogtreecommitdiff
path: root/sysdeps/unix/bsd/sun/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/bsd/sun/m68k')
-rw-r--r--sysdeps/unix/bsd/sun/m68k/Dist1
-rw-r--r--sysdeps/unix/bsd/sun/m68k/Makefile3
-rw-r--r--sysdeps/unix/bsd/sun/m68k/brk.S49
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sethostid.S44
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sigcontext.h26
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sigtramp.c142
-rw-r--r--sysdeps/unix/bsd/sun/m68k/syscall.S28
-rw-r--r--sysdeps/unix/bsd/sun/m68k/sysdep.h62
8 files changed, 355 insertions, 0 deletions
diff --git a/sysdeps/unix/bsd/sun/m68k/Dist b/sysdeps/unix/bsd/sun/m68k/Dist
new file mode 100644
index 0000000000..cd893ff463
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/Dist
@@ -0,0 +1 @@
+sigtramp.c
diff --git a/sysdeps/unix/bsd/sun/m68k/Makefile b/sysdeps/unix/bsd/sun/m68k/Makefile
new file mode 100644
index 0000000000..ac4121dc2c
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/Makefile
@@ -0,0 +1,3 @@
+ifeq ($(subdir),signal)
+sysdep_routines := $(sysdep_routines) sigtramp
+endif
diff --git a/sysdeps/unix/bsd/sun/m68k/brk.S b/sysdeps/unix/bsd/sun/m68k/brk.S
new file mode 100644
index 0000000000..114fa73c85
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/brk.S
@@ -0,0 +1,49 @@
+/* Copyright (C) 1991, 1992, 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>
+
+#ifndef SYS_brk
+#define SYS_brk 17
+#endif
+
+#ifndef HAVE_GNU_LD
+#define __end _end
+#endif
+
+.data
+.globl ___curbrk
+___curbrk:
+ .long __end
+
+.text
+ENTRY (__brk)
+ movel __end, d0
+ cmpl sp@(4), d0
+ ble 0f
+ movel d0, sp@(4)
+0: pea SYS_brk
+ trap #0
+ bcs 1f
+ movel sp@(4), ___curbrk
+ clrl d0
+ rts
+1:
+ jmp syscall_error
+
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/bsd/sun/m68k/sethostid.S b/sysdeps/unix/bsd/sun/m68k/sethostid.S
new file mode 100644
index 0000000000..8b30f3fe65
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/sethostid.S
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1992 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>
+
+#ifdef SYS_sethostid
+
+SYSCALL (sethostid, 1)
+ ret
+
+#else
+
+#include <errnos.h>
+
+.globl _sethostid
+.even
+_sethostid:
+ movel #ENOSYS, _errno
+ moveq #-1, d0
+ rts
+
+#ifdef HAVE_GNU_LD
+
+.stabs "warning: sethostid is not implemented and will always fail",30,0,0,0
+.stabs "_sethostid",1,0,0,0
+
+#endif
+
+#endif
diff --git a/sysdeps/unix/bsd/sun/m68k/sigcontext.h b/sysdeps/unix/bsd/sun/m68k/sigcontext.h
new file mode 100644
index 0000000000..471b516bdc
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/sigcontext.h
@@ -0,0 +1,26 @@
+/* Structure describing state saved while handling a signal. Sun 3 version.
+Copyright (C) 1993, 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. */
+
+struct sigcontext
+ {
+ int sc_onstack;
+ __sigset_t sc_mask;
+
+ int sc_sp, sc_pc, sc_ps;
+ };
diff --git a/sysdeps/unix/bsd/sun/m68k/sigtramp.c b/sysdeps/unix/bsd/sun/m68k/sigtramp.c
new file mode 100644
index 0000000000..32a2c2047e
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/sigtramp.c
@@ -0,0 +1,142 @@
+/* Copyright (C) 1993 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 <ansidecl.h>
+
+#ifndef __GNUC__
+ #error This file uses GNU C extensions; you must compile with GCC.
+#endif
+
+/* Get the definition of `struct sigcontext'. */
+#define KERNEL
+#define sigvec sun_sigvec
+#define sigstack sun_sigstack
+#define sigcontext sun_sigcontext
+#include "/usr/include/sys/signal.h"
+#undef sigvec
+#undef sigstack
+#undef sigcontext
+#undef NSIG
+#undef SIGABRT
+#undef SIGCLD
+#undef SV_ONSTACK
+#undef SV_RESETHAND
+#undef SV_INTERRUPT
+#undef SA_ONSTACK
+#undef SA_NOCLDSTOP
+#undef SIG_ERR
+#undef SIG_DFL
+#undef SIG_IGN
+#undef sigmask
+#undef SIG_BLOCK
+#undef SIG_UNBLOCK
+#undef SIG_SETMASK
+
+#include <signal.h>
+#include <stddef.h>
+#include <errno.h>
+
+/* Defined in __sigvec.S. */
+extern int EXFUN(__raw_sigvec, (int sig, CONST struct sigvec *vec,
+ struct sigvec *ovec));
+
+/* User-specified signal handlers. */
+#define mytramp 1
+#ifdef mytramp
+static __sighandler_t handlers[NSIG];
+#else
+#define handlers _sigfunc
+extern __sighandler_t _sigfunc[];
+#endif
+
+#if mytramp
+
+/* Handler for all signals that are handled by a user-specified function.
+ Saves and restores the general regs %g2-%g7, the %y register, and
+ all the FPU regs (including %fsr), around calling the user's handler. */
+static void
+DEFUN(trampoline, (sig, code, context, addr),
+ int sig AND int code AND struct sigcontext *context AND PTR addr)
+{
+ int save[4];
+
+ /* Save the call-clobbered registers. */
+ asm volatile ("movem%.l d0-d1/a0-a1, %0" : : "m" (save[0]));
+
+ /* XXX should save/restore FP regs */
+
+ /* Call the user's handler. */
+ (*((void EXFUN((*), (int sig, int code, struct sigcontext *context,
+ PTR addr))) handlers[sig]))
+ (sig, code, context, addr);
+
+ /* Restore the call-clobbered registers. */
+ asm volatile ("movem%.l %0, d0-d1/a0-a1" : : "g" (save[0]) :
+ "d0", "d1", "a0", "a1");
+
+ __sigreturn (context);
+}
+
+#endif
+
+int
+DEFUN(__sigvec, (sig, vec, ovec),
+ int sig AND CONST struct sigvec *vec AND struct sigvec *ovec)
+{
+#ifndef mytramp
+ extern void _sigtramp (int);
+#define trampoline _sigtramp
+#endif
+ struct sigvec myvec;
+ int mask;
+ __sighandler_t ohandler;
+
+ if (sig <= 0 || sig >= NSIG)
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ mask = __sigblock(sigmask(sig));
+
+ ohandler = handlers[sig];
+
+ if (vec != NULL &&
+ vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
+ {
+ handlers[sig] = vec->sv_handler;
+ myvec = *vec;
+ myvec.sv_handler = trampoline;
+ vec = &myvec;
+ }
+
+ if (__raw_sigvec(sig, vec, ovec) < 0)
+ {
+ int save = errno;
+ (void) __sigsetmask(mask);
+ errno = save;
+ return -1;
+ }
+
+ if (ovec != NULL && ovec->sv_handler == trampoline)
+ ovec->sv_handler = ohandler;
+
+ (void) __sigsetmask(mask);
+
+ return 0;
+}
diff --git a/sysdeps/unix/bsd/sun/m68k/syscall.S b/sysdeps/unix/bsd/sun/m68k/syscall.S
new file mode 100644
index 0000000000..0a98da7c67
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/syscall.S
@@ -0,0 +1,28 @@
+/* Copyright (C) 1993 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>
+
+ENTRY (syscall)
+ movel sp@, d0 /* Save return address in D0. */
+ movel sp@(4), sp@ /* Put syscall number at top of stack. */
+ movel d0, sp@(4) /* Put return address under it. */
+ trap #0 /* Do syscall; pops number from stack. */
+ jcs error
+ ret
+error: jmp syscall_error
diff --git a/sysdeps/unix/bsd/sun/m68k/sysdep.h b/sysdeps/unix/bsd/sun/m68k/sysdep.h
new file mode 100644
index 0000000000..80f6aba7b0
--- /dev/null
+++ b/sysdeps/unix/bsd/sun/m68k/sysdep.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 1991, 1992, 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 <sysdeps/unix/sysdep.h>
+
+#ifdef ASSEMBLER
+
+#define POUND #
+
+#ifdef __STDC__
+#define ENTRY(name) \
+ .globl _##name; \
+ .even; \
+ _##name##:
+#else
+#define ENTRY(name) \
+ .globl _/**/name; \
+ .even; \
+ _/**/name/**/:
+#endif
+
+#ifdef __STDC__
+#define PSEUDO(name, syscall_name, args) \
+ .even; \
+ .globl syscall_error; \
+ error: jmp syscall_error; \
+ ENTRY (name) \
+ pea SYS_##syscall_name; \
+ trap POUND 0; \
+ bcs error
+#else
+#define PSEUDO(name, syscall_name, args) \
+ .even; \
+ .globl syscall_error; \
+ error: jmp syscall_error; \
+ ENTRY (name) \
+ pea SYS_/**/syscall_name; \
+ trap POUND 0; \
+ bcs error
+#endif
+
+#define ret rts
+#define r0 d0
+#define r1 d1
+#define MOVE(x,y) movel x , y
+
+#endif /* ASSEMBLER */