x86.h revision 245678
1226586Sdim/*-
2226586Sdim * Copyright (c) 2011 NetApp, Inc.
3226586Sdim * All rights reserved.
4226586Sdim *
5226586Sdim * Redistribution and use in source and binary forms, with or without
6226586Sdim * modification, are permitted provided that the following conditions
7226586Sdim * are met:
8226586Sdim * 1. Redistributions of source code must retain the above copyright
9226586Sdim *    notice, this list of conditions and the following disclaimer.
10226586Sdim * 2. Redistributions in binary form must reproduce the above copyright
11226586Sdim *    notice, this list of conditions and the following disclaimer in the
12226586Sdim *    documentation and/or other materials provided with the distribution.
13226586Sdim *
14226586Sdim * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15226586Sdim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16226586Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17249423Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18249423Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19226586Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20226586Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21226586Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22226586Sdim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23226586Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24226586Sdim * SUCH DAMAGE.
25226586Sdim *
26226586Sdim * $FreeBSD: head/sys/amd64/vmm/x86.h 245678 2013-01-20 03:42:49Z neel $
27226586Sdim */
28226586Sdim
29226586Sdim#ifndef _X86_H_
30226586Sdim#define	_X86_H_
31226586Sdim
32226586Sdim#define CPUID_0000_0000 (0x0)
33226586Sdim#define CPUID_0000_0001	(0x1)
34226586Sdim#define CPUID_0000_0002 (0x2)
35226586Sdim#define CPUID_0000_0003 (0x3)
36226586Sdim#define CPUID_0000_0004 (0x4)
37226586Sdim#define CPUID_0000_0006 (0x6)
38226586Sdim#define CPUID_0000_0007 (0x7)
39226586Sdim#define	CPUID_0000_000A	(0xA)
40226586Sdim#define	CPUID_0000_000B	(0xB)
41226586Sdim#define CPUID_8000_0000	(0x80000000)
42226586Sdim#define CPUID_8000_0001	(0x80000001)
43226586Sdim#define CPUID_8000_0002	(0x80000002)
44226586Sdim#define CPUID_8000_0003	(0x80000003)
45226586Sdim#define CPUID_8000_0004	(0x80000004)
46226586Sdim#define CPUID_8000_0006	(0x80000006)
47263508Sdim#define CPUID_8000_0007	(0x80000007)
48263508Sdim#define CPUID_8000_0008	(0x80000008)
49226586Sdim
50226586Sdim/*
51226586Sdim * CPUID instruction Fn0000_0001:
52226586Sdim */
53226586Sdim#define CPUID_0000_0001_APICID_MASK			(0xff<<24)
54226586Sdim#define CPUID_0000_0001_APICID_SHIFT			24
55226586Sdim
56/*
57 * CPUID instruction Fn0000_0001 ECX
58 */
59#define CPUID_0000_0001_FEAT0_VMX	(1<<5)
60
61int x86_emulate_cpuid(struct vm *vm, int vcpu_id, uint32_t *eax, uint32_t *ebx,
62		      uint32_t *ecx, uint32_t *edx);
63
64#endif
65