remove the MD API.
ok guenther@, deraadt@, mpi@
-/* $OpenBSD: amd64_mem.c,v 1.13 2016/04/26 15:27:32 mlarkin Exp $ */
+/* $OpenBSD: amd64_mem.c,v 1.14 2018/07/27 21:11:31 kettenis Exp $ */
/*
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* All rights reserved.
void
mrstore(struct mem_range_softc *sc)
{
- disable_intr(); /* disable interrupts */
+ u_long s;
+
+ s = intr_disable();
#ifdef MULTIPROCESSOR
x86_broadcast_ipi(X86_IPI_MTRR);
#endif
mrstoreone(sc);
- enable_intr();
+ intr_restore(s);
}
/*
void
mrreload_cpu(struct mem_range_softc *sc)
{
- disable_intr();
+ u_long s;
+
+ s = intr_disable();
mrstoreone(sc); /* set MTRRs to match BSP */
- enable_intr();
+ intr_restore(s);
}
-/* $OpenBSD: cpu.c,v 1.125 2018/07/12 14:11:11 guenther Exp $ */
+/* $OpenBSD: cpu.c,v 1.126 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
s = splhigh();
lcr8(0);
- enable_intr();
+ intr_enable();
nanouptime(&ci->ci_schedstate.spc_runtime);
splx(s);
-/* $OpenBSD: hibernate_machdep.c,v 1.44 2018/07/04 01:41:56 mlarkin Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.45 2018/07/27 21:11:31 kettenis Exp $ */
/*
* Copyright (c) 2012 Mike Larkin <mlarkin@openbsd.org>
void
hibernate_enable_intr_machdep(void)
{
- enable_intr();
+ intr_enable();
}
void
hibernate_disable_intr_machdep(void)
{
- disable_intr();
+ intr_disable();
}
#ifdef MULTIPROCESSOR
-/* $OpenBSD: i8259.c,v 1.10 2017/10/14 04:44:43 jsg Exp $ */
+/* $OpenBSD: i8259.c,v 1.11 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: i8259.c,v 1.2 2003/03/02 18:27:15 fvdl Exp $ */
/*
{
unsigned port;
u_int8_t byte;
+ u_long s;
- disable_intr(); /* XXX */
+ s = intr_disable();
i8259_imen &= ~(1 << pin);
#ifdef PIC_MASKDELAY
delay(10);
byte = i8259_imen & 0xff;
}
outb(port, byte);
- enable_intr();
+ intr_restore(s);
}
static void
-/* $OpenBSD: ipifuncs.c,v 1.31 2018/06/05 06:39:10 guenther Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.32 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
SCHED_ASSERT_UNLOCKED();
KASSERT(!_kernel_lock_held());
- disable_intr();
+ intr_disable();
lapic_disable();
wbinvd();
ci->ci_flags &= ~CPUF_RUNNING;
-/* $OpenBSD: lapic.c,v 1.51 2018/04/20 07:27:54 mlarkin Exp $ */
+/* $OpenBSD: lapic.c,v 1.52 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: lapic.c,v 1.2 2003/05/08 01:04:35 fvdl Exp $ */
/*-
void
lapic_map(paddr_t lapic_base)
{
- int s;
pt_entry_t *pte;
vaddr_t va;
u_int64_t msr;
+ u_long s;
+ int tpr;
- disable_intr();
- s = lapic_tpr;
+ s = intr_disable();
+ tpr = lapic_tpr;
msr = rdmsr(MSR_APICBASE);
x2apic_enabled = 1;
codepatch_call(CPTAG_EOI, &x2apic_eoi);
- lapic_writereg(LAPIC_TPRI, s);
+ lapic_writereg(LAPIC_TPRI, tpr);
va = (vaddr_t)&local_apic;
} else {
/*
*pte = lapic_base | PG_RW | PG_V | PG_N | PG_G | pg_nx;
invlpg(va);
- lapic_tpr = s;
+ lapic_tpr = tpr;
}
/*
DPRINTF("%s: entered lapic page va 0x%llx pa 0x%llx\n", __func__,
(uint64_t)va, (uint64_t)lapic_base);
- enable_intr();
+ intr_restore(s);
}
/*
{
unsigned int startapic, endapic;
u_int64_t dtick, dapic, tmp;
- long rf = read_rflags();
+ u_long s;
int i;
if (mp_verbose)
lapic_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
lapic_writereg(LAPIC_ICR_TIMER, 0x80000000);
- disable_intr();
+ s = intr_disable();
/* wait for current cycle to finish */
wait_next_cycle();
wait_next_cycle();
endapic = lapic_gettick();
- write_rflags(rf);
+
+ intr_restore(s);
dtick = hz * rtclock_tval;
dapic = startapic-endapic;
-/* $OpenBSD: machdep.c,v 1.248 2018/07/12 14:11:11 guenther Exp $ */
+/* $OpenBSD: machdep.c,v 1.249 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
softintr_init();
splraise(IPL_IPI);
- enable_intr();
+ intr_enable();
#ifdef DDB
db_machine_init();
void
cpu_reset(void)
{
-
- disable_intr();
+ intr_disable();
if (cpuresetfn)
(*cpuresetfn)();
-/* $OpenBSD: tsc.c,v 1.9 2018/04/08 18:26:29 mikeb Exp $ */
+/* $OpenBSD: tsc.c,v 1.10 2018/07/27 21:11:31 kettenis Exp $ */
/*
* Copyright (c) 2016,2017 Reyk Floeter <reyk@openbsd.org>
* Copyright (c) 2017 Adam Steen <adam@adamsteen.com.au>
measure_tsc_freq(struct timecounter *tc)
{
uint64_t count1, count2, frequency, min_freq, tsc1, tsc2;
- u_long ef;
+ u_long s;
int delay_usec, i, err1, err2, usec, success = 0;
/* warmup the timers */
delay_usec = 100000;
for (i = 0; i < 3; i++) {
- ef = read_rflags();
- disable_intr();
+ s = intr_disable();
err1 = get_tsc_and_timecount(tc, &tsc1, &count1);
delay(delay_usec);
err2 = get_tsc_and_timecount(tc, &tsc2, &count2);
- write_rflags(ef);
+ intr_restore(s);
if (err1 || err2)
continue;
-/* $OpenBSD: vmm.c,v 1.217 2018/07/26 10:05:02 job Exp $ */
+/* $OpenBSD: vmm.c,v 1.218 2018/07/27 21:11:31 kettenis Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
struct vmx_invvpid_descriptor vid;
uint64_t eii, procbased, int_st;
uint16_t irq;
+ u_long s;
resume = 0;
irq = vrp->vrp_irq;
#endif /* VMM_DEBUG */
/* Disable interrupts and save the current host FPU state. */
- disable_intr();
+ s = intr_disable();
if ((ret = vmm_fpurestore(vcpu))) {
- enable_intr();
+ intr_restore(s);
break;
}
*/
vmm_fpusave(vcpu);
- enable_intr();
+ intr_restore(s);
exit_reason = VM_EXIT_NONE;
if (ret == 0) {
-/* $OpenBSD: cpufunc.h,v 1.29 2018/07/24 14:49:44 guenther Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.30 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */
/*-
/* XXXX ought to be in psl.h with spl() functions */
-static __inline void
-disable_intr(void)
-{
- __asm volatile("cli");
-}
-
-static __inline void
-enable_intr(void)
-{
- __asm volatile("sti");
-}
-
static __inline u_long
read_rflags(void)
{
static __inline void
intr_enable(void)
{
- enable_intr();
+ __asm volatile("sti");
}
static __inline u_long
u_long ef;
ef = read_rflags();
- disable_intr();
+ __asm volatile("cli");
return (ef);
}
-/* $OpenBSD: clock.c,v 1.27 2018/07/09 19:38:33 kettenis Exp $ */
+/* $OpenBSD: clock.c,v 1.28 2018/07/27 21:11:31 kettenis Exp $ */
/* $NetBSD: clock.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */
/*-
int
gettick(void)
{
- u_long ef;
+ u_long s;
u_char lo, hi;
/* Don't want someone screwing with the counter while we're here. */
mtx_enter(&timer_mutex);
- ef = read_rflags();
- disable_intr();
+ s = intr_disable();
/* Select counter 0 and latch it. */
outb(IO_TIMER1+TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
lo = inb(IO_TIMER1+TIMER_CNTR0);
hi = inb(IO_TIMER1+TIMER_CNTR0);
- write_rflags(ef);
+ intr_restore(s);
mtx_leave(&timer_mutex);
return ((hi << 8) | lo);
}
{
u_char hi, lo;
u_int count;
- u_long ef;
+ u_long s;
- ef = read_rflags();
- disable_intr();
+ s = intr_disable();
outb(IO_TIMER1+TIMER_MODE, TIMER_SEL0 | TIMER_LATCH);
lo = inb(IO_TIMER1+TIMER_CNTR0);
}
i8254_lastcount = count;
count += i8254_offset;
- write_rflags(ef);
+
+ intr_restore(s);
return (count);
}
-/* $OpenBSD: drm_linux.h,v 1.89 2018/06/25 22:29:16 kettenis Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.90 2018/07/27 21:11:31 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
* Copyright (c) 2017 Martin Pieuchot
typedef void *async_cookie_t;
#define async_schedule(func, data) (func)((data), NULL)
-#define local_irq_disable() disable_intr()
-#define local_irq_enable() enable_intr()
+#define local_irq_disable() intr_disable()
+#define local_irq_enable() intr_enable()
#define setup_timer(x, y, z) timeout_set((x), (void (*)(void *))(y), (void *)(z))
#define mod_timer(x, y) timeout_add((x), (y - jiffies))