Make exception table arch-agnostic
This commit is contained in:
parent
bfcb1d2c00
commit
629b053ea8
|
|
@ -95,7 +95,7 @@ SECTIONS
|
|||
# The section to store exception table (ExTable).
|
||||
# This table is used for recovering from specific exception handling faults
|
||||
# occurring at known points in the code.
|
||||
# Ref: /aster-frame/src/arch/x86/ex_table.rs
|
||||
# Ref: /ostd/src/ex_table.rs
|
||||
.ex_table : AT(ADDR(.ex_table) - KERNEL_VMA) {
|
||||
__ex_table = .;
|
||||
KEEP(*(SORT(.ex_table)))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
pub(crate) mod boot;
|
||||
pub mod cpu;
|
||||
pub mod device;
|
||||
pub(crate) mod ex_table;
|
||||
pub(crate) mod io;
|
||||
pub(crate) mod iommu;
|
||||
pub mod irq;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use cfg_if::cfg_if;
|
|||
use log::debug;
|
||||
use spin::Once;
|
||||
|
||||
use super::{cpu::context::GeneralRegs, ex_table::ExTable};
|
||||
use super::cpu::context::GeneralRegs;
|
||||
use crate::{
|
||||
arch::{
|
||||
cpu::context::{CpuException, PageFaultErrorCode, RawPageFaultInfo},
|
||||
|
|
@ -33,6 +33,7 @@ use crate::{
|
|||
irq::{disable_local, enable_local, HwIrqLine},
|
||||
},
|
||||
cpu::PrivilegeLevel,
|
||||
ex_table::ExTable,
|
||||
irq::call_irq_callback_functions,
|
||||
mm::{
|
||||
kspace::{KERNEL_PAGE_TABLE, LINEAR_MAPPING_BASE_VADDR, LINEAR_MAPPING_VADDR_RANGE},
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ impl ExTable {
|
|||
/// This function is generally used when an exception (such as a page fault) occurs.
|
||||
/// if the exception handling fails and there is a predefined recovery action,
|
||||
/// then the found recovery action will be taken.
|
||||
#[cfg_attr(
|
||||
any(target_arch = "riscv64", target_arch = "loongarch64"),
|
||||
expect(unused)
|
||||
)]
|
||||
pub fn find_recovery_inst_addr(inst_addr: Vaddr) -> Option<Vaddr> {
|
||||
let table_size = (__ex_table_end as usize - __ex_table as usize) / size_of::<ExTableItem>();
|
||||
// SAFETY: `__ex_table` is a static section consisting of `ExTableItem`.
|
||||
|
|
@ -37,6 +37,7 @@ pub mod bus;
|
|||
pub mod console;
|
||||
pub mod cpu;
|
||||
mod error;
|
||||
mod ex_table;
|
||||
pub mod io;
|
||||
pub mod irq;
|
||||
pub mod logger;
|
||||
|
|
|
|||
Loading…
Reference in New Issue