Anas Nashif | 3dc0c45 | 2024-02-27 08:48:37 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010-2014 Wind River Systems, Inc. |
| 3 | * Copyright (c) 2024 Intel Corporation |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | */ |
| 7 | #include <zephyr/kernel.h> |
| 8 | #include <zephyr/internal/syscall_handler.h> |
| 9 | #include <kernel_arch_interface.h> |
| 10 | |
| 11 | int z_impl_k_float_disable(struct k_thread *thread) |
| 12 | { |
| 13 | #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) |
| 14 | return arch_float_disable(thread); |
| 15 | #else |
| 16 | ARG_UNUSED(thread); |
| 17 | return -ENOTSUP; |
| 18 | #endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ |
| 19 | } |
| 20 | |
| 21 | int z_impl_k_float_enable(struct k_thread *thread, unsigned int options) |
| 22 | { |
| 23 | #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) |
| 24 | return arch_float_enable(thread, options); |
| 25 | #else |
| 26 | ARG_UNUSED(thread); |
| 27 | ARG_UNUSED(options); |
| 28 | return -ENOTSUP; |
| 29 | #endif /* CONFIG_FPU && CONFIG_FPU_SHARING */ |
| 30 | } |
| 31 | |
| 32 | #ifdef CONFIG_USERSPACE |
| 33 | static inline int z_vrfy_k_float_disable(struct k_thread *thread) |
| 34 | { |
| 35 | K_OOPS(K_SYSCALL_OBJ(thread, K_OBJ_THREAD)); |
| 36 | return z_impl_k_float_disable(thread); |
| 37 | } |
Yong Cong Sin | bbe5e1e | 2024-01-24 17:35:04 +0800 | [diff] [blame] | 38 | #include <zephyr/syscalls/k_float_disable_mrsh.c> |
Anas Nashif | 3dc0c45 | 2024-02-27 08:48:37 -0500 | [diff] [blame] | 39 | |
| 40 | static inline int z_vrfy_k_float_enable(struct k_thread *thread, unsigned int options) |
| 41 | { |
| 42 | K_OOPS(K_SYSCALL_OBJ(thread, K_OBJ_THREAD)); |
| 43 | return z_impl_k_float_enable(thread, options); |
| 44 | } |
Yong Cong Sin | bbe5e1e | 2024-01-24 17:35:04 +0800 | [diff] [blame] | 45 | #include <zephyr/syscalls/k_float_enable_mrsh.c> |
Anas Nashif | 3dc0c45 | 2024-02-27 08:48:37 -0500 | [diff] [blame] | 46 | |
| 47 | #endif /* CONFIG_USERSPACE */ |