Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a reviewed feature from downstream oscamp/arceos.
For further information, please refer to: oscomp/arceos#34
some linker script updates in arceos-org/arceos#266
Description
This pull request introduces a mechanism to invoke post-trap callbacks across multiple architectures, refactors exception handling in the AArch64 assembly code, and enhances the
TrapSource
enum with helper functionality. These changes aim to improve modularity and consistency in trap handling across the codebase.Post-Trap Callback Mechanism:
src/trap.rs
: Introduced a distributed slicePOST_TRAP
for registering callbacks to be invoked after a trap, and added apost_trap_callback
function to iterate through and call these callbacks. [1] [2]Various architecture-specific trap handlers (
src/loongarch64/trap.rs
,src/riscv/trap.rs
,src/x86_64/trap.rs
,src/x86_64/syscall.rs
): Updated to callpost_trap_callback
with appropriate parameters after handling traps. [1] [2] [3] [4]AArch64 Exception Handling Refactor:
src/aarch64/trap.S
: Updated macrosHANDLE_SYNC
andHANDLE_IRQ
to accept asource
parameter, and modified their invocations inexception_vector_base
to pass the appropriate source value. This ensures that the source of the exception is explicitly tracked. [1] [2]src/aarch64/trap.rs
: Updatedhandle_sync_exception
andhandle_irq_exception
to accept aTrapSource
parameter, and integratedpost_trap_callback
into these functions to handle post-trap logic. [1] [2] [3]Enhancements to
TrapSource
:src/aarch64/trap.rs
: Added anis_from_user
method to theTrapSource
enum to determine if a trap originated from user space. This simplifies checks for user-originated traps.Additional Notes
This is a step towards gradually merging downstream oscamp/arceos into the main branch.