use CR8 instead of LAPIC Task Priority register on x86-64.

This commit is contained in:
nonaka 2017-04-22 04:29:31 +00:00
parent 080345b8c0
commit d7fe81cc96
4 changed files with 24 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.101 2016/10/16 10:24:59 maxv Exp $ */
/* $NetBSD: autoconf.c,v 1.102 2017/04/22 04:29:31 nonaka Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.101 2016/10/16 10:24:59 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.102 2017/04/22 04:29:31 nonaka Exp $");
#include "opt_compat_oldboot.h"
#include "opt_intrdebug.h"
@ -131,6 +131,6 @@ cpu_configure(void)
spl0();
#if NLAPIC > 0
i82489_writereg(LAPIC_TPRI, 0);
lapic_write_tpri(0);
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82489var.h,v 1.17 2017/04/19 06:43:05 nonaka Exp $ */
/* $NetBSD: i82489var.h,v 1.18 2017/04/22 04:29:31 nonaka Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -104,4 +104,6 @@ extern void lapic_enable(void);
extern void lapic_calibrate_timer(struct cpu_info *ci);
extern void lapic_initclocks(void);
extern void lapic_write_tpri(uint32_t);
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.123 2017/02/11 14:11:24 maxv Exp $ */
/* $NetBSD: cpu.c,v 1.124 2017/04/22 04:29:31 nonaka Exp $ */
/*-
* Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.123 2017/02/11 14:11:24 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.124 2017/04/22 04:29:31 nonaka Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@ -879,11 +879,7 @@ cpu_hatch(void *v)
cpu_get_tsc_freq(ci);
s = splhigh();
#ifdef i386
i82489_writereg(LAPIC_TPRI, 0);
#else
lcr8(0);
#endif
lapic_write_tpri(0);
x86_enable_intr();
splx(s);
x86_errata();

View File

@ -1,4 +1,4 @@
/* $NetBSD: lapic.c,v 1.55 2017/04/22 04:24:26 nonaka Exp $ */
/* $NetBSD: lapic.c,v 1.56 2017/04/22 04:29:31 nonaka Exp $ */
/*-
* Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.55 2017/04/22 04:24:26 nonaka Exp $");
__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.56 2017/04/22 04:29:31 nonaka Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@ -89,6 +89,18 @@ struct pic local_pic = {
.pic_delroute = lapic_setup,
};
void
lapic_write_tpri(uint32_t val)
{
val &= LAPIC_TPRI_MASK;
#ifdef i386
i82489_writereg(LAPIC_TPRI, val);
#else
lcr8(val >> 4);
#endif
}
static void
lapic_map(paddr_t lapic_base)
{
@ -130,7 +142,7 @@ lapic_map(paddr_t lapic_base)
cpu_init_first(); /* catch up to changed cpu_number() */
#endif
i82489_writereg(LAPIC_TPRI, 0);
lapic_write_tpri(0);
x86_enable_intr();
}