Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
kernel_arch_interface.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
17#ifndef ZEPHYR_KERNEL_INCLUDE_KERNEL_ARCH_INTERFACE_H_
18#define ZEPHYR_KERNEL_INCLUDE_KERNEL_ARCH_INTERFACE_H_
19
20#include <kernel.h>
21#include <sys/arch_interface.h>
22
23#ifndef _ASMLANGUAGE
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33#ifdef CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT
39void arch_busy_wait(uint32_t usec_to_wait);
40#endif
41
77 char *stack_ptr, k_thread_entry_t entry,
78 void *p1, void *p2, void *p3);
79
80#ifdef CONFIG_USE_SWITCH
131static inline void arch_switch(void *switch_to, void **switched_from);
132#else
145int arch_swap(unsigned int key);
146
155static ALWAYS_INLINE void
156arch_thread_return_value_set(struct k_thread *thread, unsigned int value);
157#endif /* CONFIG_USE_SWITCH i*/
158
159#ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN
170void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr,
171 k_thread_entry_t _main);
172#endif /* CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN */
173
174#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
189
208int arch_float_enable(struct k_thread *thread, unsigned int options);
209#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */
210
219FUNC_NORETURN void arch_system_halt(unsigned int reason);
220
238static inline bool arch_is_in_isr(void);
239
248#ifdef CONFIG_MMU
285void arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flags);
286
313void arch_mem_unmap(void *addr, size_t size);
314
336int arch_page_phys_get(void *virt, uintptr_t *phys);
337
338#ifdef CONFIG_ARCH_HAS_RESERVED_PAGE_FRAMES
349void arch_reserved_pages_update(void);
350#endif /* ARCH_HAS_RESERVED_PAGE_FRAMES */
351
352#ifdef CONFIG_DEMAND_PAGING
372void arch_mem_page_out(void *addr, uintptr_t location);
373
391void arch_mem_page_in(void *addr, uintptr_t phys);
392
407void arch_mem_scratch(uintptr_t phys);
408
409enum arch_page_location {
410 ARCH_PAGE_LOCATION_PAGED_OUT,
411 ARCH_PAGE_LOCATION_PAGED_IN,
412 ARCH_PAGE_LOCATION_BAD
413};
414
442enum arch_page_location arch_page_location_get(void *addr, uintptr_t *location);
443
527uintptr_t arch_page_info_get(void *addr, uintptr_t *location,
528 bool clear_accessed);
529#endif /* CONFIG_DEMAND_PAGING */
530#endif /* CONFIG_MMU */
556
566static inline void arch_kernel_init(void);
567
569static inline void arch_nop(void);
570
586void arch_coredump_info_dump(const z_arch_esf_t *esf);
587
592
611size_t arch_tls_stack_setup(struct k_thread *new_thread, char *stack_ptr);
612
615/* Include arch-specific inline function implementation */
616#include <kernel_arch_func.h>
617
618#ifdef __cplusplus
619}
620#endif
621
622#endif /* _ASMLANGUAGE */
623
624#endif /* ZEPHYR_KERNEL_INCLUDE_KERNEL_ARCH_INTERFACE_H_ */
struct z_thread_stack_element k_thread_stack_t
Typedef of struct z_thread_stack_element.
Definition: arch_interface.h:44
void(* k_thread_entry_t)(void *p1, void *p2, void *p3)
Thread entry point function type.
Definition: arch_interface.h:46
static struct k_thread thread[2]
Definition: atomic.c:22
#define ALWAYS_INLINE
Definition: common.h:116
void arch_coredump_info_dump(const z_arch_esf_t *esf)
Architecture-specific handling during coredump.
uint16_t arch_coredump_tgt_code_get(void)
Get the target code specified by the architecture.
static bool arch_is_in_isr(void)
static void arch_kernel_init(void)
int arch_printk_char_out(int c)
static void arch_nop(void)
void arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flags)
void arch_mem_unmap(void *addr, size_t size)
int arch_page_phys_get(void *virt, uintptr_t *phys)
FUNC_NORETURN void arch_system_halt(unsigned int reason)
void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr, k_thread_entry_t _main)
int arch_float_disable(struct k_thread *thread)
Disable floating point context preservation.
static void arch_switch(void *switch_to, void **switched_from)
int arch_float_enable(struct k_thread *thread, unsigned int options)
Enable floating point context preservation.
void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack, char *stack_ptr, k_thread_entry_t entry, void *p1, void *p2, void *p3)
void arch_busy_wait(uint32_t usec_to_wait)
size_t arch_tls_stack_setup(struct k_thread *new_thread, char *stack_ptr)
Setup Architecture-specific TLS area in stack.
flags
Definition: http_parser.h:131
char c
Definition: printk.c:71
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
struct k_stack stack
Definition: test_stack_contexts.c:18
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:75
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Definition: thread.h:201
static struct k_thread * main_thread
Definition: main.c:27