summaryrefslogtreecommitdiff
path: root/lib/libc/arch/i386/gen/fpsetsticky.S
blob: e3c20cc536b2d99936a9f10e7c2d3589b9046b33 (plain)
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
/*
 * Written by Charles M. Hannum, Apr 9, 1995
 * Public domain.
 */

#include <machine/asm.h>

#if defined(LIBC_SCCS)
	.text
	.asciz "$OpenBSD: fpsetsticky.S,v 1.2 1996/08/19 08:12:28 tholo Exp $"
#endif

ENTRY(fpsetsticky)
	subl $28,%esp

	fnstenv (%esp)
	movl 4(%esp),%eax
	movl %eax,%edx

	andl $63,%eax

	subl %eax,%edx
	movl 32(%esp),%ecx
	andl $63,%ecx
	addl %ecx,%edx
	movl %edx,4(%esp)
	fldenv (%esp)

	addl $28,%esp
	ret