| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: longjmp.c,v 1.5 2012/03/29 19:27:05 christos Exp $ */ | | 1 | /* $NetBSD: longjmp.c,v 1.6 2016/01/24 16:01:43 christos 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 Christian Limpach and Matt Thomas. | | 8 | * by Christian Limpach and Matt Thomas. |
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. |
| @@ -39,27 +39,27 @@ | | | @@ -39,27 +39,27 @@ |
39 | #include <machine/regnum.h> | | 39 | #include <machine/regnum.h> |
40 | | | 40 | |
41 | #define __LIBC12_SOURCE__ | | 41 | #define __LIBC12_SOURCE__ |
42 | #include <setjmp.h> | | 42 | #include <setjmp.h> |
43 | #include <compat/include/setjmp.h> | | 43 | #include <compat/include/setjmp.h> |
44 | | | 44 | |
45 | void | | 45 | void |
46 | __longjmp14(jmp_buf env, int val) | | 46 | __longjmp14(jmp_buf env, int val) |
47 | { | | 47 | { |
48 | struct sigcontext *sc = (void *)env; | | 48 | struct sigcontext *sc = (void *)env; |
49 | ucontext_t uc; | | 49 | ucontext_t uc; |
50 | | | 50 | |
51 | /* Ensure non-zero SP and sigcontext magic number is present */ | | 51 | /* Ensure non-zero SP and sigcontext magic number is present */ |
52 | if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != (mips_reg_t)0xACEDBADEU) | | 52 | if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != (__register_t)0xACEDBADEU) |
53 | goto err; | | 53 | goto err; |
54 | | | 54 | |
55 | /* Ensure non-zero return value */ | | 55 | /* Ensure non-zero return value */ |
56 | if (val == 0) | | 56 | if (val == 0) |
57 | val = 1; | | 57 | val = 1; |
58 | | | 58 | |
59 | /* | | 59 | /* |
60 | * Set _UC_{SET,CLR}STACK according to SS_ONSTACK. | | 60 | * Set _UC_{SET,CLR}STACK according to SS_ONSTACK. |
61 | * | | 61 | * |
62 | * Restore the signal mask with sigprocmask() instead of _UC_SIGMASK, | | 62 | * Restore the signal mask with sigprocmask() instead of _UC_SIGMASK, |
63 | * since libpthread may want to interpose on signal handling. | | 63 | * since libpthread may want to interpose on signal handling. |
64 | */ | | 64 | */ |
65 | uc.uc_flags = _UC_CPU | (sc->sc_onstack ? _UC_SETSTACK : _UC_CLRSTACK); | | 65 | uc.uc_flags = _UC_CPU | (sc->sc_onstack ? _UC_SETSTACK : _UC_CLRSTACK); |