Skip to content

Commit fb5416c

Browse files
authored
Merge pull request #450 from Freax13/enhancement/idt
make `HandlerFuncType` unsafe
2 parents 4fc44a6 + e7f53ac commit fb5416c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/structures/idt.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -831,15 +831,19 @@ impl<F: HandlerFuncType> Entry<F> {
831831
}
832832

833833
/// A common trait for all handler functions usable in [`Entry`].
834-
pub trait HandlerFuncType {
834+
///
835+
/// # Safety
836+
///
837+
/// Implementors have to ensure that `to_virt_addr` returns a valid address.
838+
pub unsafe trait HandlerFuncType {
835839
/// Get the virtual address of the handler function.
836840
fn to_virt_addr(self) -> VirtAddr;
837841
}
838842

839843
macro_rules! impl_handler_func_type {
840844
($f:ty) => {
841845
#[cfg(feature = "abi_x86_interrupt")]
842-
impl HandlerFuncType for $f {
846+
unsafe impl HandlerFuncType for $f {
843847
#[inline]
844848
fn to_virt_addr(self) -> VirtAddr {
845849
VirtAddr::new(self as u64)

0 commit comments

Comments
 (0)