Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3/sh3 userret() if the user process will be killed.



details:   https://anonhg.NetBSD.org/src/rev/e000874de86d
branches:  trunk
changeset: 480093:e000874de86d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Jan 03 02:55:25 2000 +0000

description:
userret() if the user process will be killed.
Now the NetBSD/sh3 works very stable!

diffstat:

 sys/arch/sh3/sh3/trap.c |  25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diffs (59 lines):

diff -r 8c2c252ccef1 -r e000874de86d sys/arch/sh3/sh3/trap.c
--- a/sys/arch/sh3/sh3/trap.c   Mon Jan 03 02:40:04 2000 +0000
+++ b/sys/arch/sh3/sh3/trap.c   Mon Jan 03 02:55:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.4 1999/12/05 11:56:35 ragge Exp $   */
+/*     $NetBSD: trap.c,v 1.5 2000/01/03 02:55:25 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
@@ -603,6 +603,8 @@
        struct vmspace *vm;
        vm_map_t map;
        int rv;
+       u_quad_t sticks = 0;
+       int type = 0;
        vm_prot_t ftype;
        extern vm_map_t kernel_map;
        unsigned nss;
@@ -610,6 +612,8 @@
        unsigned long pteh_save;
        int exptype;
 
+       uvmexp.traps++;
+
        va = (vaddr_t)SHREG_TEA;
        va = trunc_page(va);
        pde_index = pdei(va);
@@ -646,7 +650,20 @@
        if (p == NULL) {
                rv = KERN_FAILURE;
                goto nogo;
+       } else {
+#if 1
+               if (!KERNELMODE(frame.tf_r15)) {
+#else
+               if (!KERNELMODE(frame.tf_spc, frame.tf_ssr)) {
+#endif
+                       type = T_USER;
+                       sticks = p->p_sticks;
+                       p->p_md.md_regs = &frame;
+               }
+               else
+                       sticks = 0;
        }
+
        vm = p->p_vmspace;
        /*
         * It is only a kernel address space fault iff:
@@ -727,4 +744,10 @@
                trapsignal(p, SIGKILL, T_TLBINVALIDR);
        } else
                trapsignal(p, SIGSEGV, T_TLBINVALIDR);
+
+       if ((type & T_USER) == 0)
+               return;
+
+       if (p != NULL)
+               userret(p, frame.tf_spc, sticks);
 }



Home | Main Index | Thread Index | Old Index