Implement fixup for mipsel and small fixes

toolchain_update
Jiajie Chen 6 years ago
parent 6344f80a9b
commit 14a01cf3fc

@ -128,7 +128,8 @@ impl MemoryAttr {
/// A set of memory space with multiple memory areas with associated page table /// A set of memory space with multiple memory areas with associated page table
/// NOTE: Don't remove align(64), or you will fail to run MIPS. /// NOTE: Don't remove align(64), or you will fail to run MIPS.
#[repr(align(64))] /// Temporary solution for rv64
#[cfg_attr(not(target_arch = "riscv64"), repr(align(64)))]
pub struct MemorySet<T: PageTableExt> { pub struct MemorySet<T: PageTableExt> {
areas: Vec<MemoryArea>, areas: Vec<MemoryArea>,
page_table: T, page_table: T,

@ -1,3 +1,3 @@
/// board specific constants /// board specific constants
pub const MEMORY_END: usize = 0x8080_0000; pub const MEMORY_END: usize = 0x8800_0000;
pub const KERNEL_HEAP_SIZE: usize = 0x0044_0000; pub const KERNEL_HEAP_SIZE: usize = 0x0044_0000;

@ -17,6 +17,9 @@ SECTIONS
*(.text.entry) *(.text.entry)
. = ALIGN(4K); . = ALIGN(4K);
*(.text.ebase) *(.text.ebase)
_copy_user_start = .;
*(.text.copy_user)
_copy_user_end = .;
*(.text .text.*) *(.text .text.*)
. = ALIGN(4K); . = ALIGN(4K);
etext = .; etext = .;

@ -266,6 +266,15 @@ fn page_fault(tf: &mut TrapFrame) {
if !tlb_valid { if !tlb_valid {
if !crate::memory::handle_page_fault(addr) { if !crate::memory::handle_page_fault(addr) {
extern "C" {
fn _copy_user_start();
fn _copy_user_end();
}
if tf.epc >= _copy_user_start as usize && tf.epc < _copy_user_end as usize {
debug!("fixup for addr {:x?}", addr);
tf.epc = crate::memory::read_user_fixup as usize;
return;
}
crate::trap::error(tf); crate::trap::error(tf);
} }
} }

Loading…
Cancel
Save