Re: [PATCH v2] MIPS: Add basic R5900 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Maciej,

> >  Anyway, as noted above that shouldn't cause a problem with user software 
> > and I think that any corruption you can see comes from elsewhere.  You'll 
> > have to paper this $ra non-sign-extension issue over somehow to proceed 
> > though.
> 
> I've extended do_IRQ with a register check under the condition that
> user_mode(get_irq_regs()) is true, with the following sample results
> where registers $2-$25 are printed if they are not sign-extended
> properly (there is a certain amount of randomness to this):
> 
>     $10 : 00005f6362696c5f
>     epc = 0fb6db00 in ld.so.1[fb60000+19000]

Debian-based Black Rhino libc.so.6 declares "ELF 32-bit LSB MIPS-III
version 1" but functions such as strcmp contain both 64-bit and multimedia
instructions (presumably hand coded in assembly for the R5900):

	6005ea90 <strcmp>:
	...
	6005eb50:	78880000 	lq	t0,0(a0)
	6005eb54:	710043a9 	pcpyud	t0,t0,zero
	6005eb58:	1000000c 	b	6005eb8c <strcmp+0xfc>
	6005eb5c:	71204ba9 	pcpyud	t1,t1,zero
	6005eb60:	dc880000 	ld	t0,0(a0)
	6005eb64:	24840008 	addiu	a0,a0,8
	6005eb68:	dca90000 	ld	t1,0(a1)
	6005eb6c:	710072a8 	pceqb	t6,t0,zero
	6005eb70:	71207aa8 	pceqb	t7,t1,zero
	6005eb74:	01cf7025 	or	t6,t6,t7
	6005eb78:	71097aa8 	pceqb	t7,t0,t1
	...

Hence corruption and register sign-extension failures. One can also note
that according to the TX-79 manual, for a 32-bit kernel, several MIPS I
instruction operations are undefined unless registers are sign-extended.

It is unfortunate that these instructions seem untrappable by the R5900,
instead silently causing strange behaviour and invalid results.

Still left to explain is why the kernel stumbles on registers during
initialisation, before user applications are invoked.

Fredrik


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux