Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 Add wrapper for trap() to be used for tra...



details:   https://anonhg.NetBSD.org/src/rev/d1ad2317257e
branches:  trunk
changeset: 537792:d1ad2317257e
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Sat Oct 05 21:21:05 2002 +0000

description:
Add wrapper for trap() to be used for traps that come in via a TSS.

diffstat:

 sys/arch/i386/i386/trap.c |  34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diffs (69 lines):

diff -r 93aee9c0fb44 -r d1ad2317257e sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sat Oct 05 21:20:27 2002 +0000
+++ b/sys/arch/i386/i386/trap.c Sat Oct 05 21:21:05 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.170 2002/10/01 12:57:01 fvdl Exp $  */
+/*     $NetBSD: trap.c,v 1.171 2002/10/05 21:21:05 fvdl Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.170 2002/10/01 12:57:01 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.171 2002/10/05 21:21:05 fvdl Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -125,6 +125,7 @@
 #include "npx.h"
 
 void trap __P((struct trapframe));
+void trap_tss __P((struct i386tss *, int, int));
 #if defined(I386_CPU)
 int trapwrite __P((unsigned));
 #endif
@@ -168,6 +169,32 @@
 
 #define        IDTVEC(name)    __CONCAT(X, name)
 
+void
+trap_tss(struct i386tss *tss, int trapno, int code)
+{
+       struct trapframe tf;
+
+       tf.tf_gs = tss->tss_gs;
+       tf.tf_fs = tss->tss_fs;
+       tf.tf_es = tss->__tss_es;
+       tf.tf_ds = tss->__tss_ds;
+       tf.tf_edi = tss->__tss_edi;
+       tf.tf_esi = tss->__tss_esi;
+       tf.tf_ebp = tss->tss_ebp;
+       tf.tf_ebx = tss->__tss_ebx;
+       tf.tf_edx = tss->__tss_edx;
+       tf.tf_ecx = tss->__tss_ecx;
+       tf.tf_eax = tss->__tss_eax;
+       tf.tf_trapno = trapno;
+       tf.tf_err = code | TC_TSS;
+       tf.tf_eip = tss->__tss_eip;
+       tf.tf_cs = tss->__tss_cs;
+       tf.tf_eflags = tss->__tss_eflags;
+       tf.tf_esp = tss->tss_esp;
+       tf.tf_ss = tss->__tss_ss;
+       trap(tf);
+}
+
 /*
  * trap(frame):
  *     Exception, fault, and trap interface to BSD kernel. This
@@ -419,7 +446,8 @@
 
        case T_ARITHTRAP|T_USER:
                KERNEL_PROC_LOCK(p);
-               (*p->p_emul->e_trapsignal)(p, SIGFPE, frame.tf_err);
+               (*p->p_emul->e_trapsignal)(p, SIGFPE,
+                   frame.tf_err & ~TC_FLAGMASK);
                KERNEL_PROC_UNLOCK(p);
                goto out;
 



Home | Main Index | Thread Index | Old Index