xref: /freebsd-src/sys/riscv/include/fpe.h (revision 44d4ee7f3dadb9efa7a8ea599f7276074dd41a91)
17804dd52SRuslan Bukin /*-
2*44d4ee7fSRuslan Bukin  * Copyright (c) 2016-2024 Ruslan Bukin <br@bsdpad.com>
37804dd52SRuslan Bukin  * All rights reserved.
47804dd52SRuslan Bukin  *
57804dd52SRuslan Bukin  * This software was developed by SRI International and the University of
67804dd52SRuslan Bukin  * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
77804dd52SRuslan Bukin  * ("CTSRD"), as part of the DARPA CRASH research programme.
87804dd52SRuslan Bukin  *
97804dd52SRuslan Bukin  * Redistribution and use in source and binary forms, with or without
107804dd52SRuslan Bukin  * modification, are permitted provided that the following conditions
117804dd52SRuslan Bukin  * are met:
127804dd52SRuslan Bukin  * 1. Redistributions of source code must retain the above copyright
137804dd52SRuslan Bukin  *    notice, this list of conditions and the following disclaimer.
147804dd52SRuslan Bukin  * 2. Redistributions in binary form must reproduce the above copyright
157804dd52SRuslan Bukin  *    notice, this list of conditions and the following disclaimer in the
167804dd52SRuslan Bukin  *    documentation and/or other materials provided with the distribution.
177804dd52SRuslan Bukin  *
187804dd52SRuslan Bukin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
197804dd52SRuslan Bukin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
207804dd52SRuslan Bukin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
217804dd52SRuslan Bukin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
227804dd52SRuslan Bukin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
237804dd52SRuslan Bukin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
247804dd52SRuslan Bukin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
257804dd52SRuslan Bukin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
267804dd52SRuslan Bukin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
277804dd52SRuslan Bukin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
287804dd52SRuslan Bukin  * SUCH DAMAGE.
297804dd52SRuslan Bukin  */
307804dd52SRuslan Bukin 
317804dd52SRuslan Bukin #ifndef	_MACHINE_FPE_H_
327804dd52SRuslan Bukin #define	_MACHINE_FPE_H_
337804dd52SRuslan Bukin 
347804dd52SRuslan Bukin void fpe_state_save(struct thread *td);
35232d0b87SJohn Baldwin void fpe_state_clear(void);
367804dd52SRuslan Bukin 
37*44d4ee7fSRuslan Bukin struct fpreg *fpu_save_area_alloc(void);
38*44d4ee7fSRuslan Bukin void fpu_save_area_free(struct fpreg *fsa);
39*44d4ee7fSRuslan Bukin void fpu_save_area_reset(struct fpreg *fsa);
40*44d4ee7fSRuslan Bukin 
41*44d4ee7fSRuslan Bukin void fpe_enable(void);
42*44d4ee7fSRuslan Bukin void fpe_disable(void);
43*44d4ee7fSRuslan Bukin 
44*44d4ee7fSRuslan Bukin void fpe_store(struct fpreg *state);
45*44d4ee7fSRuslan Bukin void fpe_restore(struct fpreg *state);
46*44d4ee7fSRuslan Bukin 
477804dd52SRuslan Bukin #endif /* !_MACHINE_FPE_H_ */
48