Fake a call frame for traps so that `gdb -k' can report where fatal

traps occurred.  This also helps ddb backtrace through trap frames.
Backtracing through syscall and interrupt frames still doesn't work
but it is relatively unimportant and more expensive to fix.
This commit is contained in:
Bruce Evans 1995-08-15 19:23:33 +00:00
parent d897bfb950
commit a722b904d7
3 changed files with 39 additions and 3 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.8.2.1 1995/06/05 00:22:02 davidg Exp $
* $Id: exception.s,v 1.9 1995/06/11 19:31:13 rgrimes Exp $
*/
#include "npx.h" /* NNPX */
@ -175,7 +175,19 @@ calltrap:
FAKE_MCOUNT(_btrap) /* init "from" _btrap -> calltrap */
incl _cnt+V_TRAP
orl $SWI_AST_MASK,_cpl
/*
* Fake a call frame: point %ebp at a 2 element array consisting
* of { trappee's %ebp, trappee's %eip }. The stack frame is in
* the wrong order for this, but the trappee's %ebp is fortunately
* followed by junk which we can overwrite with the trappee's %eip.
*/
movl TF_EIP(%esp),%eax
movl %eax,TF_ISP(%esp)
lea TF_EBP(%esp),%ebp
call _trap
/*
* There was no place to save the cpl so we have to recover it
* indirectly. For traps from user mode it was 0, and for traps

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.8.2.1 1995/06/05 00:22:02 davidg Exp $
* $Id: exception.s,v 1.9 1995/06/11 19:31:13 rgrimes Exp $
*/
#include "npx.h" /* NNPX */
@ -175,7 +175,19 @@ calltrap:
FAKE_MCOUNT(_btrap) /* init "from" _btrap -> calltrap */
incl _cnt+V_TRAP
orl $SWI_AST_MASK,_cpl
/*
* Fake a call frame: point %ebp at a 2 element array consisting
* of { trappee's %ebp, trappee's %eip }. The stack frame is in
* the wrong order for this, but the trappee's %ebp is fortunately
* followed by junk which we can overwrite with the trappee's %eip.
*/
movl TF_EIP(%esp),%eax
movl %eax,TF_ISP(%esp)
lea TF_EBP(%esp),%ebp
call _trap
/*
* There was no place to save the cpl so we have to recover it
* indirectly. For traps from user mode it was 0, and for traps

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.8.2.1 1995/06/05 00:22:02 davidg Exp $
* $Id: exception.s,v 1.9 1995/06/11 19:31:13 rgrimes Exp $
*/
#include "npx.h" /* NNPX */
@ -175,7 +175,19 @@ calltrap:
FAKE_MCOUNT(_btrap) /* init "from" _btrap -> calltrap */
incl _cnt+V_TRAP
orl $SWI_AST_MASK,_cpl
/*
* Fake a call frame: point %ebp at a 2 element array consisting
* of { trappee's %ebp, trappee's %eip }. The stack frame is in
* the wrong order for this, but the trappee's %ebp is fortunately
* followed by junk which we can overwrite with the trappee's %eip.
*/
movl TF_EIP(%esp),%eax
movl %eax,TF_ISP(%esp)
lea TF_EBP(%esp),%ebp
call _trap
/*
* There was no place to save the cpl so we have to recover it
* indirectly. For traps from user mode it was 0, and for traps