1 | /** @file
|
---|
2 | * VM - The Virtual Machine, CPU Host Call Interface (AMD64 & x86 only).
|
---|
3 | *
|
---|
4 | * @note cpuidcall.mac is generated from this file by running 'kmk incs' in the root.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2022 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * The contents of this file may alternatively be used under the terms
|
---|
27 | * of the Common Development and Distribution License Version 1.0
|
---|
28 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
29 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
30 | * CDDL are applicable instead of those of the GPL.
|
---|
31 | *
|
---|
32 | * You may elect to license modified versions of this file under the
|
---|
33 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
34 | *
|
---|
35 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef VBOX_INCLUDED_vmm_cpuidcall_h
|
---|
39 | #define VBOX_INCLUDED_vmm_cpuidcall_h
|
---|
40 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
41 | # pragma once
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #include <VBox/types.h>
|
---|
45 |
|
---|
46 |
|
---|
47 | /** @defgroup grp_cpuidcall VBox CPUID Host Call Interface (AMD64 & x86)
|
---|
48 | *
|
---|
49 | * This describes an interface using CPUID for calling the host from within the
|
---|
50 | * VM. This is chiefly intended for nested VM debugging at present and is
|
---|
51 | * therefore disabled by default.
|
---|
52 | *
|
---|
53 | * @{ */
|
---|
54 |
|
---|
55 | /** Fixed EAX value for all requests (big-endian 'VBox'). */
|
---|
56 | #define VBOX_CPUID_REQ_EAX_FIXED UINT32_C(0x56426f78)
|
---|
57 | /** Fixed portion of ECX for all requests. */
|
---|
58 | #define VBOX_CPUID_REQ_ECX_FIXED UINT32_C(0xc0de0000)
|
---|
59 | /** Fixed portion of ECX for all requests. */
|
---|
60 | #define VBOX_CPUID_REQ_ECX_FIXED_MASK UINT32_C(0xffff0000)
|
---|
61 | /** Function part of ECX for requests. */
|
---|
62 | #define VBOX_CPUID_REQ_ECX_FN_MASK UINT32_C(0x0000ffff)
|
---|
63 |
|
---|
64 | /** Generic ECX return value. */
|
---|
65 | #define VBOX_CPUID_RESP_GEN_ECX UINT32_C(0x19410612)
|
---|
66 | /** Generic EDX return value. */
|
---|
67 | #define VBOX_CPUID_RESP_GEN_EDX UINT32_C(0x19400412)
|
---|
68 | /** Generic EBX return value. */
|
---|
69 | #define VBOX_CPUID_RESP_GEN_EBX UINT32_C(0x19450508)
|
---|
70 |
|
---|
71 | /** @name Function \#1: Interface ID check and max function.
|
---|
72 | *
|
---|
73 | * Input: EDX & EBX content is unused and ignored. Best set to zero.
|
---|
74 | *
|
---|
75 | * Result: EAX:EDX:EBX forms the little endian string "VBox RuleZ!\0".
|
---|
76 | * ECX contains the max function number acccepted.
|
---|
77 | * @{ */
|
---|
78 | #define VBOX_CPUID_FN_ID UINT32_C(0x0001)
|
---|
79 | #define VBOX_CPUID_RESP_ID_EAX UINT32_C(0x786f4256)
|
---|
80 | #define VBOX_CPUID_RESP_ID_EDX UINT32_C(0x6c755220)
|
---|
81 | #define VBOX_CPUID_RESP_ID_EBX UINT32_C(0x00215A65)
|
---|
82 | #define VBOX_CPUID_RESP_ID_ECX UINT32_C(0x00000002)
|
---|
83 | /** @} */
|
---|
84 |
|
---|
85 | /** Function \#2: Write string to host Log.
|
---|
86 | *
|
---|
87 | * Input: EDX gives the number of bytes to log (max 2MB).
|
---|
88 | * EBX indicates the log to write to: 0 for debug, 1 for release.
|
---|
89 | * RSI is the FLAT pointer to the UTF-8 string to log.
|
---|
90 | *
|
---|
91 | * Output: EAX contains IPRT status code. ECX, EDX and EBX are set to the
|
---|
92 | * generic their response values (VBOX_CPUID_RESP_GEN_XXX). RSI is
|
---|
93 | * advanced EDX bytes on success.
|
---|
94 | *
|
---|
95 | * Except: May raise \#PF when reading the string. RSI and EDX is then be
|
---|
96 | * updated to the point where the page fault triggered, allowing paging
|
---|
97 | * in of logging buffer and such like.
|
---|
98 | *
|
---|
99 | * @note Buffer is not accessed if the target logger isn't enabled.
|
---|
100 | */
|
---|
101 | #define VBOX_CPUID_FN_LOG UINT32_C(0x0002)
|
---|
102 |
|
---|
103 |
|
---|
104 | /** @} */
|
---|
105 |
|
---|
106 | #endif /* !VBOX_INCLUDED_vmm_cpuidcall_h */
|
---|
107 |
|
---|