Subject: floating point test
To: None <port-sparc64@netbsd.org>
From: Andrey Petrov <petrov@netbsd.org>
List: port-sparc64
Date: 05/10/2001 12:21:18
--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I got my DEBUG enabled kernel crashed with the attached test,
first it breaks system to ddb and an attempt to continue
ends up in ofw 'ok' prompt. Commenting out lines below helps.
locore.s:4795
#ifdef DEBUG
	tst	%g2
	tz	1		! tpc NULL? Panic
	tst	%i6
	tz	1		! %fp NULL? Panic
#endif

Howto:
cc 960513-1.s
a.out

I looked for some time around, and decided to share it with the list.

	Andrey


--CE+1k2dSO48ffgeK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="960513-1.s"

	.file	"960513-1.c"
.section	".text"
	.align 4
	.global f
	.type	 f,@function
	.proc	07
f:
	!#PROLOGUE# 0
	!#PROLOGUE# 1
	fnegd	%f0, %f12
	fmovd	%f2, %f14
	fmovd	%f12, %f0
	cmp	%o2, 1
	bne,pt	%icc, .LL3
	fmovd	%f14, %f2
	faddq	%f12, %f12, %f12
.LL3:
	fmulq	%f0, %f12, %f4
	fsubq	%f12, %f4, %f12
	fmulq	%f0, %f12, %f8
	fsubq	%f12, %f8, %f12
	fmulq	%f0, %f12, %f4
	fsubq	%f12, %f4, %f12
	fmulq	%f0, %f12, %f8
	fsubq	%f12, %f8, %f12
	fmulq	%f0, %f12, %f0
	retl
	fsubq	%f12, %f0, %f0
.LLfe1:
	.size	 f,.LLfe1-f
.section	".rodata"
	.align 16
.LLC0:
	.uaword	0x40000000 ! ~2.00000000000000000000e0
	.uaword	0x0
	.uaword	0x0
	.uaword	0x0
.section	".text"
	.align 4
	.global main
	.type	 main,@function
	.proc	04
main:
	!#PROLOGUE# 0
	save	%sp, -208, %sp
	!#PROLOGUE# 1
	sethi	%hi(.LLC0), %o0
	mov	1, %o2
	add	%o0, %g4, %o0
	ldd	[%o0+%lo(.LLC0)], %f0
	ldd	[%o0+%lo(.LLC0+8)], %f2
	std	%f0, [%fp+2015]
	std	%f2, [%fp+2023]
	ldx	[%fp+2015], %o4
	ldx	[%fp+2023], %sp
	mov	%o4, %o0
	call	f, 0
	mov	%sp, %o2
	fqtoi	%f0, %f0
	st	%f0, [%fp+2031]
	ld	[%fp+2031], %o0
	cmp	%o0, 0
	bne,pt	%icc, .LL5
	nop
	call	abort, 0
	 nop
.LL5:
	call	exit, 0
	mov	0, %o0
.LLfe2:
	.size	 main,.LLfe2-main
	.ident	"GCC: (GNU) 2.95.2 19991024 (release)"

--CE+1k2dSO48ffgeK--