From 5c2c73523c27303d255b67541d5dc0bcfa8012c2 Mon Sep 17 00:00:00 2001 From: "hp.com!davidm" Date: Mon, 21 Apr 2003 23:14:14 +0000 Subject: [PATCH] (siglongjmp): If there aren't at least 4 eh-regs, abort() for now. In the future, we may want to support this for real by putting the necessary info on the stack. (Logical change 1.81) --- src/longjmp.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/longjmp.c b/src/longjmp.c index 26674720..e6c873fd 100644 --- a/src/longjmp.c +++ b/src/longjmp.c @@ -72,30 +72,32 @@ _longjmp (jmp_buf env, int val) } #endif - /* found the right frame: */ if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0) abort (); - assert (UNW_NUM_EH_REGS >= 4); - - if (unw_set_reg (&c, UNW_REG_EH + 0, wp[1]) < 0 - || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 - || unw_set_reg (&c, UNW_REG_EH + 2, - ((unw_word_t *) ¤t_mask)[0]) < 0 - || unw_set_reg (&c, UNW_REG_IP, - (unw_word_t) &_UI_siglongjmp_cont)) - abort (); - - if (_NSIG > 8 * sizeof (unw_word_t)) + if (UNW_NUM_EH_REGS >= 4) { - if (_NSIG > 16 * sizeof (unw_word_t)) - abort (); - if (unw_set_reg (&c, UNW_REG_EH + 3, - ((unw_word_t *) ¤t_mask)[1]) < 0) + if (unw_set_reg (&c, UNW_REG_EH + 0, wp[1]) < 0 + || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 + || unw_set_reg (&c, UNW_REG_EH + 2, + ((unw_word_t *) ¤t_mask)[0]) < 0 + || unw_set_reg (&c, UNW_REG_IP, + (unw_word_t) &_UI_siglongjmp_cont)) abort (); + + if (_NSIG > 8 * sizeof (unw_word_t)) + { + if (_NSIG > 16 * sizeof (unw_word_t)) + abort (); + if (unw_set_reg (&c, UNW_REG_EH + 3, + ((unw_word_t *) ¤t_mask)[1]) < 0) + abort (); + } } + else + abort (); unw_resume (&c);