1/* 2 * Copyright (c) 2014-2015 Wind River Systems, Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/** 8 * @file 9 * @brief Wrapper for z_thread_entry 10 * 11 * Wrapper for z_thread_entry routine when called from the initial context. 12 */ 13 14#include <zephyr/toolchain.h> 15#include <zephyr/linker/sections.h> 16#include <v2/irq.h> 17#include <zephyr/arch/arc/asm-compat/assembler.h> 18 19GTEXT(z_thread_entry_wrapper) 20GTEXT(z_thread_entry_wrapper1) 21 22/** 23 * @brief Wrapper for z_thread_entry 24 * 25 * The routine pops parameters for the z_thread_entry from stack frame, prepared 26 * by the arch_new_thread() routine. 27 */ 28 29SECTION_FUNC(TEXT, z_thread_entry_wrapper) 30 seti _ARC_V2_INIT_IRQ_LOCK_KEY 31z_thread_entry_wrapper1: 32 POPR r3 33 POPR r2 34 POPR r1 35 POPR r0 36 j z_thread_entry 37 nop 38 39 40#if !defined(CONFIG_MULTITHREADING) 41GTEXT(z_main_no_multithreading_entry_wrapper) 42 43/* void z_main_no_multithreading_entry_wrapper(*p1, *p2, *p3, *main_stack, *main_entry) */ 44SECTION_FUNC(TEXT, z_main_no_multithreading_entry_wrapper) 45 MOVR sp, r3 46 47 /* *p1, *p2, *p3 are in r0, r1, r2 already */ 48 jl [r4] 49 nop 50 51 /* 52 * If we return from main we'll return from main wrapper and appear here. 53 * Go to infinite loop as there is nothing more to do. 54 */ 55z_main_no_multithreading_entry_wrapper_end: 56 b z_main_no_multithreading_entry_wrapper_end 57 58#endif /* !CONFIG_MULTITHREADING */ 59