Ejemplo n.º 1
0
int main(int argc, char **argv){
double cel, fah;

cel =0; fah =ctf(cel);
assert( fah == 32);
cel= 100; fah=ctf(cel);
assert (fah ==0);
cel= -40; fah=ctf(cel);
assert (fah ==-40);
return 0;
}
Ejemplo n.º 2
0
/*
 * Handle exceptions of UniCore-F64.
 */
void ucf64_exchandler(u32 inst, u32 fpexc, struct pt_regs *regs)
{
	u32 tmp = fpexc;
	u32 exc = F64_EXCEPTION_ERROR & fpexc;

	pr_debug("UniCore-F64: instruction %08x fpscr %08x\n",
			inst, fpexc);

	if (exc & FPSCR_CMPINSTR_BIT) {
		if (exc & FPSCR_CON)
			tmp |= FPSCR_CON;
		else
			tmp &= ~(FPSCR_CON);
		exc &= ~(FPSCR_CMPINSTR_BIT | FPSCR_CON);
	} else {
		pr_debug("UniCore-F64 Error: unhandled exceptions\n");
		pr_debug("UniCore-F64 FPSCR 0x%08x INST 0x%08x\n",
				cff(FPSCR), inst);

		ucf64_raise_sigfpe(regs);
		return;
	}

	/*
	 * Update the FPSCR with the additional exception flags.
	 * Comparison instructions always return at least one of
	 * these flags set.
	 */
	tmp &= ~(FPSCR_TRAP | FPSCR_IOS | FPSCR_OFS | FPSCR_UFS |
			FPSCR_IXS | FPSCR_HIS | FPSCR_IOC | FPSCR_OFC |
			FPSCR_UFC | FPSCR_IXC | FPSCR_HIC);

	tmp |= exc;
	ctf(FPSCR, tmp);
}
Ejemplo n.º 3
0
void ucf64_exchandler(u32 inst, u32 fpexc, struct pt_regs *regs)
{
	u32 tmp = fpexc;
	u32 exc = F64_EXCEPTION_ERROR & fpexc;

	pr_debug("UniCore-F64: instruction %08x fpscr %08x\n",
			inst, fpexc);

	if (exc & FPSCR_CMPINSTR_BIT) {
		if (exc & FPSCR_CON)
			tmp |= FPSCR_CON;
		else
			tmp &= ~(FPSCR_CON);
		exc &= ~(FPSCR_CMPINSTR_BIT | FPSCR_CON);
	} else {
		pr_debug(KERN_ERR "UniCore-F64 Error: unhandled exceptions\n");
		pr_debug(KERN_ERR "UniCore-F64 FPSCR 0x%08x INST 0x%08x\n",
				cff(FPSCR), inst);

		ucf64_raise_sigfpe(0, regs);
		return;
	}

	/*
                                                         
                                                         
                    
  */
	tmp &= ~(FPSCR_TRAP | FPSCR_IOS | FPSCR_OFS | FPSCR_UFS |
			FPSCR_IXS | FPSCR_HIS | FPSCR_IOC | FPSCR_OFC |
			FPSCR_UFC | FPSCR_IXC | FPSCR_HIC);

	tmp |= exc;
	ctf(FPSCR, tmp);
}
Ejemplo n.º 4
0
/*
 * F64 support code initialisation.
 */
static int __init ucf64_init(void)
{
	ctf(FPSCR, 0x0);     /* FPSCR_UFE | FPSCR_NDE perhaps better */

	printk(KERN_INFO "Enable UniCore-F64 support.\n");

	return 0;
}
Ejemplo n.º 5
0
static int __init ucf64_init(void)
{
	ctf(FPSCR, 0x0);     /*                                      */

	printk(KERN_INFO "Enable UniCore-F64 support.\n");

	return 0;
}