Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/asm/fpu/api.h
| Show All 22 Lines | |||||
| * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
| * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
| * SUCH DAMAGE. | * SUCH DAMAGE. | ||||
| */ | */ | ||||
| #ifndef _FPU_API_H_ | #ifndef _FPU_API_H_ | ||||
| #define _FPU_API_H_ | #define _FPU_API_H_ | ||||
| #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) | #define kernel_fpu_begin() \ | ||||
| lkpi_kernel_fpu_begin() | |||||
| #include <machine/fpu.h> | #define kernel_fpu_end() \ | ||||
| lkpi_kernel_fpu_end() | |||||
| extern struct fpu_kern_ctx *__lkpi_fpu_ctx; | extern void lkpi_kernel_fpu_begin(void); | ||||
kib: This is still completely melts if more than one thread does kernel_fpu_begin() | |||||
Not Done Inline ActionsFeel free to extend the LinuxKPI's "current" with this variable. hselasky: Feel free to extend the LinuxKPI's "current" with this variable. | |||||
Done Inline Actions
OH! Thanks, that makes sense now. Where was this comment when I posted the original patch ;) val_packett.cool: > Feel free to extend the LinuxKPI's "current" with this variable.
OH! Thanks, that makes… | |||||
Not Done Inline ActionsUse ANSI C definitions. kib: Use ANSI C definitions. | |||||
Done Inline ActionsHuh? The only non-ANSI thing I know of is "K&R style" local variables being declared before the opening { bracket. But these functions do not declare any locals at all…?? val_packett.cool: Huh? The only non-ANSI thing I know of is "K&R style" local variables being declared before the… | |||||
Done Inline ActionsOh.. you mean the whole "blank () args doesn't mean no args" thing I guess val_packett.cool: Oh.. you mean the whole "blank `()` args doesn't mean no args" thing I guess | |||||
Not Done Inline ActionsComment should follow style. kib: Comment should follow style. | |||||
| extern unsigned int __lkpi_fpu_ctx_level; | extern void lkpi_kernel_fpu_end(void); | ||||
| static inline void | |||||
| kernel_fpu_begin() | |||||
| { | |||||
| if (__lkpi_fpu_ctx_level++ == 0) { | |||||
| fpu_kern_enter(curthread, __lkpi_fpu_ctx, FPU_KERN_NORMAL); | |||||
| } | |||||
| } | |||||
| static inline void | |||||
| kernel_fpu_end() | |||||
| { | |||||
| if (--__lkpi_fpu_ctx_level == 0) { | |||||
| fpu_kern_leave(curthread, __lkpi_fpu_ctx); | |||||
| } | |||||
| } | |||||
| #else | |||||
| static inline void | |||||
| kernel_fpu_begin() | |||||
| { | |||||
| } | |||||
| static inline void | |||||
| kernel_fpu_end() | |||||
| { | |||||
| } | |||||
| #endif | |||||
| #endif /* _FPU_API_H_ */ | #endif /* _FPU_API_H_ */ | ||||
This is still completely melts if more than one thread does kernel_fpu_begin()