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