Skip to contentSkip to conversation

$ta0 .. $ta3 registers in O32 on MIPS

DISCUSSION Ralf Baechle 2 participants 3 messages Sep 28, 2011 MIPS

lore
Share & tools
lore
#0 lore raw

The register names $ta0 .. $ta3 were added by SGI for N32 / N64 code. Because these reference $8 .. $11 just like $t0 .. $t3 in the O32 ABI their availability in O32 as well appears dangerous, if not a bug:

$ cat s.s 
	addu	$ta0, $ta0
$ mips-linux-as -o s.o s.s
$ file s.o
s.o: ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped
$

I was expecting an error message and I'm wondering, was this intentional?

Ralf

#1 lore raw
Quoted 10 lines

The register names $ta0 .. $ta3 were added by SGI for N32 / N64 code.
Because these reference $8 .. $11 just like $t0 .. $t3 in the O32 ABI their availability in O32 as well appears dangerous, if not a bug:

$ cat s.s 
	addu	$ta0, $ta0
$ mips-linux-as -o s.o s.s
$ file s.o
s.o: ELF 32-bit MSB relocatable, MIPS, MIPS-I version 1 (SYSV), not stripped $

I was expecting an error message and I'm wondering, was this intentional?

I would say so. I call this a feature. It makes it easier to write assembly code that assembles without change in both O32 and N32/N64. Consider a function that has 4 or fewer arguments, but needs a pile of scratch registers. It can use ta0-ta3 as four scratch registers, which is correct in all the ABIs.

paul

#2 lore raw
Quoted 3 lines · On Wed, Sep 28, 2011 at 10:11:40AM -0500, [email protected] wrote:
Quoted 1 line

I was expecting an error message and I'm wondering, was this intentional?

I would say so. I call this a feature. It makes it easier to write assembly code that assembles without change in both O32 and N32/N64. Consider a function that has 4 or fewer arguments, but needs a pile of scratch registers. It can use ta0-ta3 as four scratch registers, which is correct in all the ABIs.

Turns out that later IRIX version also retroactively introduced the ta registers for O32 and I just never noticed. So I'm going to change the Linux kernel headers for consistence and compatibility with everybody else.

Ralf