code: 9ferno

ref: 600bbfe4aaa9ad0f73d8d73eef1b7670e5f7d3a3
dir: /lib9/setfcr-OpenBSD-amd64.S/

View raw version

#define	FN(x)	.type x,@function; .global x; x
#define	ENT	subq $32, %rsp
#define	RET	addq $32, %rsp; ret

	.file	"setfcr-OpenBSD-amd64.S"
FN(setfcr):
	ENT
	xorb	$0x3f, %al
	movq	%rax, (%rsp)
	fwait
	fldcw	(%rsp)
	RET

FN(getfcr):
	ENT
	fwait
	fstcw	(%rsp)
	movw	(%rsp), %ax
	andq	$0xffffff, %rax
	xorb	$0x3f, %al
	RET

FN(getfsr):
	ENT
	fwait
	fstsw	(%rsp)
	movw	(%rsp), %ax
	andq	$0xffffff, %rax
	RET

FN(setfsr):
	fclex
	ret