Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb XXX



details:   https://anonhg.NetBSD.org/src/rev/d7c833dc3e9c
branches:  trunk
changeset: 933905:d7c833dc3e9c
user:      rin <rin%NetBSD.org@localhost>
date:      Sun May 31 09:42:46 2020 +0000

description:
XXX
DDB can be running in the interrupt context, e.g., when activated from
console. Therefore, we use kmem_intr_alloc(9) and friends in order to
avoid assertion failure.

diffstat:

 sys/ddb/db_kernel.c |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r a04ed0ed65d1 -r d7c833dc3e9c sys/ddb/db_kernel.c
--- a/sys/ddb/db_kernel.c       Sun May 31 09:40:09 2020 +0000
+++ b/sys/ddb/db_kernel.c       Sun May 31 09:42:46 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_kernel.c,v 1.2 2009/03/08 11:40:00 mrg Exp $        */
+/*     $NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $        */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,32 +30,37 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.2 2009/03/08 11:40:00 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_kernel.c,v 1.3 2020/05/31 09:42:46 rin Exp $");
 
 #include <sys/param.h>
-#include <sys/cpu.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <ddb/ddb.h>
 
+/*
+ * XXX
+ * DDB can be running in the interrupt context, e.g., when activated from
+ * console. Therefore, we use kmem_intr_alloc(9) and friends here to avoid
+ * assertion failure.
+ */
+
 void *
 db_alloc(size_t sz)
 {
 
-       return malloc(sz, M_TEMP, M_WAITOK);
+       return kmem_intr_alloc(sz, KM_NOSLEEP);
 }
 
 void *
 db_zalloc(size_t sz)
 {
 
-       return malloc(sz, M_TEMP, M_WAITOK | M_ZERO);
+       return kmem_intr_zalloc(sz, KM_NOSLEEP);
 }
 
 void
 db_free(void *p, size_t sz)
 {
 
-       free(p, M_TEMP);
+       kmem_intr_free(p, sz);
 }



Home | Main Index | Thread Index | Old Index