#include <9pm/u.h>
#include <9pm/libc.h>

void
setfcr(ulong x)
{
	x ^= 0x3F;
	_asm {
		fldc	x
	}
}

ulong
getfcr(void)
{
	ulong x;
	_asm {
		fstc	x
	}
	return x^0x3F;
}

ulong
getfsr(void)
{
	ulong x;
	_asm {
		fsts	x
	}
	return x;
}

void
setfsr(ulong x)
{
	_asm {
		fclex	x
	}
}


syntax highlighted by Code2HTML, v. 0.9.1