mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
And an InstructionMap helper structure to map x86 mnemonic codes to instruction handlers. Any instruction emulation implementation should then boil down with implementing InstructionHandler for any supported mnemonic. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
66 lines
1.8 KiB
Rust
66 lines
1.8 KiB
Rust
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
//
|
|
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE-BSD-3-Clause file.
|
|
//
|
|
// Copyright © 2019 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
|
|
//
|
|
// Copyright © 2020, Microsoft Corporation
|
|
//
|
|
|
|
pub mod gdt;
|
|
|
|
#[allow(non_upper_case_globals)]
|
|
#[allow(non_camel_case_types)]
|
|
#[allow(non_snake_case)]
|
|
#[allow(non_upper_case_globals)]
|
|
#[allow(unused)]
|
|
#[allow(
|
|
clippy::unreadable_literal,
|
|
clippy::redundant_static_lifetimes,
|
|
clippy::trivially_copy_pass_by_ref,
|
|
clippy::useless_transmute,
|
|
clippy::should_implement_trait,
|
|
clippy::transmute_ptr_to_ptr,
|
|
clippy::unreadable_literal,
|
|
clippy::redundant_static_lifetimes
|
|
)]
|
|
pub mod msr_index;
|
|
|
|
pub mod emulator;
|
|
|
|
// MTRR constants
|
|
pub const MTRR_ENABLE: u64 = 0x800; // IA32_MTRR_DEF_TYPE MSR: E (MTRRs enabled) flag, bit 11
|
|
pub const MTRR_MEM_TYPE_WB: u64 = 0x6;
|
|
|
|
// IOAPIC pins
|
|
pub const NUM_IOAPIC_PINS: usize = 24;
|
|
|
|
// X86 Exceptions
|
|
#[allow(dead_code)]
|
|
#[derive(Clone, Debug)]
|
|
pub enum Exception {
|
|
DE = 1, // Divide Error
|
|
DB = 2, // Debug Exception
|
|
BP = 3, // Breakpoint
|
|
OF = 4, // Overflow
|
|
BR = 5, // BOUND Range Exceeded
|
|
UD = 6, // Invalid/Undefined Opcode
|
|
NM = 7, // No Math Coprocessor
|
|
DF = 8, // Double Fault
|
|
TS = 10, // Invalid TSS
|
|
NP = 11, // Segment Not Present
|
|
SS = 12, // Stack Segment Fault
|
|
GP = 13, // General Protection
|
|
PF = 14, // Page Fault
|
|
MF = 16, // Math Fault
|
|
AC = 17, // Alignment Check
|
|
MC = 18, // Machine Check
|
|
XM = 19, // SIMD Floating-Point Exception
|
|
VE = 20, // Virtualization Exception
|
|
CP = 21, // Control Protection Exception
|
|
}
|