| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sig_machdep.c,v 1.24 2018/11/27 14:09:54 maxv Exp $ */ | | 1 | /* $NetBSD: sig_machdep.c,v 1.25 2024/04/14 07:56:45 skrll Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas. | | 8 | * by Christos Zoulas. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,50 +20,50 @@ | | | @@ -20,50 +20,50 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 32 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
33 | | | 33 | |
34 | __KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.24 2018/11/27 14:09:54 maxv Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.25 2024/04/14 07:56:45 skrll Exp $"); |
35 | | | 35 | |
36 | #include "opt_cputype.h" | | 36 | #include "opt_cputype.h" |
37 | | | 37 | |
38 | #include <sys/param.h> | | 38 | #include <sys/param.h> |
39 | #include <sys/cpu.h> | | 39 | #include <sys/cpu.h> |
40 | #include <sys/kernel.h> | | 40 | #include <sys/kernel.h> |
41 | #include <sys/proc.h> | | 41 | #include <sys/proc.h> |
42 | #include <sys/signal.h> | | 42 | #include <sys/signal.h> |
43 | #include <sys/signalvar.h> | | 43 | #include <sys/signalvar.h> |
44 | #include <sys/mount.h> | | 44 | #include <sys/mount.h> |
45 | #include <sys/syscallargs.h> | | 45 | #include <sys/syscallargs.h> |
46 | | | 46 | |
47 | #include <mips/frame.h> | | 47 | #include <mips/frame.h> |
48 | #include <mips/regnum.h> | | 48 | #include <mips/regnum.h> |
49 | #include <mips/locore.h> | | 49 | #include <mips/locore.h> |
50 | | | 50 | |
51 | void * | | 51 | void * |
52 | getframe(struct lwp *l, int sig, int *onstack) | | 52 | getframe(struct lwp *l, int sig, int *onstack) |
53 | { | | 53 | { |
54 | struct proc * const p = l->l_proc; | | 54 | struct proc * const p = l->l_proc; |
55 | struct trapframe * const tf = l->l_md.md_utf; | | 55 | struct trapframe * const tf = l->l_md.md_utf; |
56 | | | 56 | |
57 | /* Do we need to jump onto the signal stack? */ | | 57 | /* Do we need to jump onto the signal stack? */ |
58 | *onstack = (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 | | 58 | *onstack = (l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 |
59 | && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; | | 59 | && (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0; |
60 | if (*onstack) | | 60 | if (*onstack) |
61 | return (char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size; | | 61 | return (char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size; |
62 | return (void *)(intptr_t)tf->tf_regs[_R_SP]; | | 62 | return (void *)(intptr_t)tf->tf_regs[_R_SP]; |
63 | } | | 63 | } |
64 | | | 64 | |
65 | struct sigframe_siginfo { | | 65 | struct sigframe_siginfo { |
66 | siginfo_t sf_si; | | 66 | siginfo_t sf_si; |
67 | ucontext_t sf_uc; | | 67 | ucontext_t sf_uc; |
68 | }; | | 68 | }; |
69 | | | 69 | |