Skip to content

[feat] add aarch64 el2 entry_guest and vmexit support - #15

Open
ZR233 wants to merge 7 commits into
arceos-org:mainfrom
arceos-hypervisor:vmm
Open

ZR233 wants to merge 7 commits into
arceos-org:mainfrom
arceos-hypervisor:vmm

Conversation

@ZR233

@ZR233 ZR233 commented Aug 13, 2025

Copy link
Copy Markdown

Add aarch64 el2 trap handle support.

@ZR233

ZR233 commented Aug 13, 2025

Copy link
Copy Markdown
Author

@equation314 ci fixed.

@chyyuu
chyyuu requested review from aarkegz, equation314, hky1999, shilei-massclouds and yfblock and removed request for equation314 September 5, 2025 03:28
@hky1999

hky1999 commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

Does this PR bring virtualization support back into Arceos again? @aarkegz

If we want to integrate hypervisor into ArceOS, maybe we should refer to ARM/KVM with ARM VHE support?

Comment thread src/aarch64/trap.rs
access_flags |= PageFaultFlags::USER;
}
let vaddr = va!(FAR_EL1.get() as usize);
let vaddr = va!(elx!(FAR.get()) as usize);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will elx!(FAR).get() be a better syntax?

Comment thread src/aarch64/trap.rs

#[cfg(feature = "arm-el2")]
#[unsafe(no_mangle)]
fn handle_sync_exception(tf: &mut TrapFrame) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it possible to merge these two handle_sync_exceptions? As they are very similar.

Comment thread src/aarch64/el2.rs
///
/// This function is marked as `naked` to avoid the compiler generating a prologue/epilogue,
#[unsafe(naked)]
pub unsafe extern "C" fn enter_guest() -> ! {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add Registers as the argument.

Comment thread src/aarch64/el2.rs
///
/// This function is marked as `naked` to avoid the compiler generating a prologue/epilogue,
#[unsafe(naked)]
pub unsafe extern "C" fn enter_guest() -> ! {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Create a structure like UspaceContext to put this function?

Comment thread src/aarch64/trap.rs
#[cfg(not(feature = "arm-el2"))]
{
paste::paste! {
aarch64_cpu::registers::[<$name _EL1>].$e

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about this method: rust-lang/rust#124225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants