catch up with x86/x86/cpu.c: move from malloc to kmem

This commit is contained in:
cegger 2008-12-23 20:06:16 +00:00
parent c1e7a459ca
commit 269bf411e8
1 changed files with 7 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.30 2008/11/06 19:35:11 cegger Exp $ */
/* $NetBSD: cpu.c,v 1.31 2008/12/23 20:06:16 cegger Exp $ */
/* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */
/*-
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.30 2008/11/06 19:35:11 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.31 2008/12/23 20:06:16 cegger Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -82,7 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.30 2008/11/06 19:35:11 cegger Exp $");
#include <sys/user.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/malloc.h>
#include <sys/kmem.h>
#include <sys/cpu.h>
#include <sys/atomic.h>
@ -233,7 +233,7 @@ cpu_attach(device_t parent, device_t self, void *aux)
* structure, otherwise use the primary's.
*/
if (caa->cpu_role == CPU_ROLE_AP) {
ci = malloc(sizeof(*ci), M_DEVBUF, M_WAITOK | M_ZERO);
ci = kmem_zalloc(sizeof(*ci), KM_SLEEP);
ci->ci_curldt = -1;
if (phycpu_info[cpunum] != NULL)
panic("cpu at apic id %d already attached?", cpunum);
@ -358,8 +358,8 @@ cpu_attach_common(device_t parent, device_t self, void *aux)
}
aprint_naive(": Application Processor\n");
ptr = (uintptr_t)malloc(sizeof(*ci) + CACHE_LINE_SIZE - 1,
M_DEVBUF, M_WAITOK);
ptr = (uintptr_t)kmem_alloc(sizeof(*ci) + CACHE_LINE_SIZE - 1,
KM_SLEEP);
ci = (struct cpu_info *)((ptr + CACHE_LINE_SIZE - 1) &
~(CACHE_LINE_SIZE - 1));
memset(ci, 0, sizeof(*ci));
@ -369,8 +369,7 @@ cpu_attach_common(device_t parent, device_t self, void *aux)
cpu_info[cpunum] = ci;
#endif
#ifdef TRAPLOG
ci->ci_tlog_base = malloc(sizeof(struct tlog),
M_DEVBUF, M_WAITOK);
ci->ci_tlog_base = kmem_zalloc(sizeof(struct tlog), KM_SLEEP);
#endif
} else {
aprint_naive(": %s Processor\n",