Skip to contentSkip to conversation

libqthreads and hppa-linux

parisc-linux LaMont Jones 3 participants 8 messages Aug 2, 2001

lore
Share & tools
lore
#0 lore raw

I started to play with getting the hppa assembly code in guile-core to work on pa-linux, but ran into challenges with %farg[0-3], which aren't defined by the assembler...

I'm about to upload a source NMU of guile-core, which has qt/md/hppa*-linux.? in it. If someone wanted to take that the rest of the way, I'd be happy to upload it...

lamont

#1 lore raw
Quoted 3 lines · LaMont Jones

I started to play with getting the hppa assembly code in guile-core to work on pa-linux, but ran into challenges with %farg[0-3], which aren't defined by the assembler...

So fix the assembler! gas/config/tc-hppa.c:pre_defined_registers

#2 lore raw
Quoted 5 lines · LaMont Jones
Quoted 3 lines

I started to play with getting the hppa assembly code in guile-core to work on pa-linux, but ran into challenges with %farg[0-3], which aren't defined by the assembler...

So fix the assembler! gas/config/tc-hppa.c:pre_defined_registers

Dunno which regs they are, and don't have a current runtime arch doc at home.

How close is the calling convention between hp-ux and pa-linux?

lamont

#3 lore raw
Quoted 3 lines
Quoted 1 line

So fix the assembler! gas/config/tc-hppa.c:pre_defined_registers

Dunno which regs they are, and don't have a current runtime arch doc at home.

This code seems to think that four args are passed in regs, but the code that cc generates appears to only pass two doubles in regs. Likewise, are the FR's numbered the same? (The names were rather funky on hp-ux, due to legacy issues...)

lamont

#6 lore raw
In reply to LaMont Jones
Quoted 10 lines · LaMont Jones
Quoted 5 lines · LaMont Jones
Quoted 3 lines

I started to play with getting the hppa assembly code in guile-core to work on pa-linux, but ran into challenges with %farg[0-3], which aren't defined by the assembler...

So fix the assembler! gas/config/tc-hppa.c:pre_defined_registers

Dunno which regs they are, and don't have a current runtime arch doc at home.

How close is the calling convention between hp-ux and pa-linux?

Practically identical. farg0..3 is fr4..7 from memory, and I think they are in that order. Test it out by writing a little C code, and compiling with -S.

#4 lore raw
In reply to LaMont Jones
Quoted 8 lines · LaMont Jones
Quoted 3 lines
Quoted 1 line

So fix the assembler! gas/config/tc-hppa.c:pre_defined_registers

Dunno which regs they are, and don't have a current runtime arch doc at home.

This code seems to think that four args are passed in regs, but the code that cc generates appears to only pass two doubles in regs. Likewise, are the FR's numbered the same? (The names were rather funky on hp-ux, due to legacy issues...)

Hmm, I wonder if you've found a gcc bug?

#if 1
#define FP float
#else
#define FP double
#endif
extern FP f1 (FP a);
extern FP f2 (FP a, FP b);
extern FP f3 (FP a, FP b, FP c);
extern FP f4 (FP a, FP b, FP c, FP d);

int main (void)
{
return f1 (1.) + f2 (1., 2.) + f3 (1., 2., 3.) + f4 (1., 2., 3., 4.);
}

With FP as float, I get fr4L, fr5L, fr6L, fr7L used in that order for floating point args. With FP as double, I get fr5, fr7, stack args. Weird, but then the pa ABI _is_ weird. I think you do need to check that ABI document.

Alan

#5 lore raw
Quoted 1 line · Alan Modra

Hmm, I wonder if you've found a gcc bug?

Curiousity got the better of me, and I dug up copy of the ABI. Looks like gcc is doing the right thing.

"Floating-Point (32 Bits, single-precision): One word, callee cannot assume a valid floating-point number.

Floating-Point (64 Bits, double-precision): Two words, double word aligned (high order word in odd arg word). This may create a void in the argument list. 64-bit floating-point value parameters mapped to the first and second double-words of the argument list should be passed in farg1 and farg3, respectively. farg0 and farg2 are never used for 64-bit floating-point parameters. Callee cannot assume a valid floating-point number."

Makes a weird sort of sense when you realise that the register args have a mapping to stack slots, and there are only 4x32 bits of stack space, or 2 doubles.

Alan

#7 lore raw
In reply to LaMont Jones
Quoted 3 lines · LaMont Jones

I started to play with getting the hppa assembly code in guile-core to work on pa-linux, but ran into challenges with %farg[0-3], which aren't defined by the assembler...

I already discussed this in detail with the maintainer; details of the discussion can be found in the BTS. I'm disappointed you decided to waste your time on this without reading that discussion or talking to me.

Quoted 3 lines

I'm about to upload a source NMU of guile-core, which has qt/md/hppa*-linux.? in it. If someone wanted to take that the rest of the way, I'd be happy to upload it...

No, don't do this, it's completely unnecessary.

Signature · 1 line
Revolutions do not require corporate support.