add workflow
All checks were successful
Build iso / Explore-Gitea-Actions (push) Successful in 28s

This commit is contained in:
Masato Imai
2025-08-15 17:21:12 +00:00
parent f08ed4615c
commit 4870764e73
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,9 @@
name: Build iso
run-name: ${{ gitea.actor }} on ${{ gitea.event_name }}
on: [push]
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "${{ gitea.event_name }}"

View File

@ -18,6 +18,39 @@ pub fn check_vmcs_control_fields() -> Result<(), &'static str> {
check_secondary_proc_based_exec_ctrl(vmx_true_ctrl)?;
}
check_cr3_target()?;
check_io_bitmap()?;
Ok(())
}
fn is_valid_page_aligned_phys_addr(addr: u64) -> bool {
(addr & (!((1 << 40) - 1) | 0xfff)) == 0
}
fn check_cr3_target() -> Result<(), &'static str> {
let vmcs_cr3_target_count = vmread(vmcs::control::CR3_TARGET_COUNT)?;
if vmcs_cr3_target_count > 4 {
return Err("VMCS CR3-target count field is greater than 4");
}
Ok(())
}
fn check_io_bitmap() -> Result<(), &'static str> {
let vmcs_io_bitmap_a = vmread(vmcs::control::IO_BITMAP_A_ADDR_FULL)?;
let vmcs_io_bitmap_b = vmread(vmcs::control::IO_BITMAP_B_ADDR_FULL)?;
if !is_valid_page_aligned_phys_addr(vmcs_io_bitmap_a) {
return Err("VMCS IO bitmap A address is not a valid page-aligned physical address");
}
if !is_valid_page_aligned_phys_addr(vmcs_io_bitmap_b) {
return Err("VMCS IO bitmap B address is not a valid page-aligned physical address");
}
Ok(())
}