cpu_auxmsr: assert caller is preventing CPU migration.

Submitted by:	Adam Fenn (adam at fenn dot io)
Requested by:	kib
Reviewed by:	kib, grehan
Approved by:	kib
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D26166
This commit is contained in:
Peter Grehan 2020-08-24 11:49:49 +00:00
parent de5b46107c
commit a333a508a2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364656
2 changed files with 10 additions and 2 deletions

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/psl.h>
#include <machine/specialreg.h>
#include <vm/vm.h>
@ -218,11 +219,14 @@ init_via(void)
}
/*
* The value for the TSC_AUX MSR and rdtscp/rdpid.
* The value for the TSC_AUX MSR and rdtscp/rdpid on the invoking CPU.
*
* Caller should prevent CPU migration.
*/
u_int
cpu_auxmsr(void)
{
KASSERT((read_rflags() & PSL_I) == 0, ("context switch possible"));
return (PCPU_GET(cpuid));
}

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cputypes.h>
#include <machine/md_var.h>
#include <machine/psl.h>
#include <machine/specialreg.h>
#include <vm/vm.h>
@ -628,11 +629,14 @@ init_transmeta(void)
#endif
/*
* The value for the TSC_AUX MSR and rdtscp/rdpid.
* The value for the TSC_AUX MSR and rdtscp/rdpid on the invoking CPU.
*
* Caller should prevent CPU migration.
*/
u_int
cpu_auxmsr(void)
{
KASSERT((read_eflags() & PSL_I) == 0, ("context switch possible"));
return (PCPU_GET(cpuid));
}