Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6d32033
feat: opentmk init
mayank-microsoft Mar 10, 2025
351199b
feat: added docs
mayank-microsoft Apr 21, 2025
3e1673e
refactor(opentmk): interrupt handler doesn't need to save state for a…
mayank-microsoft Apr 21, 2025
056bf7d
reafctor(opentmk): remove dead code
mayank-microsoft Apr 21, 2025
6d37a84
chore: resolve PR feedback
mayank-microsoft May 11, 2025
53e0da2
chore: resolve PR feedback
mayank-microsoft May 12, 2025
7eb38ff
refactor: resolve PR feedback
mayank-microsoft May 12, 2025
2d2aec4
reafactor: errors for hyper-v error handling
mayank-microsoft May 21, 2025
4cd03a5
feat: add test for a negitive case where parition has not enabled VTL1
mayank-microsoft May 21, 2025
bb22270
docs: add documentation for structs
mayank-microsoft May 22, 2025
e9fef3a
rtc+broken misc test
mayank-microsoft Jul 3, 2025
9a0ef26
clippy fixup
mayank-microsoft Jul 3, 2025
e02ee17
broken
mayank-microsoft Jul 17, 2025
48d300a
chore: add tpm working
mayank-microsoft Jul 29, 2025
7bdf91f
feat: add new cvm tests
mayank-microsoft Aug 12, 2025
1104901
lint: add lints for imports
mayank-microsoft Aug 12, 2025
c0f3e0a
chore: resolve PR comments
mayank-microsoft Aug 26, 2025
7f33bbd
chore: resolve PR comments
mayank-microsoft Aug 27, 2025
a49da94
feat: compiles on Arm64
mayank-microsoft Aug 27, 2025
9bdf302
chore: resolve copilot comments
mayank-microsoft Aug 27, 2025
fc0b866
chore: remove default impl for channel
mayank-microsoft Aug 27, 2025
7019671
cleanup
mayank-microsoft Aug 27, 2025
7d70c67
fix: compiler error
mayank-microsoft Aug 28, 2025
43e04f0
chore: add back features
mayank-microsoft Aug 28, 2025
4560aa6
feat: add register intercept test
mayank-microsoft Sep 2, 2025
d28f9c3
lint: ran cargo fmt
mayank-microsoft Sep 2, 2025
1b31943
fix: changes to make register intercepts CVM ready
mayank-microsoft Sep 2, 2025
a20e5cb
refactor: reduce number of cfgs
mayank-microsoft Sep 5, 2025
84297d4
chore: resolve PR comments
mayank-microsoft Sep 8, 2025
c22989a
chore: pr comments resolve
mayank-microsoft Sep 8, 2025
151ae4f
chore: resolve PR comment
mayank-microsoft Sep 8, 2025
7f241aa
chore: resolve PR comments
mayank-microsoft Sep 8, 2025
f961d8a
chore: resolve PR comments
mayank-microsoft Sep 8, 2025
63becb0
chore: adding reason for inline(never)
mayank-microsoft Sep 8, 2025
2be9b2d
chore: update error description
mayank-microsoft Sep 8, 2025
cc9205d
chore: resolve PR comments
mayank-microsoft Sep 8, 2025
93845da
chore: updates for clippy pass
mayank-microsoft Sep 8, 2025
8c436ec
chore: unimplemented functions should not have irrelavant docs
mayank-microsoft Sep 8, 2025
909f2b0
chore: depende on minimal_rt for aarch64 serial port communication
mayank-microsoft Sep 8, 2025
66ee0b7
chore: resolve PR comments
mayank-microsoft Sep 8, 2025
1d687da
chore: resolve PR comments
mayank-microsoft Oct 7, 2025
119afb5
Merge branch 'main' into target-opentmk
mattkur Oct 7, 2025
c32ecbf
Merge branch 'main' into target-opentmk
mayank-microsoft Oct 7, 2025
77e7129
Cargo.lock merge fix
mattkur Oct 7, 2025
4105362
cleanup: remove files not required with the PR merged
mayank-microsoft Oct 7, 2025
ff51df4
chore: refactor for PR comments
mayank-microsoft Oct 7, 2025
a0d6037
chore: [WIP] flowey fixups
mayank-microsoft Oct 8, 2025
e67c794
chore: resolve lint errors
mayank-microsoft Oct 13, 2025
96603fe
chore: resolve lint error
mayank-microsoft Oct 13, 2025
3ca6418
build: fix failure fixes
mayank-microsoft Oct 13, 2025
c0f8aca
fix: build errors
mayank-microsoft Oct 13, 2025
b95eaf6
fix: nightly feature ci failures
mayank-microsoft Oct 13, 2025
b725ef5
fix: ci failures
mayank-microsoft Oct 13, 2025
0952aec
fix: build failures
mayank-microsoft Oct 13, 2025
19a7312
chore: resolve copilot comments
mayank-microsoft Oct 14, 2025
1af6f82
Merge branch 'main' into target-opentmk
mayank-microsoft Oct 15, 2025
a61d548
chore: resolve copilot comments
mayank-microsoft Oct 16, 2025
083a52f
fix: no_mangle should be unsafe
mayank-microsoft Oct 16, 2025
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 opentmk/src/arch/x86_64/interrupt_handler_register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use x86_64::structures::idt::PageFaultErrorCode;
static mut COMMON_HANDLER: fn(InterruptStackFrame, u8) = common_handler;
static COMMON_HANDLER_MUTEX: Mutex<()> = Mutex::new(());

