| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: trap.c,v 1.96 2011/01/23 09:44:59 skrll Exp $ */ | | 1 | /* $NetBSD: trap.c,v 1.97 2012/02/13 01:07:37 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2001, 2002 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 Matthew Fredette. | | 8 | * by Matthew Fredette. |
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. |
| @@ -48,27 +48,27 @@ | | | @@ -48,27 +48,27 @@ |
48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
50 | * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, | | 50 | * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, |
51 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 51 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
52 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 52 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
53 | * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 53 | * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 54 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | 55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | 56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
57 | * THE POSSIBILITY OF SUCH DAMAGE. | | 57 | * THE POSSIBILITY OF SUCH DAMAGE. |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #include <sys/cdefs.h> | | 60 | #include <sys/cdefs.h> |
61 | __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.96 2011/01/23 09:44:59 skrll Exp $"); | | 61 | __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2012/02/13 01:07:37 martin Exp $"); |
62 | | | 62 | |
63 | /* #define INTRDEBUG */ | | 63 | /* #define INTRDEBUG */ |
64 | /* #define TRAPDEBUG */ | | 64 | /* #define TRAPDEBUG */ |
65 | /* #define USERTRACE */ | | 65 | /* #define USERTRACE */ |
66 | | | 66 | |
67 | #include "opt_kgdb.h" | | 67 | #include "opt_kgdb.h" |
68 | #include "opt_ptrace.h" | | 68 | #include "opt_ptrace.h" |
69 | #include "opt_sa.h" | | 69 | #include "opt_sa.h" |
70 | | | 70 | |
71 | #include <sys/param.h> | | 71 | #include <sys/param.h> |
72 | #include <sys/systm.h> | | 72 | #include <sys/systm.h> |
73 | #include <sys/kernel.h> | | 73 | #include <sys/kernel.h> |
74 | #include <sys/syscall.h> | | 74 | #include <sys/syscall.h> |
| @@ -993,26 +993,39 @@ child_return(void *arg) | | | @@ -993,26 +993,39 @@ child_return(void *arg) |
993 | struct lwp *l = arg; | | 993 | struct lwp *l = arg; |
994 | | | 994 | |
995 | /* | | 995 | /* |
996 | * Return values in the frame set by cpu_lwp_fork(). | | 996 | * Return values in the frame set by cpu_lwp_fork(). |
997 | */ | | 997 | */ |
998 | | | 998 | |
999 | userret(l, l->l_md.md_regs->tf_iioq_head, 0); | | 999 | userret(l, l->l_md.md_regs->tf_iioq_head, 0); |
1000 | ktrsysret(SYS_fork, 0, 0); | | 1000 | ktrsysret(SYS_fork, 0, 0); |
1001 | #ifdef DEBUG | | 1001 | #ifdef DEBUG |
1002 | frame_sanity_check(__func__, __LINE__, 0, l->l_md.md_regs, l); | | 1002 | frame_sanity_check(__func__, __LINE__, 0, l->l_md.md_regs, l); |
1003 | #endif /* DEBUG */ | | 1003 | #endif /* DEBUG */ |
1004 | } | | 1004 | } |
1005 | | | 1005 | |
| | | 1006 | /* |
| | | 1007 | * Process the tail end of a posix_spawn() for the child. |
| | | 1008 | */ |
| | | 1009 | void |
| | | 1010 | cpu_spawn_return(struct lwp *l) |
| | | 1011 | { |
| | | 1012 | |
| | | 1013 | userret(l, l->l_md.md_regs->tf_iioq_head, 0); |
| | | 1014 | #ifdef DEBUG |
| | | 1015 | frame_sanity_check(__func__, __LINE__, 0, l->l_md.md_regs, l); |
| | | 1016 | #endif /* DEBUG */ |
| | | 1017 | } |
| | | 1018 | |
1006 | #ifdef PTRACE | | 1019 | #ifdef PTRACE |
1007 | | | 1020 | |
1008 | #include <sys/ptrace.h> | | 1021 | #include <sys/ptrace.h> |
1009 | | | 1022 | |
1010 | int | | 1023 | int |
1011 | ss_get_value(struct lwp *l, vaddr_t addr, u_int *value) | | 1024 | ss_get_value(struct lwp *l, vaddr_t addr, u_int *value) |
1012 | { | | 1025 | { |
1013 | struct uio uio; | | 1026 | struct uio uio; |
1014 | struct iovec iov; | | 1027 | struct iovec iov; |
1015 | | | 1028 | |
1016 | iov.iov_base = (void *)value; | | 1029 | iov.iov_base = (void *)value; |
1017 | iov.iov_len = sizeof(u_int); | | 1030 | iov.iov_len = sizeof(u_int); |
1018 | uio.uio_iov = &iov; | | 1031 | uio.uio_iov = &iov; |