malloc(9) -> kmem(9)
This commit is contained in:
parent
b5bf84e118
commit
74ee875269
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $ */
|
||||
/* $NetBSD: qv.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2015 Charles H. Dickman. All rights reserved.
|
||||
* Derived from smg.c
|
||||
|
@ -31,7 +31,7 @@
|
|||
/*3456789012345678901234567890123456789012345678901234567890123456789012345678*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $");
|
|||
#include <sys/cpu.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/extent.h> /***/
|
||||
#include <sys/time.h>
|
||||
#include <sys/bus.h>
|
||||
|
@ -900,7 +900,7 @@ qv_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
|||
struct qv_softc *sc = device_private(v);
|
||||
struct qv_screen *ss;
|
||||
|
||||
ss = malloc(sizeof(struct qv_screen), M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
ss = kmem_zalloc(sizeof(struct qv_screen), KM_SLEEP);
|
||||
ss->ss_sc = sc;
|
||||
ss->ss_type = type;
|
||||
*cookiep = ss;
|
||||
|
@ -916,7 +916,7 @@ void
|
|||
qv_free_screen(void *v, void *cookie)
|
||||
{
|
||||
printf("qv_free_screen: %p\n", cookie);
|
||||
free(cookie, M_DEVBUF);
|
||||
kmem_free(cookie, sizeof(struct qv_screen));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: qvkbd.c,v 1.2 2019/11/10 21:16:33 chs Exp $ */
|
||||
/* $NetBSD: qvkbd.c,v 1.3 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
|
||||
/* Copyright (c) 2015 Charles H. Dickman. All rights reserved.
|
||||
* Derived from dzkbd.c
|
||||
|
@ -54,7 +54,7 @@ __KERNEL_RCSID(0, "$$");
|
|||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/intr.h>
|
||||
|
||||
#include <dev/wscons/wsconsio.h>
|
||||
|
@ -171,8 +171,7 @@ qvkbd_attach(device_t parent, device_t self, void *aux)
|
|||
if (isconsole) {
|
||||
qvi = &qvkbd_console_internal;
|
||||
} else {
|
||||
qvi = malloc(sizeof(struct qvkbd_internal),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
qvi = kmem_alloc(sizeof(struct qvkbd_internal), KM_SLEEP);
|
||||
qvi->qvi_ks.attmt.sendchar = qvkbd_sendchar;
|
||||
qvi->qvi_ks.attmt.cookie = ls;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $");
|
|||
#include <sys/reboot.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -66,6 +66,15 @@ int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
|
|||
int _bus_dma_inrange(bus_dma_segment_t *, int, bus_addr_t);
|
||||
int _bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t,
|
||||
bus_size_t, bus_dma_segment_t*, int, int *, int, vaddr_t, vaddr_t);
|
||||
|
||||
static size_t
|
||||
_bus_dmamap_mapsize(int const nsegments)
|
||||
{
|
||||
KASSERT(nsegments > 0);
|
||||
return sizeof(struct vax_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map creation. May be called by bus-specific
|
||||
* DMA map creation functions.
|
||||
|
@ -77,7 +86,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
{
|
||||
struct vax_bus_dmamap *map;
|
||||
void *mapstore;
|
||||
size_t mapsize;
|
||||
|
||||
#ifdef DEBUG_DMA
|
||||
printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx flags=%x\n",
|
||||
|
@ -96,13 +104,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
* The bus_dmamap_t includes one bus_dma_segment_t, hence
|
||||
* the (nsegments - 1).
|
||||
*/
|
||||
mapsize = sizeof(struct vax_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
if ((mapstore = malloc(mapsize, M_DMAMAP,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
|
||||
if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
|
||||
(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
memset(mapstore, 0, mapsize);
|
||||
map = (struct vax_bus_dmamap *)mapstore;
|
||||
map->_dm_size = size;
|
||||
map->_dm_segcnt = nsegments;
|
||||
|
@ -135,7 +140,7 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
|||
if (map->dm_nsegs > 0)
|
||||
printf("bus_dmamap_destroy() called for map with valid mappings\n");
|
||||
#endif /* DIAGNOSTIC */
|
||||
free(map, M_DEVBUF);
|
||||
kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: multicpu.c,v 1.35 2019/11/10 21:16:33 chs Exp $ */
|
||||
/* $NetBSD: multicpu.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
|
@ -29,14 +29,14 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.35 2019/11/10 21:16:33 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
|
||||
|
||||
#include "opt_multiprocessor.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpu.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/xcall.h>
|
||||
#include <sys/ipi.h>
|
||||
|
@ -68,7 +68,7 @@ cpu_boot_secondary_processors(void)
|
|||
while ((q = SIMPLEQ_FIRST(&cpuq))) {
|
||||
SIMPLEQ_REMOVE_HEAD(&cpuq, cq_q);
|
||||
(*mp_dep_call->cpu_startslave)(q->cq_ci);
|
||||
free(q, M_TEMP);
|
||||
kmem_free(q, sizeof(*q));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ cpu_slavesetup(device_t self, int slotid)
|
|||
|
||||
KASSERT(device_private(self) == NULL);
|
||||
|
||||
ci = malloc(sizeof(*ci), M_DEVBUF, M_ZERO|M_WAITOK);
|
||||
ci = kmem_zalloc(sizeof(*ci), KM_SLEEP);
|
||||
self->dv_private = ci;
|
||||
ci->ci_dev = self;
|
||||
ci->ci_slotid = slotid;
|
||||
|
@ -104,7 +104,7 @@ cpu_slavesetup(device_t self, int slotid)
|
|||
ci->ci_istack = istackbase + PAGE_SIZE;
|
||||
SIMPLEQ_INSERT_TAIL(&cpus, ci, ci_next);
|
||||
|
||||
cq = malloc(sizeof(*cq), M_TEMP, M_WAITOK|M_ZERO);
|
||||
cq = kmem_zalloc(sizeof(*cq), KM_SLEEP);
|
||||
cq->cq_ci = ci;
|
||||
cq->cq_dev = ci->ci_dev;
|
||||
SIMPLEQ_INSERT_TAIL(&cpuq, cq, cq_q);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lcg.c,v 1.4 2018/06/06 01:49:08 maya Exp $ */
|
||||
/* $NetBSD: lcg.c,v 1.5 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
/*
|
||||
* LCG accelerated framebuffer driver
|
||||
* Copyright (c) 2003, 2004 Blaz Antonic
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.4 2018/06/06 01:49:08 maya Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.5 2020/11/21 22:37:11 thorpej Exp $");
|
||||
|
||||
#define LCG_NO_ACCEL
|
||||
|
||||
|
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.4 2018/06/06 01:49:08 maya Exp $");
|
|||
#include <sys/systm.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -789,7 +789,7 @@ lcg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
|||
int i;
|
||||
struct lcg_screen *ss;
|
||||
|
||||
*cookiep = malloc(sizeof(struct lcg_screen), M_DEVBUF, M_WAITOK);
|
||||
*cookiep = kmem_alloc(sizeof(struct lcg_screen), KM_SLEEP);
|
||||
bzero(*cookiep, sizeof(struct lcg_screen));
|
||||
*curxp = *curyp = 0;
|
||||
*defattrp = (LCG_BG_COLOR << 4) | LCG_FG_COLOR;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $ */
|
||||
/* $NetBSD: smg.c,v 1.59 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.59 2020/11/21 22:37:11 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -34,7 +34,7 @@ __KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $");
|
|||
#include <sys/cpu.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <machine/vsbus.h>
|
||||
|
@ -532,7 +532,7 @@ int
|
|||
smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
||||
int *curxp, int *curyp, long *defattrp)
|
||||
{
|
||||
*cookiep = malloc(sizeof(struct smg_screen), M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
*cookiep = kmem_zalloc(sizeof(struct smg_screen), KM_SLEEP);
|
||||
*curxp = *curyp = *defattrp = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: spx.c,v 1.9 2016/07/07 06:55:39 msaitoh Exp $ */
|
||||
/* $NetBSD: spx.c,v 1.10 2020/11/21 22:37:11 thorpej Exp $ */
|
||||
/*
|
||||
* SPX/LCSPX/SPXg/SPXgt accelerated framebuffer driver for NetBSD/VAX
|
||||
* Copyright (c) 2005 Blaz Antonic
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: spx.c,v 1.9 2016/07/07 06:55:39 msaitoh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: spx.c,v 1.10 2020/11/21 22:37:11 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: spx.c,v 1.9 2016/07/07 06:55:39 msaitoh Exp $");
|
|||
#include <sys/conf.h>
|
||||
#include <sys/cpu.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <machine/vsbus.h>
|
||||
|
@ -1055,7 +1055,7 @@ spx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
|||
int i;
|
||||
struct spx_screen *ss;
|
||||
|
||||
ss = malloc(sizeof(struct spx_screen), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
ss = kmem_zalloc(sizeof(struct spx_screen), KM_SLEEP);
|
||||
|
||||
*cookiep = ss;
|
||||
*curxp = *curyp = 0;
|
||||
|
@ -1070,7 +1070,7 @@ spx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
|
|||
static void
|
||||
spx_free_screen(void *v, void *cookie)
|
||||
{
|
||||
/* FIXME add something to actually free malloc()ed screen? */
|
||||
/* FIXME add something to actually free kmem_zalloc()ed screen? */
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue