1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/fe310: Inline thread_yield_higher function

This commit is contained in:
Koen Zandberg 2021-01-18 17:09:19 +01:00
parent 0129e73ec0
commit 9979646b8b
No known key found for this signature in database
GPG Key ID: 0895A893E6D2985B
2 changed files with 57 additions and 18 deletions

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2021 Koen Zandberg <koen@bergzand.net>
* 2021 Inria
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup cpu_fe310
* @{
*
* @file
* @brief Implementation of the kernels thread interface
*
* @author Koen Zandberg <koen@bergzand.net>
*
* @}
*/
#ifndef THREAD_ARCH_H
#define THREAD_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
#define THREAD_API_INLINED
#ifndef DOXYGEN /* Doxygen is in core/include/thread.h */
static inline void _ecall_dispatch(uint32_t num, void *ctx)
{
/* function arguments are in a0 and a1 as per ABI */
__asm__ volatile (
"mv a0, %[num] \n"
"mv a1, %[ctx] \n"
"ECALL\n"
: /* No outputs */
: [num] "r" (num), [ctx] "r" (ctx)
: "memory"
);
}
static inline __attribute__((always_inline)) void thread_yield_higher(void)
{
_ecall_dispatch(0, NULL);
}
#endif /* DOXYGEN */
#ifdef __cplusplus
}
#endif
#endif /* THREAD_ARCH_H */
/** @} */

View File

@ -179,24 +179,6 @@ void cpu_switch_context_exit(void)
UNREACHABLE();
}
static inline void _ecall_dispatch(uint32_t num, void *ctx)
{
/* function arguments are in a0 and a1 as per ABI */
__asm__ volatile (
"mv a0, %[num] \n"
"mv a1, %[ctx] \n"
"ECALL\n"
: /* No outputs */
: [num] "r" (num), [ctx] "r" (ctx)
: "memory"
);
}
void thread_yield_higher(void)
{
_ecall_dispatch(0, NULL);
}
/**
* @brief Print heap statistics
*/