[comp.bugs.4bsd] 4.3BSD UVAXII instruction emulation code is WRONG!

larry@utecfb.Toronto.Edu (Larry Philps) (12/22/86)

[This is a repost.  utzoo had transmission problem the day I posted
 this and I don't think it made it out the network proper.]

Index:	/sys/vax/emulate.s 4.3BSD

Description:
	The UVAX does not have 27 of the instructions that are part
	of the vax architecture.  To get around this problem, 4.3
	locore.s and emulate.s trap programs that try to use the
	non-existant instructions and emulate them using other instructions.
	Well - at least one of the packed decimal instructions is broken.
	Worse - doprnt uses them to make printing numbers "easy".  After
	starting with "my program work on the 780 but not on the UVAX"
	and two days of going cross-eyed, the following program demonstrates
	the problem.  I "THINK" that the problem is with the "ashp"
	instruction, but am not sure - it could also be "cvtlp" or "editpc"

	Just in case you don't realise it, this is a very serious problem.
	Any program you are running on a UVAX under 4.3 that does floating
	point calculations is likely giving the wrong answers!

	Anyway, I don't have a fix (yet), I am tired, and I am going home.
	If anyone has a fix or even understands how the emulate code for
	"ashp" works I would greatly appreciate some help.
Repeat-By:
	Compile and run the following program on 4.2, or 4.3 on any
	VAX or UVAX system.  When you run it on a non-UVAX you will get "1"
	as the result - this is correct.  On a UVAX you will get "0".
	    main()
	    {
		    float hpos = 0.9;

		    printf("%.0f\n", hpos);
	    }
-- 
Larry Philps	Engineering Computing Facility	University of Toronto
Usenet:     {linus, ihnp4, allegra, decvax, floyd}!utcsri!utecfa!larry
CSNET:      larry@Toronto
ARPA:       larry%Toronto@CSNet-Relay