Home | History | Annotate | Line # | Download | only in mips
      1 /*	$NetBSD: sigcode.S,v 1.5 2016/07/27 09:32:35 skrll Exp $	*/
      2 
      3 #include "opt_compat_netbsd.h"
      4 #include "opt_compat_ultrix.h"
      5 #include "opt_compat_linux.h"
      6 
      7 #include <mips/signal.h>
      8 #include <sys/syscall.h>
      9 #ifdef COMPAT_ULTRIX
     10 #include <compat/ultrix/ultrix_syscall.h>
     11 #endif
     12 #ifdef COMPAT_LINUX
     13 #include <compat/linux/linux_syscall.h>
     14 #endif
     15 
     16 #include <mips/asm.h>
     17 
     18 RCSID("$NetBSD: sigcode.S,v 1.5 2016/07/27 09:32:35 skrll Exp $")
     19 
     20 #include "assym.h"
     21 
     22 	.set	noreorder
     23 
     24 #ifdef COMPAT_16
     25 /*
     26  * This code is copied the user's stack for returning from signal handlers
     27  * (see sendsig() and sigreturn()). We have to compute the address
     28  * of the sigcontext struct for the sigreturn call.
     29  *
     30  * NB: we cannot profile sigcode(), it executes from userspace.
     31  */
     32 LEAF_NOPROFILE(sigcode)
     33 	move	a0, sp			# address of sigcontext
     34 	li	v0, SYS_compat_16___sigreturn14	# sigreturn(scp)
     35 	syscall
     36 	break	0			# just in case sigreturn fails
     37 END(sigcode)
     38 XLEAF(esigcode)
     39 #endif
     40 
     41 #ifdef COMPAT_ULTRIX
     42 LEAF_NOPROFILE(ultrix_sigcode)
     43 	move	a0, sp			# address of sigcontext
     44 	li	v0, ULTRIX_SYS_sigreturn	# sigreturn(scp)
     45 	syscall
     46 	break	0			# just in case sigreturn fails
     47 END(ultrix_sigcode)
     48 XLEAF(ultrix_esigcode)
     49 #endif
     50 
     51 #ifdef COMPAT_LINUX
     52 #define SYSCALL_SHIFT 4000		# 4000 shift as in linux_syscall.c
     53 LEAF_NOPROFILE(linux_sigcode)
     54 	move	a0, sp			# address of sigcontext
     55 	li	v0, LINUX_SYS_sigreturn	+ SYSCALL_SHIFT # sigreturn(sf)
     56 	syscall
     57 	break	0			# just in case sigreturn fails
     58 END(linux_sigcode)
     59 XLEAF(linux_esigcode)
     60 #undef SYSCALL_SHIFT
     61 #endif
     62