Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/alphapc/fptrap.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname alphapc/fptrap.c 1999/0415
## diff -e /dev/null /n/emeliedump/1999/0415/sys/src/brazil/alphapc/fptrap.c
0a
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"ureg.h"
#include	"io.h"
#include	"../port/error.h"

char *fpcause[] =
{
	"invalid operation",
	"division by zero",
	"overflow",
	"underflow",
	"inexact operation",
	"integer overflow",
};
char	*fpexcname(Ureg*, ulong, char*);

void
fptrap(Ureg *ur)
{
	char buf[ERRLEN];
	int i;
	ulong reason;

	ur->pc &= ~2;
	reason = (ulong)ur->a0;
	for (i = 1; i < 6; i++)
		if (reason & (1<<i)) {
			sprint(buf, "fp: %s", fpcause[i-1]);
			goto found;
		}
	sprint(buf, "fp: code 0x%lux", reason);

found:
	fataltrap(ur, buf);
}

char*
fpexcname(Ureg *ur, ulong fcr31, char *buf)
{
	USED(ur, fcr31, buf);
	return buf;
}
.
## diffname alphapc/fptrap.c 2001/0727
## diff -e /n/emeliedump/1999/0415/sys/src/brazil/alphapc/fptrap.c /n/emeliedump/2001/0727/sys/src/9/alphapc/fptrap.c
24c
	char buf[ERRMAX];
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.