diff --git a/include/dwarf-eh.h b/include/dwarf-eh.h new file mode 100644 index 00000000..e69de29b diff --git a/include/hppa/dwarf-config.h b/include/hppa/dwarf-config.h index 29f9eee4..e69de29b 100644 --- a/include/hppa/dwarf-config.h +++ b/include/hppa/dwarf-config.h @@ -1,54 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (c) 2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef dwarf_config_h -#define dwarf_config_h - -/* See DWARF_FRAME_REGNUM() macro in gcc/config/pa/pa32-regs.h: */ -#define dwarf_to_unw_regnum(reg) \ - (((reg) < DWARF_NUM_PRESERVED_REGS) ? (reg) : 0) - -/* This matches the value used by GCC (see - gcc/config/pa/pa32-regs.h:FIRST_PSEUDO_REGISTER), which leaves - plenty of room for expansion. */ -#define DWARF_NUM_PRESERVED_REGS 89 - -/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 1 - -/* Convert a pointer to a dwarf_cursor structure to a pointer to - unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) - -typedef struct dwarf_loc - { - unw_word_t val; -#ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see X86_LOC_TYPE_* macros. */ -#endif - } -dwarf_loc_t; - -#endif /* dwarf_config_h */ diff --git a/include/hppa/jmpbuf.h b/include/hppa/jmpbuf.h index 6735b21a..e69de29b 100644 --- a/include/hppa/jmpbuf.h +++ b/include/hppa/jmpbuf.h @@ -1,33 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ - -#ifndef JB_SP -# define JB_SP 19 -#endif -#define JB_RP 20 -#define JB_MASK_SAVED 21 -#define JB_MASK 22 diff --git a/src/hppa/Gcreate_addr_space.c b/src/hppa/Gcreate_addr_space.c index 8f4301fe..e69de29b 100644 --- a/src/hppa/Gcreate_addr_space.c +++ b/src/hppa/Gcreate_addr_space.c @@ -1,52 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include - -#include "unwind_i.h" - -PROTECTED unw_addr_space_t -unw_create_addr_space (unw_accessors_t *a, int byte_order) -{ -#ifdef UNW_LOCAL_ONLY - return NULL; -#else - unw_addr_space_t as = malloc (sizeof (*as)); - - if (!as) - return NULL; - - memset (as, 0, sizeof (*as)); - - as->acc = *a; - - /* - * hppa supports only big-endian. - */ - if (byte_order != 0 && byte_order != __BIG_ENDIAN) - return NULL; - return as; -#endif -} diff --git a/src/hppa/Gget_save_loc.c b/src/hppa/Gget_save_loc.c index 7aa6f311..e69de29b 100644 --- a/src/hppa/Gget_save_loc.c +++ b/src/hppa/Gget_save_loc.c @@ -1,59 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include "unwind_i.h" - -PROTECTED int -unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) -{ - struct cursor *c = (struct cursor *) cursor; - dwarf_loc_t loc; - - loc = DWARF_NULL_LOC; /* default to "not saved" */ - -#warning FIX ME! - - memset (sloc, 0, sizeof (sloc)); - - if (DWARF_IS_NULL_LOC (loc)) - { - sloc->type = UNW_SLT_NONE; - return 0; - } - -#if !defined(UNW_LOCAL_ONLY) - if (DWARF_IS_REG_LOC (loc)) - { - sloc->type = UNW_SLT_REG; - sloc->u.regnum = DWARF_GET_LOC (loc); - } - else -#endif - { - sloc->type = UNW_SLT_MEMORY; - sloc->u.addr = DWARF_GET_LOC (loc); - } - return 0; -} diff --git a/src/hppa/Gglobal.c b/src/hppa/Gglobal.c index a56426da..e69de29b 100644 --- a/src/hppa/Gglobal.c +++ b/src/hppa/Gglobal.c @@ -1,57 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include "unwind_i.h" - -HIDDEN pthread_mutex_t hppa_lock = PTHREAD_MUTEX_INITIALIZER; -HIDDEN int tdep_needs_initialization = 1; - -HIDDEN void -tdep_init (void) -{ - intrmask_t saved_mask; - - sigfillset (&unwi_full_mask); - - sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask); - mutex_lock (&hppa_lock); - { - if (!tdep_needs_initialization) - /* another thread else beat us to it... */ - goto out; - - mi_init (); - - dwarf_init (); - -#ifndef UNW_REMOTE_ONLY - hppa_local_addr_space_init (); -#endif - tdep_needs_initialization = 0; /* signal that we're initialized... */ - } - out: - mutex_unlock (&hppa_lock); - sigprocmask (SIG_SETMASK, &saved_mask, NULL); -} diff --git a/src/hppa/Ginit_remote.c b/src/hppa/Ginit_remote.c index 3d6606df..e69de29b 100644 --- a/src/hppa/Ginit_remote.c +++ b/src/hppa/Ginit_remote.c @@ -1,46 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (c) 2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include "init.h" -#include "unwind_i.h" - -PROTECTED int -unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) -{ -#ifdef UNW_LOCAL_ONLY - return -UNW_EINVAL; -#else /* !UNW_LOCAL_ONLY */ - struct cursor *c = (struct cursor *) cursor; - - if (tdep_needs_initialization) - tdep_init (); - - Debug (1, "(cursor=%p)\n", c); - - c->dwarf.as = as; - c->dwarf.as_arg = as_arg; - return common_init (c); -#endif /* !UNW_LOCAL_ONLY */ -} diff --git a/src/hppa/Lcreate_addr_space.c b/src/hppa/Lcreate_addr_space.c index 0f2dc6be..e69de29b 100644 --- a/src/hppa/Lcreate_addr_space.c +++ b/src/hppa/Lcreate_addr_space.c @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Gcreate_addr_space.c" -#endif diff --git a/src/hppa/Lget_save_loc.c b/src/hppa/Lget_save_loc.c index 9ea048a9..e69de29b 100644 --- a/src/hppa/Lget_save_loc.c +++ b/src/hppa/Lget_save_loc.c @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Gget_save_loc.c" -#endif diff --git a/src/hppa/Lglobal.c b/src/hppa/Lglobal.c index 6d7b489e..e69de29b 100644 --- a/src/hppa/Lglobal.c +++ b/src/hppa/Lglobal.c @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Gglobal.c" -#endif diff --git a/src/hppa/Linit_remote.c b/src/hppa/Linit_remote.c index 58cb04ab..e69de29b 100644 --- a/src/hppa/Linit_remote.c +++ b/src/hppa/Linit_remote.c @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Ginit_remote.c" -#endif diff --git a/src/hppa/Lis_signal_frame.c b/src/hppa/Lis_signal_frame.c index b9a7c4f5..e69de29b 100644 --- a/src/hppa/Lis_signal_frame.c +++ b/src/hppa/Lis_signal_frame.c @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Gis_signal_frame.c" -#endif diff --git a/src/hppa/Lresume.c b/src/hppa/Lresume.c index 41a8cf00..e69de29b 100644 --- a/src/hppa/Lresume.c +++ b/src/hppa/Lresume.c @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Gresume.c" -#endif diff --git a/src/setjmp/longjmp.c b/src/setjmp/longjmp.c index ac31b5b2..e69de29b 100644 --- a/src/setjmp/longjmp.c +++ b/src/setjmp/longjmp.c @@ -1,88 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#define UNW_LOCAL_ONLY - -#include -#include -#include -#include -#include - -#include "jmpbuf.h" -#include "setjmp_i.h" - -void -_longjmp (jmp_buf env, int val) -{ - extern int _UI_longjmp_cont; - unw_context_t uc; - unw_cursor_t c; - unw_word_t sp; - unw_word_t *wp = (unw_word_t *) env; - - if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0) - abort (); - - do - { - if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) - abort (); - if (sp != wp[JB_SP]) - continue; - - if (!bsp_match (&c, wp)) - continue; - - /* found the right frame: */ - - assert (UNW_NUM_EH_REGS >= 2); - - if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 - || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 - || unw_set_reg (&c, UNW_REG_IP, - (unw_word_t) &_UI_longjmp_cont)) - abort (); - - unw_resume (&c); - - abort (); - } - while (unw_step (&c) >= 0); - - abort (); -} - -#ifdef __GNUC__ -void longjmp (jmp_buf env, int val) __attribute__ ((alias ("_longjmp"))); -#else - -void -longjmp (jmp_buf env, int val) -{ - _longjmp (env, val); -} - -#endif diff --git a/src/setjmp/setjmp.c b/src/setjmp/setjmp.c new file mode 100644 index 00000000..e69de29b diff --git a/src/setjmp/setjmp_i.h b/src/setjmp/setjmp_i.h index b6bc1165..e69de29b 100644 --- a/src/setjmp/setjmp_i.h +++ b/src/setjmp/setjmp_i.h @@ -1,118 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#if UNW_TARGET_IA64 - -#include "tdep.h" -#include "ia64/rse.h" - -static inline int -bsp_match (unw_cursor_t *c, unw_word_t *wp) -{ - unw_word_t bsp, pfs, sol; - - if (unw_get_reg (c, UNW_IA64_BSP, &bsp) < 0 - || unw_get_reg (c, UNW_IA64_AR_PFS, &pfs) < 0) - abort (); - - /* simulate the effect of "br.call sigsetjmp" on ar.bsp: */ - sol = (pfs >> 7) & 0x7f; - bsp = rse_skip_regs (bsp, sol); - - if (bsp != wp[JB_BSP]) - return 0; - - if (unlikely (sol == 0)) - { - unw_word_t sp, prev_sp; - unw_cursor_t tmp = *c; - - /* The caller of {sig,}setjmp() cannot have a NULL-frame. If we - see a NULL-frame, we haven't reached the right target yet. - To have a NULL-frame, the number of locals must be zero and - the stack-frame must also be empty. */ - - if (unw_step (&tmp) < 0) - abort (); - - if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0 - || unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0) - abort (); - - if (sp == prev_sp) - /* got a NULL-frame; keep looking... */ - return 0; - } - return 1; -} - -/* On ia64 we cannot always call sigprocmask() at - _UI_siglongjmp_cont() because the signal may have switched stacks - and the old stack's register-backing store may have overflown, - leaving us no space to allocate the stacked registers needed to - call sigprocmask(). Fortunately, we can just let unw_resume() (via - sigreturn) take care of restoring the signal-mask. That's faster - anyhow. */ -static inline int -resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp) -{ - unw_word_t sc_addr = ((struct cursor *) c)->sigcontext_addr; - struct sigcontext *sc = (struct sigcontext *) sc_addr; - sigset_t current_mask; - void *mp; - - if (!sc_addr) - return 0; - - /* let unw_resume() install the desired signal mask */ - - if (wp[JB_MASK_SAVED]) - mp = &wp[JB_MASK]; - else - { - if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0) - abort (); - mp = ¤t_mask; - } - memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask)); - return 1; -} - -#else /* !UNW_TARGET_IA64 */ - -static inline int -bsp_match (unw_cursor_t *c, unw_word_t *wp) -{ - return 1; -} - -static inline int -resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp) -{ - /* We may want to do this analogously as for ia64... */ - return 0; -} - -#endif /* !UNW_TARGET_IA64 */ diff --git a/src/setjmp/siglongjmp.c b/src/setjmp/siglongjmp.c index fea5de1a..e69de29b 100644 --- a/src/setjmp/siglongjmp.c +++ b/src/setjmp/siglongjmp.c @@ -1,98 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#define UNW_LOCAL_ONLY - -#include -#include -#include -#include -#include - -#include "tdep.h" -#include "jmpbuf.h" -#include "setjmp_i.h" - -void -siglongjmp (sigjmp_buf env, int val) -{ - unw_word_t *wp = (unw_word_t *) env; - extern int _UI_siglongjmp_cont; - extern int _UI_longjmp_cont; - unw_context_t uc; - unw_cursor_t c; - unw_word_t sp; - int *cont; - - if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0) - abort (); - - do - { - if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) - abort (); - if (sp != wp[JB_SP]) - continue; - - if (!bsp_match (&c, wp)) - continue; - - /* found the right frame: */ - - /* default to resuming without restoring signal-mask */ - cont = &_UI_longjmp_cont; - - /* Order of evaluation is important here: if unw_resume() - restores signal mask, we must set it up appropriately, even - if wp[JB_MASK_SAVED] is FALSE. */ - if (!resume_restores_sigmask (&c, wp) && wp[JB_MASK_SAVED]) - { - /* sigmask was saved */ - if (UNW_NUM_EH_REGS < 4 || _NSIG >= 16 * sizeof (unw_word_t)) - /* signal mask doesn't fit into EH arguments and we can't - put it on the stack without overwriting something - else... */ - abort (); - else - if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0 - || (_NSIG > 8 * sizeof (unw_word_t) - && unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0)) - abort (); - cont = &_UI_siglongjmp_cont; - } - - if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 - || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 - || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) cont)) - abort (); - - unw_resume (&c); - - abort (); - } - while (unw_step (&c) >= 0); - - abort (); -} diff --git a/src/setjmp/sigsetjmp.c b/src/setjmp/sigsetjmp.c new file mode 100644 index 00000000..e69de29b diff --git a/src/x86/longjmp.S b/src/x86/longjmp.S index ce8d4b2c..e69de29b 100644 --- a/src/x86/longjmp.S +++ b/src/x86/longjmp.S @@ -1,37 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - .globl _UI_longjmp_cont - - .type _UI_longjmp_cont, @function -_UI_longjmp_cont: - .cfi_startproc - .cfi_register 8, 0 /* IP saved in EAX */ - push %eax /* push target IP as return address */ - .cfi_restore 8 - mov %edx, %eax /* set up return-value */ - ret - .cfi_endproc - .size _UI_siglongjmp_cont, .-_UI_longjmp_cont