| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: netbsd32_machdep.c,v 1.51 2008/05/21 14:10:28 ad Exp $ */ | | 1 | /* $NetBSD: netbsd32_machdep.c,v 1.52 2008/09/18 21:28:45 dsl Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2001 Wasabi Systems, Inc. | | 4 | * Copyright (c) 2001 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Frank van der Linden for Wasabi Systems, Inc. | | 7 | * Written by Frank van der Linden for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | | 28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC |
29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
35 | * POSSIBILITY OF SUCH DAMAGE. | | 35 | * POSSIBILITY OF SUCH DAMAGE. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.51 2008/05/21 14:10:28 ad Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.52 2008/09/18 21:28:45 dsl Exp $"); |
40 | | | 40 | |
41 | #include "opt_compat_netbsd.h" | | 41 | #include "opt_compat_netbsd.h" |
42 | #include "opt_coredump.h" | | 42 | #include "opt_coredump.h" |
43 | #include "opt_execfmt.h" | | 43 | #include "opt_execfmt.h" |
44 | #include "opt_user_ldt.h" | | 44 | #include "opt_user_ldt.h" |
45 | | | 45 | |
46 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
47 | #include <sys/exec.h> | | 47 | #include <sys/exec.h> |
48 | #include <sys/malloc.h> | | 48 | #include <sys/malloc.h> |
49 | #include <sys/proc.h> | | 49 | #include <sys/proc.h> |
50 | #include <sys/signalvar.h> | | 50 | #include <sys/signalvar.h> |
51 | #include <sys/systm.h> | | 51 | #include <sys/systm.h> |
52 | #include <sys/user.h> | | 52 | #include <sys/user.h> |
| @@ -255,27 +255,27 @@ netbsd32_sendsig_sigcontext(const ksigin | | | @@ -255,27 +255,27 @@ netbsd32_sendsig_sigcontext(const ksigin |
255 | /* NOTREACHED */ | | 255 | /* NOTREACHED */ |
256 | } | | 256 | } |
257 | | | 257 | |
258 | /* | | 258 | /* |
259 | * Build context to run handler in. | | 259 | * Build context to run handler in. |
260 | */ | | 260 | */ |
261 | tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL); | | 261 | tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL); |
262 | tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL); | | 262 | tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL); |
263 | tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL); | | 263 | tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL); |
264 | tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL); | | 264 | tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL); |
265 | | | 265 | |
266 | tf->tf_rip = (uint64_t)catcher; | | 266 | tf->tf_rip = (uint64_t)catcher; |
267 | tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL); | | 267 | tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL); |
268 | tf->tf_rflags &= ~(PSL_T|PSL_VM|PSL_AC); | | 268 | tf->tf_rflags &= ~PSL_CLEARSIG; |
269 | tf->tf_rsp = (uint64_t)fp; | | 269 | tf->tf_rsp = (uint64_t)fp; |
270 | tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL); | | 270 | tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL); |
271 | | | 271 | |
272 | /* Remember that we're now on the signal stack. */ | | 272 | /* Remember that we're now on the signal stack. */ |
273 | if (onstack) | | 273 | if (onstack) |
274 | l->l_sigstk.ss_flags |= SS_ONSTACK; | | 274 | l->l_sigstk.ss_flags |= SS_ONSTACK; |
275 | } | | 275 | } |
276 | #endif | | 276 | #endif |
277 | | | 277 | |
278 | static void | | 278 | static void |
279 | netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask) | | 279 | netbsd32_sendsig_siginfo(const ksiginfo_t *ksi, const sigset_t *mask) |
280 | { | | 280 | { |
281 | struct lwp *l = curlwp; | | 281 | struct lwp *l = curlwp; |
| @@ -340,27 +340,27 @@ netbsd32_sendsig_siginfo(const ksiginfo_ | | | @@ -340,27 +340,27 @@ netbsd32_sendsig_siginfo(const ksiginfo_ |
340 | /* NOTREACHED */ | | 340 | /* NOTREACHED */ |
341 | } | | 341 | } |
342 | | | 342 | |
343 | /* | | 343 | /* |
344 | * Build context to run handler in. | | 344 | * Build context to run handler in. |
345 | */ | | 345 | */ |
346 | tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL); | | 346 | tf->tf_ds = GSEL(GUDATA32_SEL, SEL_UPL); |
347 | tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL); | | 347 | tf->tf_es = GSEL(GUDATA32_SEL, SEL_UPL); |
348 | tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL); | | 348 | tf->tf_fs = GSEL(GUDATA32_SEL, SEL_UPL); |
349 | tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL); | | 349 | tf->tf_gs = GSEL(GUDATA32_SEL, SEL_UPL); |
350 | | | 350 | |
351 | tf->tf_rip = (uint64_t)catcher; | | 351 | tf->tf_rip = (uint64_t)catcher; |
352 | tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL); | | 352 | tf->tf_cs = GSEL(GUCODE32_SEL, SEL_UPL); |
353 | tf->tf_rflags &= ~(PSL_T|PSL_VM|PSL_AC); | | 353 | tf->tf_rflags &= ~CLEARSIG; |
354 | tf->tf_rsp = (uint64_t)fp; | | 354 | tf->tf_rsp = (uint64_t)fp; |
355 | tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL); | | 355 | tf->tf_ss = GSEL(GUDATA32_SEL, SEL_UPL); |
356 | | | 356 | |
357 | /* Remember that we're now on the signal stack. */ | | 357 | /* Remember that we're now on the signal stack. */ |
358 | if (onstack) | | 358 | if (onstack) |
359 | l->l_sigstk.ss_flags |= SS_ONSTACK; | | 359 | l->l_sigstk.ss_flags |= SS_ONSTACK; |
360 | } | | 360 | } |
361 | | | 361 | |
362 | void | | 362 | void |
363 | netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) | | 363 | netbsd32_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) |
364 | { | | 364 | { |
365 | #ifdef COMPAT_16 | | 365 | #ifdef COMPAT_16 |
366 | if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2) | | 366 | if (curproc->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2) |