Skip to content

Conversation

@Solicey
Copy link
Contributor

@Solicey Solicey commented Oct 18, 2025

No description provided.

@Solicey Solicey added this to the hvisor-v0.3 milestone Oct 18, 2025
@Solicey Solicey self-assigned this Oct 18, 2025
@Solicey Solicey added feature New feature or request x86_64 labels Oct 18, 2025
@caodg caodg requested a review from ForeverYolo October 18, 2025 23:42
return;
}

pub fn get_target_cpu(irq: usize, zone_id: usize) -> usize {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should we add a new function get_target_cpu here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because in x86_64, the target CPU of virtio device interrupt is decided by virtual I/O APIC, while in other archs we can simply use the first CPU as the interrupt receiver. Therefore, I add a generic API get_target_cpu for all archs to decide which CPU should we set as target.

#[cfg(all(feature = "uart_16550", target_arch = "aarch64"))]
pub use uart_16550::{console_getchar, console_putchar};

#[cfg(target_arch = "x86_64")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a new cargo feature here, like #[cfg(all(feature = "uart16550a", target_arch = "x86"))]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will add an "uart16550a" feature in Cargo.toml

pub enum HyperCallCode {
HvVirtioInit = 0,
HvVirtioInjectIrq = 1,
HvVirtioGetIrq = 86,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set this hypercall code to 86?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this hypercall code is currently only used by x86_64, so at that time I set it to '86' to avoid conflict with other upcoming codes. Shall I change its number to a smaller one?

src/logging.rs Outdated
Level::Trace => ColorCode::BrightBlack,
};

#[cfg(all(feature = "graphics"))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put the graphics logic in a separate function to hide the details.

Copy link
Contributor Author

@Solicey Solicey Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I have changed the implement of SimpleLogger to hide its details.

@Inquisitor-201 Inquisitor-201 merged commit 4450a9b into dev Oct 20, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants