1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2023 SiFive
6 #include <linux/export.h>
7 #include <linux/preempt.h>
11 #include <asm/processor.h>
12 #include <asm/switch_to.h>
14 void kernel_fpu_begin(void)
17 fstate_save(current
, task_pt_regs(current
));
18 csr_set(CSR_SSTATUS
, SR_FS
);
20 EXPORT_SYMBOL_GPL(kernel_fpu_begin
);
22 void kernel_fpu_end(void)
24 csr_clear(CSR_SSTATUS
, SR_FS
);
25 fstate_restore(current
, task_pt_regs(current
));
28 EXPORT_SYMBOL_GPL(kernel_fpu_end
);