Declare __usercopy_{start,end} as functions.

This commit is contained in:
4lDO2
2023-07-27 15:34:33 +02:00
parent 4d2cd6ce0f
commit 7a3b453fbb
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -19,6 +19,7 @@ pub use super::CurrentRmmArch as RmmA;
pub type PageMapper = rmm::PageMapper<RmmA, crate::arch::rmm::LockedAllocator>;
use crate::context::memory::{AccessMode, try_correcting_page_tables, PfError};
use crate::interrupt::InterruptStack;
use crate::kernel_executable_offsets::{__usercopy_end, __usercopy_start};
pub use crate::rmm::KernelMapper;
pub mod entry;
@@ -145,11 +146,7 @@ pub struct Segv;
pub fn page_fault_handler(stack: &mut InterruptStack, code: PageFaultError, faulting_address: VirtualAddress) -> Result<(), Segv> {
let faulting_page = Page::containing_address(faulting_address);
extern "C" {
static __usercopy_start: u8;
static __usercopy_end: u8;
}
let usercopy_region = unsafe { (&__usercopy_start as *const u8 as usize)..(&__usercopy_end as *const u8 as usize) };
let usercopy_region = __usercopy_start()..__usercopy_end();
// TODO: Most likely not necessary, but maybe also check that cr2 is not too close to USER_END.
let address_is_user = faulting_address.kind() == TableKind::User;
+1 -1
View File
@@ -294,5 +294,5 @@ macro_rules! linker_offsets(
}
);
pub mod kernel_executable_offsets {
linker_offsets!(__text_start, __text_end, __rodata_start, __rodata_end, __data_start, __data_end, __bss_start, __bss_end, __tdata_start, __tdata_end, __tbss_start, __tbss_end);
linker_offsets!(__text_start, __text_end, __rodata_start, __rodata_end, __data_start, __data_end, __bss_start, __bss_end, __tdata_start, __tdata_end, __tbss_start, __tbss_end, __usercopy_start, __usercopy_end);
}