hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * SPDX-License-Identifier: GPL-2.0
 *
 * Copyright (C) 2019 Philippe Gerum.
 */
#ifndef _ASM_X86_DOVETAIL_H
#define _ASM_X86_DOVETAIL_H
 
#if !defined(__ASSEMBLY__) && defined(CONFIG_DOVETAIL)
 
#include <asm/fpu/api.h>
#include <asm/io_bitmap.h>
 
static inline void arch_dovetail_exec_prepare(void)
{
   clear_thread_flag(TIF_NEED_FPU_LOAD);
}
 
static inline
void arch_dovetail_switch_prepare(bool leave_inband)
{
   if (leave_inband)
       fpu__suspend_inband();
}
 
static inline
void arch_dovetail_switch_finish(bool enter_inband)
{
   unsigned int ti_work = READ_ONCE(current_thread_info()->flags);
 
   if (unlikely(ti_work & _TIF_IO_BITMAP))
       tss_update_io_bitmap();
 
   if (enter_inband) {
       fpu__resume_inband();
   } else {
         if (unlikely(ti_work & _TIF_NEED_FPU_LOAD &&
                 !(current->flags & PF_KTHREAD)))
             switch_fpu_return();
   }
}
 
#endif
 
#endif /* _ASM_X86_DOVETAIL_H */