arch: arc: remove arc_exc_saved_sp used in exc handling
* as ilink has a copy in ERET, it can be reused as a gp * use ilink to do the job of arc_exc_saved_sp to save 4 bytes and save some cycles because no load/store of memory * it will make code scalable, e.g. for SMP, no need to define variables for each core Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
parent
2e6504b6bc
commit
abac940c43
2 changed files with 6 additions and 6 deletions
|
@ -20,7 +20,6 @@
|
|||
#include <exc_handle.h>
|
||||
#include <logging/log_ctrl.h>
|
||||
|
||||
u32_t arc_exc_saved_sp;
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_EXC_DECLARE(z_arch_user_string_nlen);
|
||||
|
@ -363,7 +362,7 @@ static void dump_exception_info(u32_t vector, u32_t cause, u32_t parameter)
|
|||
* invokes the user provided routine k_sys_fatal_error_handler() which is
|
||||
* responsible for implementing the error handling policy.
|
||||
*/
|
||||
void _Fault(z_arch_esf_t *esf)
|
||||
void _Fault(z_arch_esf_t *esf, u32_t old_sp)
|
||||
{
|
||||
u32_t vector, cause, parameter;
|
||||
u32_t exc_addr = z_arc_v2_aux_reg_read(_ARC_V2_EFA);
|
||||
|
@ -413,7 +412,7 @@ void _Fault(z_arch_esf_t *esf)
|
|||
#ifdef CONFIG_MPU_STACK_GUARD
|
||||
if (vector == ARC_EV_PROT_V && ((parameter == 0x4) ||
|
||||
(parameter == 0x24))) {
|
||||
if (z_check_thread_stack_fail(exc_addr, arc_exc_saved_sp)) {
|
||||
if (z_check_thread_stack_fail(exc_addr, old_sp)) {
|
||||
z_arc_fatal_error(K_ERR_STACK_CHK_FAIL, esf);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ GTEXT(z_irq_do_offload);
|
|||
#endif
|
||||
|
||||
GDATA(exc_nest_count)
|
||||
GDATA(arc_exc_saved_sWWp)
|
||||
|
||||
/* the necessary stack size for exception handling */
|
||||
#define EXCEPTION_STACK_SIZE 384
|
||||
|
@ -62,7 +61,7 @@ SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_dc_error)
|
|||
SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_maligned)
|
||||
|
||||
_exc_entry:
|
||||
st sp, [arc_exc_saved_sp]
|
||||
mov_s ilink, sp
|
||||
/*
|
||||
* re-use the top part of interrupt stack as exception
|
||||
* stack. If this top part is used by interrupt handling,
|
||||
|
@ -94,6 +93,8 @@ _exc_entry:
|
|||
|
||||
/* sp is parameter of _Fault */
|
||||
mov r0, sp
|
||||
/* ilink is the thread's original sp */
|
||||
mov r1, ilink
|
||||
jl _Fault
|
||||
|
||||
_exc_return:
|
||||
|
@ -142,7 +143,7 @@ _exc_return_from_exc:
|
|||
sr r0, [_ARC_V2_ERET]
|
||||
|
||||
_pop_irq_stack_frame
|
||||
ld sp, [arc_exc_saved_sp]
|
||||
mov sp, ilink
|
||||
rtie
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue