The original exception handling has space to optimize and
and some bugs need to be fixed.
* define NANO_ESF
* add the definition of NANO_ESF which is an irq_stack_frame
* add the corresponding codes in exception entry and handler
* remove _default_esf
* implement the _ARCH_EXCEPT
* use trap exception to raise exception by kernel
* add corresponding trap exception entry
* add _do_kernel_oops to handle the exception raised by
_ARCH_EXCEPT.
* add the thread context switch in exception return
* case: kernel oops may raise thread context switch
* case: some tests will re-implement SysFatalHandler to raise
thread context switch.
* as the exception and isr are handled in kernel isr stack, so
the thread context switch must be in the return of exception/isr
, and the exception handler must return, should not be decorated
with FUNC_NORETURN
* for arc, _is_in_isr should consider the case of exception
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
79 lines
1.6 KiB
C
79 lines
1.6 KiB
C
/*
|
|
* Copyright (c) 2014-2016 Wind River Systems, Inc.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief Private kernel definitions
|
|
*
|
|
* This file contains private kernel structures definitions and various
|
|
* other definitions for the ARCv2 processor architecture.
|
|
*
|
|
* This file is also included by assembly language files which must #define
|
|
* _ASMLANGUAGE before including this header file. Note that kernel
|
|
* assembly source files obtains structure offset values via "absolute
|
|
* symbols" in the offsets.o module.
|
|
*/
|
|
|
|
#ifndef _kernel_arch_func__h_
|
|
#define _kernel_arch_func__h_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if !defined(_ASMLANGUAGE)
|
|
|
|
#ifdef CONFIG_CPU_ARCV2
|
|
#include <v2/cache.h>
|
|
#include <v2/irq.h>
|
|
#endif
|
|
|
|
static ALWAYS_INLINE void kernel_arch_init(void)
|
|
{
|
|
_irq_setup();
|
|
}
|
|
|
|
static ALWAYS_INLINE void
|
|
_set_thread_return_value(struct k_thread *thread, unsigned int value)
|
|
{
|
|
thread->arch.return_value = value;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @brief Indicates the interrupt number of the highest priority
|
|
* active interrupt
|
|
*
|
|
* @return IRQ number
|
|
*/
|
|
static ALWAYS_INLINE int _INTERRUPT_CAUSE(void)
|
|
{
|
|
u32_t irq_num = _arc_v2_aux_reg_read(_ARC_V2_ICAUSE);
|
|
|
|
return irq_num;
|
|
}
|
|
|
|
#define _is_in_isr _arc_v2_irq_unit_is_in_isr
|
|
|
|
extern void _thread_entry_wrapper(void);
|
|
extern void _user_thread_entry_wrapper(void);
|
|
|
|
static inline void _IntLibInit(void)
|
|
{
|
|
/* nothing needed, here because the kernel requires it */
|
|
}
|
|
|
|
extern void _arc_userspace_enter(k_thread_entry_t user_entry, void *p1,
|
|
void *p2, void *p3, u32_t stack, u32_t size);
|
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _kernel_arch_func__h_ */
|