1*a80d07adSdrahn /* $OpenBSD: fpsetsticky.c,v 1.2 2021/04/30 16:13:00 drahn Exp $ */
24cf001dcSkettenis /*
34cf001dcSkettenis * Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
44cf001dcSkettenis *
54cf001dcSkettenis * Permission to use, copy, modify, and distribute this software for any
64cf001dcSkettenis * purpose with or without fee is hereby granted, provided that the above
74cf001dcSkettenis * copyright notice and this permission notice appear in all copies.
84cf001dcSkettenis *
94cf001dcSkettenis * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
104cf001dcSkettenis * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
114cf001dcSkettenis * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
124cf001dcSkettenis * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
134cf001dcSkettenis * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
144cf001dcSkettenis * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
154cf001dcSkettenis * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
164cf001dcSkettenis */
174cf001dcSkettenis
184cf001dcSkettenis #include <sys/types.h>
194cf001dcSkettenis #include <ieeefp.h>
204cf001dcSkettenis
214cf001dcSkettenis fp_except
fpsetsticky(fp_except sticky)224cf001dcSkettenis fpsetsticky(fp_except sticky)
234cf001dcSkettenis {
244cf001dcSkettenis uint32_t fflags;
254cf001dcSkettenis
264cf001dcSkettenis __asm volatile ("fsflags %0, %1" : "=r"(fflags) : "r"(sticky));
274cf001dcSkettenis return fflags;
284cf001dcSkettenis }
29