Source-Changes-HG archive

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

[src/yamt-uio_vmspace]: src/sys/arch/alpha/common fix crashes introduced by t...



details:   https://anonhg.NetBSD.org/src/rev/64e01b6e05c8
branches:  yamt-uio_vmspace
changeset: 586717:64e01b6e05c8
user:      yamt <yamt%NetBSD.org@localhost>
date:      Tue Feb 07 10:17:58 2006 +0000

description:
fix crashes introduced by the previous.

diffstat:

 sys/arch/alpha/common/bus_dma.c       |  15 ++++++++++-----
 sys/arch/alpha/common/sgmap_typedep.c |  11 ++++++++---
 2 files changed, 18 insertions(+), 8 deletions(-)

diffs (89 lines):

diff -r 0b46174b9520 -r 64e01b6e05c8 sys/arch/alpha/common/bus_dma.c
--- a/sys/arch/alpha/common/bus_dma.c   Sun Feb 05 13:53:39 2006 +0000
+++ b/sys/arch/alpha/common/bus_dma.c   Tue Feb 07 10:17:58 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.61.2.1 2006/02/05 13:53:39 yamt Exp $ */
+/* $NetBSD: bus_dma.c,v 1.61.2.2 2006/02/07 10:17:58 yamt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.61.2.1 2006/02/05 13:53:39 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.61.2.2 2006/02/07 10:17:58 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -235,7 +235,7 @@
 {
        paddr_t lastaddr;
        int seg, error;
-       struct vmspace *vm = p->p_vmspace;
+       struct vmspace *vm;
 
        /*
         * Make sure that on error condition we return "no valid mappings".
@@ -248,6 +248,11 @@
        if (buflen > map->_dm_size)
                return (EINVAL);
 
+       if (p != NULL) {
+               vm = p->p_vmspace;
+       } else {
+               vm = vmspace_kernel();
+       }
        seg = 0;
        error = _bus_dmamap_load_buffer_direct(t, map, buf, buflen,
            vm, flags, &lastaddr, &seg, 1);
@@ -335,8 +340,8 @@
 
                default:
                        error = _bus_dmamap_load_buffer_direct(t, map,
-                           m->m_data, m->m_len, NULL, flags, &lastaddr,
-                           &seg, first);
+                           m->m_data, m->m_len, vmspace_kernel(), flags,
+                           &lastaddr, &seg, first);
                }
                first = 0;
        }
diff -r 0b46174b9520 -r 64e01b6e05c8 sys/arch/alpha/common/sgmap_typedep.c
--- a/sys/arch/alpha/common/sgmap_typedep.c     Sun Feb 05 13:53:39 2006 +0000
+++ b/sys/arch/alpha/common/sgmap_typedep.c     Tue Feb 07 10:17:58 2006 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap_typedep.c,v 1.32.2.1 2006/02/05 13:53:40 yamt Exp $ */
+/* $NetBSD: sgmap_typedep.c,v 1.32.2.2 2006/02/07 10:17:58 yamt Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.32.2.1 2006/02/05 13:53:40 yamt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.32.2.2 2006/02/07 10:17:58 yamt Exp $");
 
 #include "opt_ddb.h"
 
@@ -203,7 +203,7 @@
     bus_size_t buflen, struct proc *p, int flags, struct alpha_sgmap *sgmap)
 {
        int seg, error;
-       struct vmspace *vm = p->p_vmspace;
+       struct vmspace *vm;
 
        /*
         * Make sure that on error condition we return "no valid mappings".
@@ -220,6 +220,11 @@
 
        map->_dm_flags |= flags & (BUS_DMA_READ|BUS_DMA_WRITE);
 
+       if (p != NULL) {
+               vm = p->p_vmspace;
+       } else {
+               vm = vmspace_kernel();
+       }
        seg = 0;
        error = __C(SGMAP_TYPE,_load_buffer)(t, map, buf, buflen, vm,
            flags, seg, sgmap);



Home | Main Index | Thread Index | Old Index