fix breakage where db_regs_t != trapframe.
the problem pointed out by Martin Husemann on tech-kern@.
This commit is contained in:
parent
edbcd7c8fd
commit
0bbefb72ab
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tprof_pmi.c,v 1.5 2009/03/10 14:45:02 yamt Exp $ */
|
||||
/* $NetBSD: tprof_pmi.c,v 1.6 2009/03/11 13:48:47 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2008,2009 YAMAMOTO Takashi,
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tprof_pmi.c,v 1.5 2009/03/10 14:45:02 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tprof_pmi.c,v 1.6 2009/03/11 13:48:47 yamt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -42,9 +42,9 @@ __KERNEL_RCSID(0, "$NetBSD: tprof_pmi.c,v 1.5 2009/03/10 14:45:02 yamt Exp $");
|
|||
#include <x86/tprof.h>
|
||||
#include <x86/nmi.h>
|
||||
|
||||
#include <machine/db_machdep.h> /* PC_REGS */
|
||||
#include <machine/cpuvar.h> /* cpu_vendor */
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/cputypes.h> /* CPUVENDER_* */
|
||||
#include <machine/cpuvar.h> /* cpu_vendor */
|
||||
#include <machine/i82489reg.h>
|
||||
#include <machine/i82489var.h>
|
||||
|
||||
|
@ -163,6 +163,7 @@ tprof_pmi_nmi(const struct trapframe *tf, void *dummy)
|
|||
const struct msrs *msr;
|
||||
uint32_t pcint;
|
||||
uint64_t cccr;
|
||||
tprof_frame_info_t tfi;
|
||||
|
||||
KASSERT(dummy == NULL);
|
||||
|
||||
|
@ -180,7 +181,12 @@ tprof_pmi_nmi(const struct trapframe *tf, void *dummy)
|
|||
}
|
||||
|
||||
/* record a sample */
|
||||
tprof_sample(tprof_cookie, tf);
|
||||
#if defined(amd64)
|
||||
tfi.tfi_pc = tf->tf_rip;
|
||||
#else /* defined(amd64) */
|
||||
tfi.tfi_pc = tf->tf_eip;
|
||||
#endif /* defined(amd64) */
|
||||
tprof_sample(tprof_cookie, &tfi);
|
||||
|
||||
/* reset counter */
|
||||
wrmsr(msr->msr_counter, counter_reset_val);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tprof.c,v 1.4 2009/03/10 14:45:02 yamt Exp $ */
|
||||
/* $NetBSD: tprof.c,v 1.5 2009/03/11 13:48:47 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2008,2009 YAMAMOTO Takashi,
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.4 2009/03/10 14:45:02 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.5 2009/03/11 13:48:47 yamt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -44,8 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.4 2009/03/10 14:45:02 yamt Exp $");
|
|||
#include <dev/tprof/tprof.h>
|
||||
#include <dev/tprof/tprof_ioctl.h>
|
||||
|
||||
#include <machine/db_machdep.h> /* PC_REGS */
|
||||
|
||||
/*
|
||||
* locking order:
|
||||
* tprof_reader_lock -> tprof_lock
|
||||
|
@ -405,11 +403,11 @@ tprof_backend_lookup(const char *name)
|
|||
*/
|
||||
|
||||
void
|
||||
tprof_sample(tprof_backend_cookie_t *cookie, const struct trapframe *tf)
|
||||
tprof_sample(tprof_backend_cookie_t *cookie, const tprof_frame_info_t *tfi)
|
||||
{
|
||||
tprof_cpu_t * const c = tprof_curcpu();
|
||||
tprof_buf_t * const buf = c->c_buf;
|
||||
const uintptr_t pc = PC_REGS(tf);
|
||||
const uintptr_t pc = tfi->tfi_pc;
|
||||
u_int idx;
|
||||
|
||||
idx = buf->b_used;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tprof.h,v 1.2 2009/03/10 14:45:02 yamt Exp $ */
|
||||
/* $NetBSD: tprof.h,v 1.3 2009/03/11 13:48:47 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2008,2009 YAMAMOTO Takashi,
|
||||
|
@ -37,11 +37,14 @@ typedef struct tprof_backend_ops {
|
|||
void (*tbo_stop)(tprof_backend_cookie_t *);
|
||||
} tprof_backend_ops_t;
|
||||
|
||||
#define TPROF_BACKEND_VERSION 1
|
||||
#define TPROF_BACKEND_VERSION 2
|
||||
int tprof_backend_register(const char *, const tprof_backend_ops_t *, int);
|
||||
int tprof_backend_unregister(const char *);
|
||||
|
||||
struct trapframe;
|
||||
void tprof_sample(tprof_backend_cookie_t *, const struct trapframe *);
|
||||
typedef struct {
|
||||
uintptr_t tfi_pc;
|
||||
} tprof_frame_info_t;
|
||||
|
||||
void tprof_sample(tprof_backend_cookie_t *, const tprof_frame_info_t *);
|
||||
|
||||
#endif /* _DEV_TPROF_TPROF_H_ */
|
||||
|
|
Loading…
Reference in New Issue