#[unsafe(no_mangle)]
#[no_mangle]
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.

isn't no_mangle an unsafe attribute?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, read up more about it now. with edition 2024, it should be marked unsafe.

fn abstraction_handle(stack_frame: InterruptStackFrame, interrupt: u8) {
// SAFETY: COMMON_HANDLER is only set via set_common_handler which is protected by a mutex.
unsafe { (COMMON_HANDLER)(stack_frame, interrupt) };
Expand Down
10 changes: 2 additions & 8 deletions opentmk/src/platform/hyperv/arch/aarch64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ impl HvCall {
.expect("size of start_virtual_processor header is not correct");

let output = self.dispatch_hvcall(hvdef::HypercallCode::HvCallStartVirtualProcessor, None);
match output.result() {
Ok(()) => Ok(()),
err => panic!("Failed to start virtual processor: {:?}", err),
}
output.result()
}

/// Enables a VTL for a specific virtual processor (VP) on aarch64.
Expand All @@ -55,10 +52,7 @@ impl HvCall {
_ = header.write_to_prefix(self.input_page().buffer.as_mut_slice());

let output = self.dispatch_hvcall(hvdef::HypercallCode::HvCallEnableVpVtl, None);
match output.result() {
Ok(()) | Err(hvdef::HvError::VtlAlreadyEnabled) => Ok(()),
err => err,
}
output.result()
}

/// Placeholder for VTL call on aarch64.
Expand Down
10 changes: 2 additions & 8 deletions opentmk/src/platform/hyperv/arch/x86_64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ impl HvCall {
.expect("size of start_virtual_processor header is not correct");

let output = self.dispatch_hvcall(hvdef::HypercallCode::HvCallStartVirtualProcessor, None);
match output.result() {
Ok(()) => Ok(()),
err => panic!("Failed to start virtual processor: {:?}", err),
}
output.result()
}

/// Enables a VTL for a specific virtual processor (VP) on x86_64.
Expand All @@ -80,10 +77,7 @@ impl HvCall {
.expect("size of enable_vp_vtl header is not correct");

let output = self.dispatch_hvcall(hvdef::HypercallCode::HvCallEnableVpVtl, None);
match output.result() {
Ok(()) | Err(hvdef::HvError::VtlAlreadyEnabled) => Ok(()),
err => err,
}
output.result()
}

/// Retrieves the current VTL context by reading the necessary registers.
Expand Down
2 changes: 1 addition & 1 deletion opentmk/src/tests/hyperv/hv_register_intercept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
tmk_assert!(r.is_ok(), "get_register should succeed to read Control register");

let reg_values = r.unwrap();
tmk_assert!(reg_values == 0x0000000000001000, format!("register value should be 0x0000000000000800, got {:x}", reg_values));
tmk_assert!(reg_values == 0x0000000000001000, format!("register value should be 0x0000000000001000, got {:x}", reg_values));

log::info!("Switching to VTL0: attempting to read a protected register to verify security enforcement and intercept handling.");

Expand Down
4 changes: 2 additions & 2 deletions opentmk/src/tests/hyperv/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Licensed under the MIT License.

#[macro_export]
/// Generates a function that calls the given symbol saving and restoring all registers around the call.
/// Generates a function that calls the given symbol saving and restoring general purpose registers around the call.
macro_rules! create_function_with_restore {
($func_name:ident, $symbol:ident) => {
#[inline(never)]
// avoiding inline for debuggability in release builds.
fn $func_name() {
// SAFETY: we are calling a function pointer and restoring all registers.
// SAFETY: we are calling a function pointer and restoring general purpose registers.
unsafe {
asm!("
push rax
Comment thread
mayank-microsoft marked this conversation as resolved.
Expand Down
36 changes: 23 additions & 13 deletions support/nostd_spin_channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,30 @@ impl<T> Receiver<T> {
/// Tries to receive an element from the front of the queue while blocking
/// Returns Ok(value) if successful, Err(RecvError) otherwise
pub fn recv(&self) -> Result<T, RecvError> {
// Use a separate scope for the lock to ensure it's released promptly
let result = {
let mut buffer = self.inner.buffer.lock();
buffer.pop_front()
};
match result {
Some(val) => Ok(val),
None => {
// Check if there are any senders left
if self.inner.senders.load(Ordering::SeqCst) == 0 {
Err(RecvError::Disconnected)
} else {
Err(RecvError::Empty)
loop {
// Use a separate scope for the lock to ensure it's released promptly
let result = {
let mut buffer = self.inner.buffer.lock();
buffer.pop_front()
};
let r = match result {
Some(val) => Ok(val),
None => {
// Check if there are any senders left
if self.inner.senders.load(Ordering::SeqCst) == 0 {
Err(RecvError::Disconnected)
} else {
Err(RecvError::Empty)
}
}
};

if let Err(err) = r {
if err != RecvError::Empty {
return Err(err);
}
} else {
return r;
}
}
}
Comment on lines +186 to +215
Copy link

Copilot AI Oct 16, 2025

Choose a reason for hiding this comment

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

The comment states this method blocks, but it returns immediately with Empty if the queue is empty; no blocking/waiting occurs. Update the doc comment (remove "blocking") or implement actual blocking behavior (e.g. with a wait mechanism).

Copilot uses AI. Check for mistakes.
Expand Down
Loading