subr_trap.c (b1529bda752c37693f63536eef8926e46e1c7d46) subr_trap.c (2838c9682aadaf8db1db7f32bbcb5953b141e999)
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
38 * $Id: trap.c,v 1.65 1995/12/14 08:21:29 phk Exp $
38 * $Id: trap.c,v 1.66 1995/12/14 14:35:36 peter Exp $
39 */
40
41/*
42 * 386 Trap and System call handling
43 */
44
45#include <sys/param.h>
46#include <sys/systm.h>

--- 37 unchanged lines hidden (view full) ---

84
85int (*pmath_emulate) __P((struct trapframe *));
86
87extern void trap __P((struct trapframe frame));
88extern int trapwrite __P((unsigned addr));
89extern void syscall __P((struct trapframe frame));
90extern void linux_syscall __P((struct trapframe frame));
91
39 */
40
41/*
42 * 386 Trap and System call handling
43 */
44
45#include <sys/param.h>
46#include <sys/systm.h>

--- 37 unchanged lines hidden (view full) ---

84
85int (*pmath_emulate) __P((struct trapframe *));
86
87extern void trap __P((struct trapframe frame));
88extern int trapwrite __P((unsigned addr));
89extern void syscall __P((struct trapframe frame));
90extern void linux_syscall __P((struct trapframe frame));
91
92static int trap_pfault __P((struct trapframe *, int));
93static void trap_fatal __P((struct trapframe *));
92static int trap_pfault __P((struct trapframe *, int));
93static void trap_fatal __P((struct trapframe *));
94void dblfault_handler __P((void));
94
95extern inthand_t IDTVEC(syscall);
96
97#define MAX_TRAP_MSG 27
98static char *trap_msg[] = {
99 "", /* 0 unused */
100 "privileged instruction fault", /* 1 T_PRIVINFLT */
101 "", /* 2 unused */

--- 649 unchanged lines hidden (view full) ---

751#endif
752 if (type <= MAX_TRAP_MSG)
753 panic(trap_msg[type]);
754 else
755 panic("unknown/reserved trap");
756}
757
758/*
95
96extern inthand_t IDTVEC(syscall);
97
98#define MAX_TRAP_MSG 27
99static char *trap_msg[] = {
100 "", /* 0 unused */
101 "privileged instruction fault", /* 1 T_PRIVINFLT */
102 "", /* 2 unused */

--- 649 unchanged lines hidden (view full) ---

752#endif
753 if (type <= MAX_TRAP_MSG)
754 panic(trap_msg[type]);
755 else
756 panic("unknown/reserved trap");
757}
758
759/*
760 * Double fault handler. Called when a fault occurs while writing
761 * a frame for a trap/exception onto the stack. This usually occurs
762 * when the stack overflows (such is the case with infinite recursion,
763 * for example).
764 *
765 * XXX Note that the current PTD gets replaced by IdlePTD when the
766 * task switch occurs. This means that the stack that was active at
767 * the time of the double fault is not available at <kstack> unless
768 * the machine was idlewhen the double fault occurred. This downside
769 * of this is that "trace <ebp>" in ddb won't work.
770 */
771void
772dblfault_handler()
773{
774 struct pcb *pcb = curpcb;
775
776 if (pcb != NULL) {
777 printf("\nFatal double fault:\n");
778 printf("eip = 0x%x\n", pcb->pcb_tss.tss_eip);
779 printf("esp = 0x%x\n", pcb->pcb_tss.tss_esp);
780 printf("ebp = 0x%x\n", pcb->pcb_tss.tss_ebp);
781 }
782
783 panic("double fault");
784}
785
786/*
759 * Compensate for 386 brain damage (missing URKR).
760 * This is a little simpler than the pagefault handler in trap() because
761 * it the page tables have already been faulted in and high addresses
762 * are thrown out early for other reasons.
763 */
764int trapwrite(addr)
765 unsigned addr;
766{

--- 264 unchanged lines hidden ---
787 * Compensate for 386 brain damage (missing URKR).
788 * This is a little simpler than the pagefault handler in trap() because
789 * it the page tables have already been faulted in and high addresses
790 * are thrown out early for other reasons.
791 */
792int trapwrite(addr)
793 unsigned addr;
794{

--- 264 unchanged lines hidden ---