Skip to content
Snippets Groups Projects
Verified Commit 7a3b453f authored by Jacob Lorentzon's avatar Jacob Lorentzon
Browse files

Declare __usercopy_{start,end} as functions.

parent 4d2cd6ce
No related branches found
No related tags found
1 merge request!238Demand paging
...@@ -19,6 +19,7 @@ pub use super::CurrentRmmArch as RmmA; ...@@ -19,6 +19,7 @@ pub use super::CurrentRmmArch as RmmA;
pub type PageMapper = rmm::PageMapper<RmmA, crate::arch::rmm::LockedAllocator>; pub type PageMapper = rmm::PageMapper<RmmA, crate::arch::rmm::LockedAllocator>;
use crate::context::memory::{AccessMode, try_correcting_page_tables, PfError}; use crate::context::memory::{AccessMode, try_correcting_page_tables, PfError};
use crate::interrupt::InterruptStack; use crate::interrupt::InterruptStack;
use crate::kernel_executable_offsets::{__usercopy_end, __usercopy_start};
pub use crate::rmm::KernelMapper; pub use crate::rmm::KernelMapper;
pub mod entry; pub mod entry;
...@@ -145,11 +146,7 @@ pub struct Segv; ...@@ -145,11 +146,7 @@ pub struct Segv;
pub fn page_fault_handler(stack: &mut InterruptStack, code: PageFaultError, faulting_address: VirtualAddress) -> Result<(), Segv> { pub fn page_fault_handler(stack: &mut InterruptStack, code: PageFaultError, faulting_address: VirtualAddress) -> Result<(), Segv> {
let faulting_page = Page::containing_address(faulting_address); let faulting_page = Page::containing_address(faulting_address);
extern "C" { let usercopy_region = __usercopy_start()..__usercopy_end();
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) };
// TODO: Most likely not necessary, but maybe also check that cr2 is not too close to USER_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; let address_is_user = faulting_address.kind() == TableKind::User;
......
...@@ -294,5 +294,5 @@ macro_rules! linker_offsets( ...@@ -294,5 +294,5 @@ macro_rules! linker_offsets(
} }
); );
pub mod kernel_executable_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);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment