Zephyr Project API 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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 <zephyr/kernel.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 /* CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT */
41
76void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
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#endif /* CONFIG_USE_SWITCH */
133
134#if !defined(CONFIG_USE_SWITCH) || defined(__DOXYGEN__)
135#if defined(__DOXYGEN__)
148int arch_swap(unsigned int key);
149#endif /* __DOXYGEN__ */
150
159static ALWAYS_INLINE void
160arch_thread_return_value_set(struct k_thread *thread, unsigned int value);
161#endif /* !CONFIG_USE_SWITCH || __DOXYGEN__ */
162
163#ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN
174void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr,
175 k_thread_entry_t _main);
176#endif /* CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN */
177
178#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
192int arch_float_disable(struct k_thread *thread);
193
212int arch_float_enable(struct k_thread *thread, unsigned int options);
213#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */
214
215#if defined(CONFIG_USERSPACE) && defined(CONFIG_ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET)
239int arch_thread_priv_stack_space_get(const struct k_thread *thread, size_t *stack_size,
240 size_t *unused_ptr);
241#endif /* CONFIG_USERSPACE && CONFIG_ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET */
242
251FUNC_NORETURN void arch_system_halt(unsigned int reason);
252
270static inline bool arch_is_in_isr(void);
271
316void arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flags);
317
344void arch_mem_unmap(void *addr, size_t size);
345
367int arch_page_phys_get(void *virt, uintptr_t *phys);
368
380
400void arch_mem_page_out(void *addr, uintptr_t location);
401
419void arch_mem_page_in(void *addr, uintptr_t phys);
420
436
450
479
564 bool clear_accessed);
565
591
592#ifdef CONFIG_ARCH_HAS_THREAD_NAME_HOOK
605int arch_thread_name_set(struct k_thread *thread, const char *str);
606#endif /* CONFIG_ARCH_HAS_THREAD_NAME_HOOK */
607
614static inline void arch_kernel_init(void);
615
617static inline void arch_nop(void);
618
634void arch_coredump_info_dump(const struct arch_esf *esf);
635
640
641#if defined(CONFIG_USERSPACE) || defined(__DOXYGEN__)
642
651
652#endif /* CONFIG_USERSPACE || __DOXYGEN__ */
653
672size_t arch_tls_stack_setup(struct k_thread *new_thread, char *stack_ptr);
673
676/* Include arch-specific inline function implementation */
677#include <kernel_arch_func.h>
678
679#ifdef __cplusplus
680}
681#endif
682
683#endif /* _ASMLANGUAGE */
684
685#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:46
void(* k_thread_entry_t)(void *p1, void *p2, void *p3)
Thread entry point function type.
Definition arch_interface.h:48
uint16_t arch_coredump_tgt_code_get(void)
Get the target code specified by the architecture.
void arch_coredump_priv_stack_dump(struct k_thread *thread)
Architecture-specific handling of dumping privileged stack.
void arch_coredump_info_dump(const struct arch_esf *esf)
Architecture-specific handling during coredump.
static bool arch_is_in_isr(void)
Test if the current context is in interrupt context.
static void arch_kernel_init(void)
Architecture-specific kernel initialization hook.
int arch_printk_char_out(int c)
Early boot console output hook.
static void arch_nop(void)
Do nothing and return.
void arch_reserved_pages_update(void)
Update page frame database with reserved pages.
void arch_mem_page_in(void *addr, uintptr_t phys)
Update all page tables for a paged-in data page.
void arch_mem_page_out(void *addr, uintptr_t location)
Update all page tables for a paged-out data page.
void arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flags)
Map physical memory into the virtual address space.
arch_page_location
Status of a particular page location.
Definition kernel_arch_interface.h:440
enum arch_page_location arch_page_location_get(void *addr, uintptr_t *location)
Fetch location information about a page at a particular address.
void arch_mem_unmap(void *addr, size_t size)
Remove mappings for a provided virtual address range.
int arch_page_phys_get(void *virt, uintptr_t *phys)
Get the mapped physical memory address from virtual address.
uintptr_t arch_page_info_get(void *addr, uintptr_t *location, bool clear_accessed)
Retrieve page characteristics from the page table(s)
void arch_mem_scratch(uintptr_t phys)
Update current page tables for a temporary mapping.
@ ARCH_PAGE_LOCATION_BAD
The page is not mapped.
Definition kernel_arch_interface.h:448
@ ARCH_PAGE_LOCATION_PAGED_OUT
The page has been evicted to the backing store.
Definition kernel_arch_interface.h:442
@ ARCH_PAGE_LOCATION_PAGED_IN
The page is resident in memory.
Definition kernel_arch_interface.h:445
FUNC_NORETURN void arch_system_halt(unsigned int reason)
Halt the system, optionally propagating a reason code.
int arch_swap(unsigned int key)
Cooperatively context switch.
void arch_switch_to_main_thread(struct k_thread *main_thread, char *stack_ptr, k_thread_entry_t _main)
Custom logic for entering main thread context at early boot.
static ALWAYS_INLINE void arch_thread_return_value_set(struct k_thread *thread, unsigned int value)
Set the return value for the specified thread.
int arch_float_disable(struct k_thread *thread)
Disable floating point context preservation.
static void arch_switch(void *switch_to, void **switched_from)
Cooperative context switch primitive.
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)
Handle arch-specific logic for setting up new threads.
void arch_busy_wait(uint32_t usec_to_wait)
Architecture-specific implementation of busy-waiting.
size_t arch_tls_stack_setup(struct k_thread *new_thread, char *stack_ptr)
Setup Architecture-specific TLS area in stack.
#define ALWAYS_INLINE
Definition common.h:129
Public kernel APIs.
flags
Definition parser.h:96
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Exception Stack Frame.
Definition exception.h:60
Thread Structure.
Definition thread.h:259