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

Bug#327351: Fixed in local cvs.parisc-linux.org, sorry for not submitting upstream.



My apologies for not responding to this bug earlier. I'm currently the
upstream maintainer for the glibc port to hppa. I also try to do all the
debian libc6 work. I'm suffering from the "must finish thesis" syndrome
and I had to drop everything. A consequence is that hppa has some
mis-merged patched and missing fixes.

We fixed this bug already in cvs.parisc-linux.org, you may want to look
at our solution, since that is what I'll be submitting upstream in
mid-November (that's my estimate for when I get free time back).

We had to tackle all of these problems when we wrote the NPTL port of
hppa. The TLS changes were for the 4.x gcc branch so we had to fixup
glibc so that it worked with that compiler.

A warning, the following tree is setup to also build the TLS/NPTL
threading code, but the generic sysdeps and math code should be fine to
copy.

http://cvs.parisc-linux.org/glibc/sysdeps/hppa/fpu/

You also must be *very* careful with the fstd, fldd operations since
they are used to "store" and "restore" the state of FPU. This is a
tricky operation since hppa can and does make use of delayed floating
point exceptions (e.g. It might look like it works but if you run the
test again it might fail).

The code I wrote for fesetround was:
---
int
fesetround (int round)
{
  struct { unsigned int sw[2]; } s;

  /* Get the current status word. */
  __asm__ ("fstd %%fr0,0(%1)" : "=m" (s) : "r" (&s) : "%r0");
  s.sw[0] &= ~FE_DOWNWARD;
  s.sw[0] |= round & FE_DOWNWARD;
  __asm__ ("fldd 0(%0),%%fr0" : : "r" (&s), "m" (s) : "%r0");

  return 0;
}
---

Comments:
- Please do not return 1 if the rounding mode is invalid.
  Try as hard as possible to set something reasonable.
- Use a struct where possible for two integers since GCC
  will generally have an easier time following the memory.
- These are double word stores, so you need sw[2].

Again, sorry for not submitting upstream or helping out with the state
of libc6 for hppa. I'm damned busy. I hope for this state to change with
the completion of my thesis. 

Cheers,
Carlos




Reply to: