Adjust the format of imports in Asterinas

This commit is contained in:
Chen Chengjun
2024-02-25 22:09:24 +08:00
committed by Tate, Hongliang Tian
parent 92e488e727
commit cfcef6965a
384 changed files with 2264 additions and 2059 deletions

View File

@ -3,17 +3,17 @@
//! Test runner enabling control over the tests.
//!
use alloc::{string::String, vec::Vec};
use core::format_args;
use owo_colors::OwoColorize;
use crate::{
path::{KtestPath, SuffixTrie},
tree::{KtestCrate, KtestTree},
CatchUnwindImpl, KtestError, KtestItem, KtestIter,
};
use alloc::{string::String, vec::Vec};
use core::format_args;
use owo_colors::OwoColorize;
pub enum KtestResult {
Ok,
Failed,

View File

@ -262,10 +262,10 @@ const EDDMAXNR: usize = 6;
#[cfg(test)]
mod tests {
use super::*;
use core::mem::offset_of;
use super::*;
#[test]
fn test_screen_info_offsets() {
assert_eq!(offset_of!(ScreenInfo, orig_x), 0x00);

View File

@ -22,9 +22,8 @@ use std::{
path::{Path, PathBuf},
};
use xmas_elf::program::SegmentData;
use mapping::{SetupFileOffset, SetupVA};
use xmas_elf::program::SegmentData;
/// The type of the bzImage that we are building through `make_bzimage`.
///

View File

@ -8,11 +8,11 @@
//! The reference to the Linux PE header definition:
//! https://github.com/torvalds/linux/blob/master/include/linux/pe.h
use std::{mem::size_of, ops::Range};
use bytemuck::{Pod, Zeroable};
use serde::Serialize;
use std::{mem::size_of, ops::Range};
use crate::mapping::{SetupFileOffset, SetupVA, LEGACY_SETUP_SEC_SIZE, SETUP32_LMA};
// The MS-DOS header.

View File

@ -1,15 +1,16 @@
// SPDX-License-Identifier: MPL-2.0
use linux_boot_params::BootParams;
use uefi::{
data_types::Handle,
proto::loaded_image::LoadedImage,
table::{boot::MemoryMap, Boot, Runtime, SystemTable},
};
use linux_boot_params::BootParams;
use super::paging::{Ia32eFlags, PageNumber, PageTableCreator};
use super::relocation::apply_rela_dyn_relocations;
use super::{
paging::{Ia32eFlags, PageNumber, PageTableCreator},
relocation::apply_rela_dyn_relocations,
};
#[export_name = "efi_stub_entry"]
extern "sysv64" fn efi_stub_entry(handle: Handle, mut system_table: SystemTable<Boot>) -> ! {

View File

@ -1,9 +1,9 @@
// SPDX-License-Identifier: MPL-2.0
use linux_boot_params::BootParams;
use core::arch::{asm, global_asm};
use linux_boot_params::BootParams;
global_asm!(include_str!("header.S"));
global_asm!(include_str!("setup.S"));

View File

@ -1,9 +1,10 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright(c) 2023-2024 Intel Corporation.
use crate::{tdcall::TdcallArgs, tdvmcall::TdVmcallArgs};
use core::arch::global_asm;
use crate::{tdcall::TdcallArgs, tdvmcall::TdVmcallArgs};
global_asm!(include_str!("tdcall.asm"));
global_asm!(include_str!("tdvmcall.asm"));

View File

@ -11,12 +11,14 @@ mod asm;
pub mod tdcall;
pub mod tdvmcall;
pub use self::tdcall::{get_veinfo, TdxVirtualExceptionType};
pub use self::tdvmcall::print;
use raw_cpuid::{native_cpuid::cpuid_count, CpuIdResult};
use tdcall::{InitError, TdgVpInfo};
pub use self::{
tdcall::{get_veinfo, TdxVirtualExceptionType},
tdvmcall::print,
};
pub fn init_tdx() -> Result<TdgVpInfo, InitError> {
check_tdx_guest()?;
Ok(tdcall::get_tdinfo()?)

View File

@ -5,10 +5,12 @@
//! It is used to call guest-side Intel TDX functions. For more information about
//! TDCALL, please refer to the [Intel® TDX Module v1.5 ABI Specification](https://cdrdv2.intel.com/v1/dl/getContent/733579)
use crate::asm::asm_td_call;
use bitflags::bitflags;
use core::fmt;
use bitflags::bitflags;
use crate::asm::asm_td_call;
/// TDCALL Instruction Leaf Numbers Definition.
#[repr(u64)]
pub enum TdcallNum {

View File

@ -8,15 +8,17 @@
//! resumes the TD via a SEAMCALL [TDH.VP.ENTER] invocation.
extern crate alloc;
use crate::asm::asm_td_vmcall;
use alloc::fmt;
use bitflags::bitflags;
use core::fmt::Write;
use bitflags::bitflags;
use x86_64::{
registers::rflags::{self, RFlags},
structures::port::PortRead,
};
use crate::asm::asm_td_vmcall;
/// TDVMCALL Instruction Leaf Numbers Definition.
#[repr(u64)]
pub enum TdVmcallNum {