forked from Imagelibrary/rtems
cpukit: Add exception extensions
This adds the set of functions necessary to allow more generic handling of machine exceptions. This initial patch offers the ability to manipulate a CPU_Exception_frame and resume execution using that exception information with or without thread dispatch. These functions are gated behind the RTEMS_EXCEPTION_EXTENSIONS configuration option.
This commit is contained in:
committed by
Joel Sherrill
parent
9b088157ed
commit
db9e88510d
@@ -1142,6 +1142,69 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
||||||
|
|
||||||
|
#ifdef RTEMS_EXCEPTION_EXTENSIONS
|
||||||
|
/**
|
||||||
|
* @brief Resumes normal execution using the provided exception frame.
|
||||||
|
*
|
||||||
|
* This routine helps to avoid dead code in the exception handler epilogue and
|
||||||
|
* does not return. This routine may assume that the provided pointer is valid
|
||||||
|
* for resetting the exception stack.
|
||||||
|
*
|
||||||
|
* @param frame The CPU_Exception_frame describing the machine exception.
|
||||||
|
*/
|
||||||
|
RTEMS_NO_RETURN void _CPU_Exception_resume( CPU_Exception_frame *frame );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs thread dispatch and resumes normal execution.
|
||||||
|
*
|
||||||
|
* This routine helps to avoid dead code in the exception handler epilogue and
|
||||||
|
* does not return. This routine may assume that the provided pointer is valid
|
||||||
|
* for resetting the exception stack. This function is expected to decrement
|
||||||
|
* the ISR nest level and thread dispatch disable level in the Per_CPU_Control
|
||||||
|
* structure.
|
||||||
|
*
|
||||||
|
* @param frame The CPU_Exception_frame describing the machine
|
||||||
|
* exception.
|
||||||
|
*/
|
||||||
|
RTEMS_NO_RETURN void _CPU_Exception_dispatch_and_resume(
|
||||||
|
CPU_Exception_frame *frame
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disables thread dispatch.
|
||||||
|
*
|
||||||
|
* This must be called before calling _CPU_Exception_dispatch_and_resume
|
||||||
|
* since that function is expected to reduce the levels incremented below.
|
||||||
|
*/
|
||||||
|
void _CPU_Exception_disable_thread_dispatch( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Retrieves the generic exception class of the machine exception.
|
||||||
|
*
|
||||||
|
* @param frame The CPU_Exception_frame describing the machine
|
||||||
|
* exception.
|
||||||
|
* @return The signal associated with the CPU_Exception_frame.
|
||||||
|
*/
|
||||||
|
int _CPU_Exception_frame_get_signal( CPU_Exception_frame *frame );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the execution address of the exception frame.
|
||||||
|
*
|
||||||
|
* @param frame The CPU_Exception_frame describing the machine exception.
|
||||||
|
* @param address The address at which execution should resume.
|
||||||
|
*/
|
||||||
|
void _CPU_Exception_frame_set_resume( CPU_Exception_frame *frame, void *address );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the execution address of the exception frame to the next
|
||||||
|
* instruction.
|
||||||
|
*
|
||||||
|
* @param frame The CPU_Exception_frame describing the machine
|
||||||
|
* exception.
|
||||||
|
*/
|
||||||
|
void _CPU_Exception_frame_make_resume_next_instruction( CPU_Exception_frame *frame );
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup RTEMSScoreCPUExampleCPUEndian CPUEndian
|
* @defgroup RTEMSScoreCPUExampleCPUEndian CPUEndian
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ links:
|
|||||||
uid: optdebug
|
uid: optdebug
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: optdrvmgr
|
uid: optdrvmgr
|
||||||
|
- role: build-dependency
|
||||||
|
uid: optexceptionextensions
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
uid: optmpci
|
uid: optmpci
|
||||||
- role: build-dependency
|
- role: build-dependency
|
||||||
|
|||||||
18
spec/build/cpukit/optexceptionextensions.yml
Normal file
18
spec/build/cpukit/optexceptionextensions.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||||
|
actions:
|
||||||
|
- get-boolean: null
|
||||||
|
- env-enable: null
|
||||||
|
- define-condition: null
|
||||||
|
build-type: option
|
||||||
|
copyrights:
|
||||||
|
- Copyright (C) 2021 On-Line Applications Research (OAR)
|
||||||
|
default: true
|
||||||
|
default-by-family: []
|
||||||
|
default-by-variant: []
|
||||||
|
description: |
|
||||||
|
Enable the RTEMS Exception Extensions for manipulating and acting on exception
|
||||||
|
frames.
|
||||||
|
enabled-by:
|
||||||
|
links: []
|
||||||
|
name: RTEMS_EXCEPTION_EXTENSIONS
|
||||||
|
type: build
|
||||||
Reference in New Issue
Block a user