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