Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align folder name to kernel arch #309

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kvm-bindings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Rust FFI bindings to KVM, generated using
following target architectures:
- x86_64
- arm64
- riscv64
- riscv

The bindings exported by this crate are statically generated using header files
associated with a specific kernel version, and are not automatically synced with
Expand Down
4 changes: 2 additions & 2 deletions kvm-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ mod arm64;
pub use self::arm64::*;

#[cfg(target_arch = "riscv64")]
mod riscv64;
mod riscv;
#[cfg(target_arch = "riscv64")]
pub use self::riscv64::*;
pub use self::riscv::*;
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use vmm_sys_util::fam::{FamStruct, FamStructWrapper};

use riscv64::bindings::*;
use riscv::bindings::*;

// There is no constant in the kernel as far as the maximum number
// of registers on RISC-V, but KVM_GET_REG_LIST usually returns around 160.
const RISCV64_REGS_MAX: usize = 200;
const RISCV_REGS_MAX: usize = 200;

// Implement the FamStruct trait for kvm_reg_list.
generate_fam_struct_impl!(kvm_reg_list, u64, reg, u64, n, RISCV64_REGS_MAX);
generate_fam_struct_impl!(kvm_reg_list, u64, reg, u64, n, RISCV_REGS_MAX);

// Implement the PartialEq trait for kvm_reg_list.
impl PartialEq for kvm_reg_list {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions kvm-bindings/src/x86_64/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use bindings::{
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use zerocopy::{transmute, AsBytes, FromBytes, FromZeroes};

serde_impls!(
serde_impls! {
kvm_regs,
kvm_segment,
kvm_dtable,
Expand All @@ -30,7 +30,7 @@ serde_impls!(
kvm_cpuid2,
kvm_xsave,
kvm_irqchip
);
}

// SAFETY: zerocopy's derives explicitly disallow deriving for unions where
// the fields have different sizes, due to the smaller fields having padding.
Expand Down