- Add inlines for the monitor and mwait instructions.

Sponsored by:	Nokia
This commit is contained in:
Jeff Roberson 2008-04-18 05:47:56 +00:00
parent 6bdf667b51
commit 66247efa5a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178299
2 changed files with 26 additions and 0 deletions

View file

@ -514,6 +514,19 @@ load_es(u_int sel)
__asm __volatile("movl %0,%%es" : : "rm" (sel));
}
static inline void
cpu_monitor(const void *addr, int extensions, int hints)
{
__asm __volatile("monitor;"
: :"a" (addr), "c" (extensions), "d"(hints));
}
static inline void
cpu_mwait(int extensions, int hints)
{
__asm __volatile("mwait;" : :"a" (hints), "c" (extensions));
}
#ifdef _KERNEL
/* This is defined in <machine/specialreg.h> but is too painful to get to */
#ifndef MSR_FSBASE

View file

@ -106,6 +106,19 @@ enable_intr(void)
__asm __volatile("sti");
}
static inline void
cpu_monitor(const void *addr, int extensions, int hints)
{
__asm __volatile("monitor;"
: :"a" (addr), "c" (extensions), "d"(hints));
}
static inline void
cpu_mwait(int extensions, int hints)
{
__asm __volatile("mwait;" : :"a" (hints), "c" (extensions));
}
#ifdef _KERNEL
#define HAVE_INLINE_FFS