arch: define struct arch_esf
and deprecate z_arch_esf_t
Make `struct arch_esf` compulsory for all architectures by declaring it in the `arch_interface.h` header. After this commit, the named struct `z_arch_esf_t` is only used internally to generate offsets, and is slated to be removed from the `arch_interface.h` header in the future. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
3998e18ec4
commit
e54b27b967
105 changed files with 203 additions and 222 deletions
|
@ -13,7 +13,7 @@
|
|||
|
||||
static volatile int expected_reason = -1;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
static bool triggered_synchronous_svc;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static struct k_thread esf_collection_thread;
|
|||
/**
|
||||
* Validates that pEsf matches state from set_regs_with_known_pattern()
|
||||
*/
|
||||
static int check_esf_matches_expectations(const z_arch_esf_t *pEsf)
|
||||
static int check_esf_matches_expectations(const struct arch_esf *pEsf)
|
||||
{
|
||||
const uint16_t expected_fault_instruction = 0xde5a; /* udf #90 */
|
||||
const bool caller_regs_match_expected =
|
||||
|
@ -88,7 +88,7 @@ static int check_esf_matches_expectations(const z_arch_esf_t *pEsf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
TC_PRINT("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void arm_isr_handler(const void *args)
|
|||
test_flag++;
|
||||
}
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ uint8_t *nmi_stacks[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
bool z_x86_do_kernel_nmi(const z_arch_esf_t *esf)
|
||||
bool z_x86_do_kernel_nmi(const struct arch_esf *esf)
|
||||
{
|
||||
uint64_t stack;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ static volatile int int_handler_executed;
|
|||
/* Assume the spurious interrupt handler will execute and abort the task */
|
||||
static volatile int spur_handler_aborted_thread = 1;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
|
||||
{
|
||||
if (reason != K_ERR_SPURIOUS_IRQ) {
|
||||
printk("wrong error reason\n");
|
||||
|
@ -89,7 +89,7 @@ void isr_handler(void)
|
|||
*
|
||||
*/
|
||||
|
||||
void exc_divide_error_handler(z_arch_esf_t *p_esf)
|
||||
void exc_divide_error_handler(struct arch_esf *p_esf)
|
||||
{
|
||||
p_esf->eip += 2;
|
||||
/* provide evidence that the handler executed */
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <zephyr/fatal.h>
|
||||
#include <zephyr/kernel.h>
|
||||
|
||||
void z_fatal_error(unsigned int reason, const z_arch_esf_t *esf)
|
||||
void z_fatal_error(unsigned int reason, const struct arch_esf *esf)
|
||||
{
|
||||
ztest_test_fail();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ static struct coredump_mem_region_node dump_region0 = {
|
|||
.size = sizeof(values_to_dump)
|
||||
};
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
ARG_UNUSED(pEsf);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ volatile int rv;
|
|||
|
||||
static ZTEST_DMEM volatile int expected_reason = -1;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
TC_PRINT("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ static volatile int expected_reason = -1;
|
|||
|
||||
void z_thread_essential_clear(struct k_thread *thread);
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
static ZTEST_DMEM volatile int expected_reason = -1;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
int rv = TC_PASS;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ __pinned_bss
|
|||
static bool expect_fault;
|
||||
|
||||
__pinned_func
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ volatile bool expect_fault;
|
|||
__pinned_noinit
|
||||
static uint8_t __aligned(CONFIG_MMU_PAGE_SIZE) test_page[TEST_PAGE_SZ];
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
ZTEST_BMEM volatile bool valid_fault;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d %d\n", reason, valid_fault);
|
||||
if (valid_fault) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#define INFO(fmt, ...) printk(fmt, ##__VA_ARGS__)
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
INFO("Caught system error -- reason %d\n", reason);
|
||||
ztest_test_pass();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
ZTEST_BMEM static int count;
|
||||
ZTEST_BMEM static int ret = TC_PASS;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
|
||||
{
|
||||
if (reason != K_ERR_STACK_CHK_FAIL) {
|
||||
printk("wrong error type\n");
|
||||
|
|
|
@ -568,7 +568,7 @@ ZTEST_USER(sys_sem_1cpu, test_sem_multiple_threads_wait)
|
|||
* @}
|
||||
*/
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
printk("Unexpected fault during test\n");
|
||||
|
|
|
@ -36,7 +36,7 @@ char kernel_string[BUF_SIZE];
|
|||
char kernel_buf[BUF_SIZE];
|
||||
ZTEST_BMEM char user_string[BUF_SIZE];
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
printk("Unexpected fault during test\n");
|
||||
|
|
|
@ -76,7 +76,7 @@ static void set_fault(unsigned int reason)
|
|||
compiler_barrier();
|
||||
}
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
INFO("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ extern struct k_sem offload_sem;
|
|||
|
||||
/* A call back function which is hooked in default assert handler. */
|
||||
void ztest_post_fatal_error_hook(unsigned int reason,
|
||||
const z_arch_esf_t *pEsf)
|
||||
const struct arch_esf *pEsf)
|
||||
|
||||
{
|
||||
/* check if expected error */
|
||||
|
|
|
@ -674,7 +674,7 @@ void pipe_put_get_timeout(void)
|
|||
|
||||
/******************************************************************************/
|
||||
ZTEST_BMEM bool valid_fault;
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
if (valid_fault) {
|
||||
|
|
|
@ -757,7 +757,7 @@ ZTEST(smp, test_smp_ipi)
|
|||
}
|
||||
#endif
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
|
||||
{
|
||||
static int trigger;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ static K_SEM_DEFINE(end_sem, 0, 1);
|
|||
static ZTEST_BMEM struct k_thread *dyn_thread;
|
||||
static struct k_thread *dynamic_threads[CONFIG_MAX_THREAD_BYTES * 8];
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
|
||||
{
|
||||
if (reason != K_ERR_KERNEL_OOPS) {
|
||||
printk("wrong error reason\n");
|
||||
|
|
|
@ -179,7 +179,7 @@ static void set_fault(unsigned int reason)
|
|||
compiler_barrier();
|
||||
}
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
if (expect_fault) {
|
||||
if (expected_reason == reason) {
|
||||
|
|
|
@ -61,7 +61,7 @@ ZTEST(threads_lifecycle, test_essential_thread_operation)
|
|||
}
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason,
|
||||
const z_arch_esf_t *esf)
|
||||
const struct arch_esf *esf)
|
||||
{
|
||||
ARG_UNUSED(esf);
|
||||
ARG_UNUSED(reason);
|
||||
|
|
|
@ -25,7 +25,7 @@ static sys_multi_mem_blocks_t alloc_group;
|
|||
|
||||
static ZTEST_DMEM volatile int expected_reason = -1;
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
printk("Caught system error -- reason %d\n", reason);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
ARG_UNUSED(pEsf);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
static struct k_thread dump_thread;
|
||||
static K_THREAD_STACK_DEFINE(dump_stack, STACK_SIZE);
|
||||
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
||||
void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *pEsf)
|
||||
{
|
||||
ARG_UNUSED(reason);
|
||||
ARG_UNUSED(pEsf);
|
||||
|
|
|
@ -153,7 +153,7 @@ static void release_offload_sem(void)
|
|||
* default one.
|
||||
*/
|
||||
void ztest_post_fatal_error_hook(unsigned int reason,
|
||||
const z_arch_esf_t *pEsf)
|
||||
const struct arch_esf *pEsf)
|
||||
{
|
||||
switch (case_type) {
|
||||
case ZTEST_CATCH_FATAL_ACCESS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue