History log of /freebsd-10.1-release/lib/libc/sparc64/
Revision Date Author Comments
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


263763 26-Mar-2014 dim

MFC r262613:

Merge the projects/clang-sparc64 branch back to head. This brings in
several updates from the llvm and clang trunks to make the sparc64
backend fully functional.

Apart from one patch to sys/sparc64/include/pcpu.h which is still under
discussion, this makes it possible to let clang fully build world and
kernel for sparc64.

Any assistance with testing this on actual sparc64 hardware is greatly
appreciated, as there will unavoidably be bugs left.

Many thanks go to Roman Divacky for his upstream work on getting the
sparc64 backend into shape.

MFC r262985:

Repair a few minor mismerges from r262261 in the clang-sparc64 project
branch. This is also to minimize differences with upstream.


261455 04-Feb-2014 eadler

MFC r258779,r258780,r258787,r258822:

Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit. Instead use (1U << 31) which gets the
expected result.

Similar to the (1 << 31) case it is not defined to do (2 << 30).

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.


256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


253266 12-Jul-2013 marius

Prefix the alias macros for members of struct __mcontext with an underscore
in order to avoid a clash in the net80211 code.


251047 28-May-2013 kib

The getcontext() from the __fillcontextx() call in the
check_deferred_signal() returns twice, since handle_signal() emulates
the return from the normal signal handler by sigreturn(2)ing the
passed context. Second return is performed on the destroyed stack
frame, because __fillcontextx() has already returned. This causes
undefined and bad behaviour, usually the victim thread gets SIGSEGV.

Avoid nested frame and the need to return from it by doing direct call
to getcontext() in the check_deferred_signal() and using a new private
libc helper __fillcontextx2() to complement the context with the
extended CPU state if the deferred signal is still present.

The __fillcontextx() is now unused, but is kept to allow older
libthr.so to be used with the new libc.

Mark __fillcontextx() as returning twice [1].

Reported by: pgj
Pointy hat to: kib
Discussed with: dim
Tested by: pgj, dim
Suggested by: jilles [1]
MFC after: 1 week


246117 30-Jan-2013 kib

Rework the __vdso_* symbols attributes to only make the symbols weak,
but use normal references instead of weak. This makes the statically
linked binaries to use fast gettimeofday(2) by forcing the linker to
resolve references and providing the neccessary functions.

Reported by: bde
Tested by: marius (sparc64)
MFC after: 2 weeks


230864 01-Feb-2012 kib

Make the sys/ucontext.h self-contained by changing the return type
of __getcontextx_size(3) from size_t to int.

PR: ports/164654
MFC after: 1 month


230429 21-Jan-2012 kib

Add API for obtaining extended machine context states that cannot be
fit into existing mcontext_t.

On i386 and amd64 do return the extended FPU states using
getcontextx(3). For other architectures, getcontextx(3) returns the
same information as getcontext(2).

Tested by: pho
MFC after: 1 month


230193 16-Jan-2012 das

Computations on NaNs are supposed to return one of the input NaNs unchanged.
Fix a few places in the sparc64 floating-point emulator where this wasn't
being handled properly.

Submitted by: bde


226606 21-Oct-2011 das

Replace a proliferation of buggy MD implementations of modf() with a
working MI one. The MI one only needs to be overridden on machines
with non-IEEE754 arithmetic. (The last supported one was the VAX.)
It can also be overridden if someone comes up with a faster one that
actually passes the regression tests -- but this is harder than it sounds.


226111 07-Oct-2011 ed

Fix whitespace inconsistencies found in homegrown Symbol.maps.


221869 14-May-2011 attilio

Disconnect sun4v architecture from the three.

Some files keep the SUN4V tags as a code reference, for the future,
if any rewamped sun4v support wants to be added again.

Reviewed by: marius
Tested by: sbruno
Approved by: re


205410 21-Mar-2010 marius

Avoid aliasing which leads to incorrect results when compiling with the
default strict aliasing rules.

PR: 144900
Submitted by: Peter Jeremy
MFC after: 3 days


205397 20-Mar-2010 marius

- While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
UltraSPARC processors defines that in all cases tinyness is detected
before rounding, therefore rounding up to the smallest normalised
number should set the underflow flag.
- If an infinite result is rounded down, the result should have an
exponent 1 less than the value for infinity.

PR: 144900
Submitted by: Peter Jeremy
MFC after: 3 days


205396 20-Mar-2010 marius

Division should take both arguments' signs into account when the
the dividend is infinity or zero and the divisor is not the same.

PR: 144900
Submitted by: Peter Jeremy
MFC after: 3 days


205395 20-Mar-2010 marius

FPU_DEBUG requires <stdio.h>.

PR: 144900
Submitted by: Peter Jeremy
MFC after: 3 days


205394 20-Mar-2010 marius

Ensure that __fpu_ftox() both returns the high bits and res[1] contains
the low bits also in the default case.

PR: 144900
Obtained from: OpenBSD
MFC after: 3 days


205393 20-Mar-2010 marius

- Remove a bogus forward declaration.
- Fix whitespace.


205002 11-Mar-2010 marius

Fix a typo in r204974 so that FTYPE_LNG matches the initialisers of
the opmask array.

Pointed out by: Peter Jeremy


204974 10-Mar-2010 marius

- The OPSZ macro actually only does the right thing for int32 and int64
operands but not for double and extended double ones. Instead of trying
to fix the macro just nuke it and unroll the loops in the correct way
though as extended double operands turn out to be the only special case.
- For FxTO{s,d,q} the source operand is int64 so rs2 has to be re-decoded
after setting type accordingly as it's generally decoded using the low
2 bits as the type, which are 0 for these three instructions.
- Similarly, in case of F{s,d,q}TOx the target is int64 so rd has to be
re-decoded using not only the operand mask appropriate for int64 but
also the correct register number encoding.
- Use const where appropriate.
- Wrap long lines.

Submitted by: Peter Jeremy (partly)
MFC after: 3 days


204640 03-Mar-2010 joel

The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from: NetBSD


194704 23-Jun-2009 ed

Remove unneeded stdlib directories.

It's not necessary to add stdlib directories for each architecture, even
if the architecture doesn't implement any files of its own.

Submitted by: Christoph Mallon


188031 02-Feb-2009 rdivacky

Provide a type for the argument.

Approved by: kib (mentor)


184789 09-Nov-2008 ed

Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.

Looking at our source code history, it seems the uname(),
getdomainname() and setdomainname() system calls got deprecated
somewhere after FreeBSD 1.1, but they have never been phased out
properly. Because we don't have a COMPAT_FREEBSD1, just use
COMPAT_FREEBSD4.

Also fix the Linuxolator to build without the setdomainname() routine by
just making it call userland_sysctl on kern.domainname. Also replace the
setdomainname()'s implementation to use this approach, because we're
duplicating code with sysctl_domainname().

I wasn't able to keep these three routines working in our
COMPAT_FREEBSD32, because that would require yet another keyword for
syscalls.master (COMPAT4+NOPROTO). Because this routine is probably
unused already, this won't be a problem in practice. If it turns out to
be a problem, we'll just restore this functionality.

Reviewed by: rdivacky, kib


178139 12-Apr-2008 das

Fix some bugs that caused sparc64's quad precision sqrt to get
the wrong answer for virtually all inputs.

Thanks to remko for access to a sparc64 box for testing.


178138 12-Apr-2008 das

Make the software emulator for long doubles set the FPU exception
flags appropriately. The next step is to make it raise a SIGFPE if
any exceptions are unmasked.

Thanks to remko for access to a sparc64 box for testing.


175459 18-Jan-2008 das

Add a new union member to access the exponent and sign of a long double
in a single op. Idea from bde.


174759 18-Dec-2007 das

Since nan() is supposed to work the same as strtod("nan(...)", NULL),
my original implementation made both use the same code. Unfortunately,
this meant libm depended on a vendor header at compile time and previously-
unexposed vendor bits in libc at runtime.

Hence, I just wrote my own version of the relevant vendor routine. As it
turns out, mine has a factor of 8 fewer of lines of code, and is a bit more
readable anyway. The strtod() and *scanf() routines still use vendor code.

Reviewed by: bde


174681 16-Dec-2007 das

Export gdtoa's __ULto{x,Q}_D2A routine in a private namespace so
libm can use it.


174680 16-Dec-2007 das

Arrange so that the NaN returned by strtod("nan", NULL) is the same as
the NaN returned by strtod("nan()", NULL).


174204 03-Dec-2007 das

In scanf, round according to the current rounding mode.


173859 23-Nov-2007 jb

Use an intermediate pointer to avoid a strict aliasing warning.


171218 04-Jul-2007 peter

Classify mmap, lseek, pread, pwrite, truncate, ftruncate as pseudo
syscalls, unless WITHOUT_SYSCALL_COMPAT is defined. The default case
will have the .c wrappers still. If you define WITHOUT_SYSCALL_COMPAT,
the .c wrappers will go away and libc will make direct syscalls.

After 7-stable starts, the direct syscall method will be default.

Approved by: re (kensmith)


171217 04-Jul-2007 peter

Adjust the syscall stub macros to be consistent in their meaning. In
particular:
SYSCALL() makes a syscall, with errno handling, and continues execution
directly after the macro in the non-error case.
RSYSCALL() is just like SYSCALL(), but returns after success.
Both SYSCALL(name) and RSYSCALL(name) export "__sys_name" as a strong
symbol, with "_name" and "name" as weak aliases.
PSEUDO() is just like RSYSCALL(), but skipping the "name" weak alias. It
still does "__sys_name" and "_name".

Change i386 to add errno handling to PSEUDO. The same for amd64 and
sparc64, with appear to have copied the behavior.
ia64 was correct (as was alpha). Just remove some apparently unused
variants of the macros. (untested!)
I believe powerpc is correct.
Fix arm to not export "name" from the PSEUDO case. Remove apparently
extra unused variants. (untested!)

The errno problem manifested on i386/amd64/sparc64 by having "PSEUDO"
classified syscalls return without setting errno. eg: "addr = mmap()"
could return with "addr" = 22 instead of setting errno to 22 and
returning -1.

Approved by: re (kensmith)


170154 31-May-2007 deischen

Some libc symbol map cleanups.

net: endhostdnsent is named _endhostdnsent and is
private to netdb family of functions.

posix1e: acl_size.c has been never compiled in,
so there's no "acl_size".

rpc: "getnetid" is a static function.

stdtime: "gtime" is #ifdef'ed out in the source.

some symbols are specific only to some architectures,
e.g., ___tls_get_addr is only defined on i386.

__htonl, __htons, __ntohl and __ntohs are no longer
functions, they are now (internal) defines in
<machine/endian.h>.

Submitted by: ru


169488 11-May-2007 marius

- Add bits for userland profiling. For sun4u this is compile-tested only.
- Replace magic 14 with PIL_TICK.


169092 29-Apr-2007 deischen

Use C comments since we now preprocess these files with CPP.


165903 09-Jan-2007 imp

Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.


165747 03-Jan-2007 das

The distinction between quiet and signaling NaN formats is
machine-dependent; these files tell the latest version of gdtoa
what to do.


165529 24-Dec-2006 marius

Fix a typo in __fpu_ftox() that caused long double to long (and long long)
conversion of negative numbers to always result in -1.
While at it, rearrange the nearby comment so it fits in 80 chars per line,
like the rest of this file does.

PR: 107130
MFC after: 1 day


164053 06-Nov-2006 cognet

Instead of re-implementing hton[ls] and friends for each arch, add a new MI
file, net/ntoh.c, which just implement them using the inline functions from
<sys/endian.h>.

Suggested by: bde


163967 03-Nov-2006 kmacy

- change ABI for user trap handler for sun4v (eventually will sync sparc64 no
hardware set up to test at the moment)

Approved by: scottl (standing in for mentor rwatson)


163258 12-Oct-2006 kmacy

fix bus error in newsyslog by making sure that fields in struct fpemu
that are accessed as 8 byte quantities are 8 byte aligned


163118 08-Oct-2006 kmacy

Fix TLS on sparc64 for statically and dynamically linked binaries
Approved by: rwatson (mentor)
Reviewed by: jmg and marcel


157791 16-Apr-2006 marius

For _Qp_{fge,fgt,fle,flt}() the SCD states that "Exceptions mimic fcmpeq",
this means they should set the cmpe flag when calling __fpu_compare().

Submitted by: stefanf
MFC after: 2 weeks


157666 11-Apr-2006 marius

- Move _Qp_* and __dtoul from FBSDprivate to the list of FBSD_1.0 symbols
as well as add __sparc_utrap_install to FBSD_1.0; these are required by
the SCD libc 64 psABI and thus meant to be officially exported symbols.
- Remove the __fpu_* entries as well as the __sigtramp entry altogether as
these are internal to the libc FPU emulation and the signal trampoline
initialization in sigaction(2) respectively and thus don't need to be
externally visible.
- Add __sparc_utrap_setup to the list of FBSDprivate symbols as it's used
in src/lib/csu/sparc64/crt1.c to initialize the libc FPU emulation (I
think alternatively src/lib/csu/sparc64/crt1.c could be changed to use
__sparc_utrap_install instead, at the expense of increasing the size of
executables a bit).
- Add an entry for the vfork symbol to the FBSD_1 list and entries for it's
associated symbols generated by the RSYSCALL() macro to the FBSDprivate
list. There's some magic in place that automatically generates code for
vfork() if there's no explicit MD code for it so it might make sense to
move these symbols from the MD symbol map files to a MI one.

The last two changes make the libc symbol versioning useable on sparc64.

Ok'ed by: deischen


156769 16-Mar-2006 ru

Desupport the undocumented NO_QUAD option, just don't compile
the quad support on 64-bit platforms.


156613 13-Mar-2006 deischen

Add each directory's symbol map file to SYM_MAPS.


156608 13-Mar-2006 deischen

Add symbol maps and initial symbol version definitions to libc.

Reviewed by: davidxu


147519 21-Jun-2005 stefanf

Add the functions _Qp_cmp() and _Qp_cmpe() as described in the Sparc
Compliance Definition. On sparc64, GCC emits _Qp_cmp() calls for its
__builtin_isfoo() functions which are used for C99's isfoo() macros.

Approved by: re(dwhite)
PR: 73782


146673 27-May-2005 stefanf

Fix long (and long long) to long double, unsigned to long double and unsigned
long (and unsigned long long) to long double conversions.
- Add a parameter that specifies the position of the sign bit to the _QP_TTOQ
macro, previously it always looked at bit 31. Pass a negative number to
disable sign inspection for unsigned types. This fixes _Qp_xtoq(),
_Qp_uitoq() and _Qp_uxtoq().
- In the functions __fpu_itof() and __fpu_xtof(), look at the sign bit to
decide whether we're doing a conversion from an unsigned type. If so, don't
negate the mantissa if the integer exceeds the biggest signed number.

PR: 55773
Patch by: Stephen Paskaluk (based upon)
MFC after: 2 weeks


143658 15-Mar-2005 das

Remove fpsetsticky(). This was added for SysV compatibility, but due
to mistakes from day 1, it has always had semantics inconsistent with
SVR4 and its successors. In particular, given argument M:

- On Solaris and FreeBSD/{alpha,sparc64}, it clobbers the old flags
and *sets* the new flag word to M. (NetBSD, too?)
- On FreeBSD/{amd64,i386}, it *clears* the flags that are specified in M
and leaves the remaining flags unchanged (modulo a small bug on amd64.)
- On FreeBSD/ia64, it is not implemented.

There is no way to fix fpsetsticky() to DTRT for both old FreeBSD apps
and apps ported from other operating systems, so the best approach
seems to be to kill the function and fix any apps that break. I
couldn't find any ports that use it, and any such ports would already
be broken on FreeBSD/ia64 and Linux anyway.

By the way, the routine has always been undocumented in FreeBSD,
except for an MLINK to a manpage that doesn't describe it. This
manpage has stated since 5.3-RELEASE that the functions it describes
are deprecated, so that must mean that functions that it is *supposed*
to describe but doesn't are even *more* deprecated. ;-)

Note that fpresetsticky() has been retained on FreeBSD/i386. As far
as I can tell, no other operating systems or ports of FreeBSD
implement it, so there's nothing for it to be inconsistent with.

PR: 75862
Suggested by: bde


143214 07-Mar-2005 das

Define LDBL_NBIT to be a mask indicating the position of the integer
bit in a long double. For architectures that don't have such a bit,
LDBL_NBIT is 0. This makes it possible to say `mantissa & ~LDBL_NBIT'
in places that previously used an #ifdef to select the right expression.
The optimizer should dispense with the extra arithmetic when LDBL_NBIT
is 0.


141379 06-Feb-2005 das

Update my email address.


140607 22-Jan-2005 das

Replace the ldexp() implementation in libc with a renamed copy of the
scalbn() implementation from libm. (The two functions are defined to
be identical, but ldexp() lives in libc for backwards compatibility.)
The old ldexp() implementation...
- was more complicated than this one
- set errno instead of raising FP exceptions
- got some corner cases wrong
(e.g. ldexp(1.0, 2000) in round-to-zero mode)

The new implementation lives in libc/gen instead of
libc/$MACHINE_ARCH/gen, since we don't need N copies of a
machine-independent file. The amd64 and i386 platforms
retain their fast and correct MD implementations and
override this one.


140424 18-Jan-2005 das

Correct the values of FLT_ROUNDS for the FE_UPWARD and FE_DOWNWARD cases.


140279 15-Jan-2005 das

Eliminate gdtoa.mk and move its contents to ${MACHINE_ARCH}/Makefile.inc.
The purpose of having a separate file involved an abandoned scheme that
would have kept contrib/gdtoa out of the include path for the rest of libc.


136910 24-Oct-2004 ru

For variables that are only checked with defined(), don't provide
any fake value.


133754 15-Aug-2004 dfr

Add support for TLS in statically linked programs.


132755 28-Jul-2004 kan

s/round/fpround/ to avoid naming clash with GCC builtin function.


132366 18-Jul-2004 das

Replace seven nominally MD implementations of frexp() that are broken
for subnormals with one implementation that works.


131852 09-Jul-2004 das

Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify(). This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number. In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5. I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X. At the same time, the new macros
should remain C99-compliant.

The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong. Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.

Prodded by: kris


127091 16-Mar-2004 des

Use unions to avoid violating C99 strict aliasing rules.


125865 16-Feb-2004 das

Fix some aliasing problems.


125669 10-Feb-2004 cperciva

style cleanup: Remove duplicate $FreeBSD$ tags.

These files had tags after teh copyright notice,
inside the comment block (incorrect, removed),
and outside the comment block (correct).

Approved by: rwatson (mentor)


124722 19-Jan-2004 nectar

Add prototypes for the three syscall stubs that are invoked here,
in order to quiet warnings.


124653 18-Jan-2004 das

Define LDBL_MANH_SIZE and LDBL_MANL_SIZE to be the sizes of the
high and low words of the mantissa in bits, respectively.


124342 10-Jan-2004 nectar

We need to discard `const'ness explicitly when invoking sysarch.

Reported by: sparc64 tinderbox via bde


124296 09-Jan-2004 nectar

Provide sysarch(2) prototypes in the MD sysarch.h headers. While I'm
at it, use the ANSI C generic pointer type for the second argument,
thus matching the documentation.

Remove the now extraneous (and now conflicting) function declarations
in various libc sources. Remove now unnecessary casts.

Reviewed by: bde


124182 06-Jan-2004 nectar

Remove unused variables. Add required headers and function
declarations.


122883 18-Nov-2003 jake

Install the user trap handlers that libc provides from a constructor, so
that they will be installed before application constructors are invoked.
Its possible to link applications such that this fails, application code
is invoked before they are installed, but, well, Don't Do That.

Approved by: re (jhb)


118771 11-Aug-2003 bms

Add the mlockall() and munlockall() system calls.
- All those diffs to syscalls.master for each architecture *are*
necessary. This needed clarification; the stub code generation for
mlockall() was disabled, which would prevent applications from
linking to this API (suggested by mux)
- Giant has been quoshed. It is no longer held by the code, as
the required locking has been pushed down within vm_map.c.
- Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES
to express their intention explicitly.
- Inspected at the vmstat, top and vm pager sysctl stats level.
Paging-in activity is occurring correctly, using a test harness.
- The RES size for a process may appear to be greater than its SIZE.
This is believed to be due to mappings of the same shared library
page being wired twice. Further exploration is needed.
- Believed to back out of allocations and locks correctly
(tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC).

PR: kern/43426, standards/54223
Reviewed by: jake, alc
Approved by: jake (mentor)
MFC after: 2 weeks


118655 08-Aug-2003 jake

Implement signalcontext.


114839 08-May-2003 das

Add a comment describing why it's important for the values in this
file to be correct, and how to generate them automatically.

Caused much pain and suffering for: peter


113145 05-Apr-2003 das

Add __ldtoa(), a wrapper around gdtoa() to make it look like dtoa().
In support of this, add some MD macros to assist in converting long
doubles to the format expected by gdtoa().

Reviewed by: silence on standards@


112963 01-Apr-2003 jake

Implement makecontext.


112163 12-Mar-2003 das

Replace our ancient dtoa/strtod implementation with the gdtoa
package, a more recent, generalized set of routines. Among the
changes:
- Declare strtof() and strtold() in stdlib.h.
- Add glue to libc to support these routines for all kinds
of ``long double''.
- Update printf() to reflect the fact that dtoa works slightly
differently now.

As soon as I see that nothing has blown up, I will kill
src/lib/libc/stdlib/strtod.c. Soon printf() will be able
to use the new routines to output long doubles without loss
of precision, but numerous bugs in the existing code must
be addressed first.

Reviewed by: bde (briefly), mike (mentor), obrien


110769 12-Feb-2003 mike

o Implement C99 classification macros isfinite(), isinf(), isnan(),
isnormal(). The current isinf() and isnan() are perserved for
binary compatibility with 5.0, but new programs will use the macros.
o Implement C99 comparison macros isgreater(), isgreaterequal(),
isless(), islessequal(), islessgreater(), isunordered().

Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>


110566 08-Feb-2003 mike

Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)


108738 05-Jan-2003 tmm

Rewrite longjmp() and _longjmp() to directly restore the saved frame,
instead of unwinding the call stack. This makes them usable to switch
stacks, e.g. for libc_r.
Do not save the frame pointer in setjmp() and _setjmp(), it is not needed
any more.
Rename _longjmp() to ___longjmp(), with a weak alias to _longjmp(), like
the other architectures did.


108736 05-Jan-2003 tmm

Rename siglongjmp() to __siglongjmp(), with a weak alias to siglongjmp(),
like the other architectures do.


107052 18-Nov-2002 ru

libc_r wasn't so tied to libc for 22 months.


106268 31-Oct-2002 archie

Re-apply the previously backed-out commit that fixes the problem where
HUGE_VAL is not properly aligned on some architectures. The previous
fix now works because the two versions of 'math.h' (include/math.h
and lib/msun/src/math.h) have since been merged into one.

PR: bin/43544


105709 22-Oct-2002 jake

Rename the libc signal trampoline to __sigtramp to match netbsd. This
should allow gdb to detect when we're executing in a signal trampoline.


103686 20-Sep-2002 archie

Revert previous commit to unbreak world until we figure out the
right way to do it.


103653 19-Sep-2002 archie

Fix a problem with the definition of HUGE_VAL causing the gcc warning
"cast increases required alignment of target type" on some platforms.

Reviewed by: bde


103324 14-Sep-2002 tmm

Use the macros from machine/fsr.h; some minor cleanups.


103323 14-Sep-2002 tmm

Add implementations of fpgetmask(), fpgetround(), fpgetsticky(),
fpsetround(), fpsetsticky(), obtained from NetBSD and tweaked a little
to use definitions from machine/fsr.h instead of magic numbers.


103296 13-Sep-2002 tmm

Add an implementation of fabs() (which is quite trivial).
When it is called directly, gcc is smart enough to generate inline
code for it, which is why it wasn't noticed before that it was missing.

fabs() would probably better fit into libm, but it has traditionally been
in libc on FreeBSD, so there is probably software around that makes
assumptions about this by now.


102899 03-Sep-2002 jake

Install the userland signal trampoline when sigaction is first called,
instead of on startup. This fixes binary compatibility of dynamically
linked binaries from before the signal code move.

Suggested by: wollman (a long time ago)


102831 02-Sep-2002 jake

Use FOO(a) for macros with variadic args, instead of FOO(a,) or FOO(a, ).

Submitted by: gcc3.2


99773 11-Jul-2002 tmm

Add missing ret instruction to the ptrace() syscall wrapper.


99116 30-Jun-2002 obrien

Use FBSDID


99018 29-Jun-2002 obrien

Use __FBSDID.


99017 29-Jun-2002 obrien

Add frexp(3).

Obtained from: OpenBSD


98373 18-Jun-2002 jake

Remove unneeded include of machine/emul.h.


97823 04-Jun-2002 jake

Implement _Qp_sqrt. I've been unable to find a C program that gcc generates
a call to this for, but apparently somehing in libstdc++ does.


97191 23-May-2002 jake

Generate the normal asm stubs for all sysv system calls. Use these instead
of C wrappers for the *sys indirect system calls. The indirect system calls
are horribly broken on sparc64.

Submitted by: tmm


96548 13-May-2002 jake

Use the right byte order for unaligned stores. <blush>.


96492 13-May-2002 jake

Handle alignment fault fixups in libc rather than in the kernel.


96422 11-May-2002 jake

Add a support macro to convert the 5-bit packed register field of
a floating point instruction into a 6-bit register number for
double and quad arguments.
Make use of the new INSFPdq_RN macro where apporpriate; this
is required for correctly handling the "high" fp registers
(>= %f32).
Fix a number of bugs related to the handling of the high registers
which were caused by using __fpu_[gs]etreg() where __fpu_[gs]etreg64()
should be used (the former can only access the low, single-precision,
registers).

Submitted by: tmm


96129 06-May-2002 obrien

Use __FBSDID


96128 06-May-2002 obrien

We typically don't add trailing /'s.


95745 29-Apr-2002 jake

Add an alternate signal trampoline to libc; add a wrapper for the sigtramp
install sysarch, to be called from _start.

This will allow the stack to be mapped non-executable, as required by the
sparc v9 abi.


95604 28-Apr-2002 jake

Add code to emulate arithmetic, comparison and conversion operations
on long double, which are not implemented in hardware on any UltraSPARC
chip that I know of. This just calls into the existing floating point
emulator, which is still needed to emulate other floating point operations
in certain conditions. Without this gcc has to generate the quad floating
point instructions directly, which sometimes causes internal compiler
errors.

Reviewed by: tmm


95587 27-Apr-2002 jake

Emulate ldq and stq (load/store long double) instructions. GCC has started
using these to load long doubles, but they aren't implemented in hardware
on (at least) UltraSPARC I and II machines.
Emulate popc in the user trap handler as well.
Re-arrange slightly to make support functions more accessible.

Reviewed by: tmm


94254 09-Apr-2002 jake

Rename some fields in struct frame to be compatible with NetBSD/OpenBSD,
and add some compatibility defines. Add fields for ins and locals to
struct reg also for the same reason; these aren't filled in yet because
getting at those registers sucks and I'd rather not save them in the
trapframe just for this. Reorder struct reg to be ABI compatible as
well. Add needed include of machine/emul.h.

This gets pmdb (poor man's debugger) from OpenBSD mostly compiling but it
doesn't work yet :(


93913 06-Apr-2002 tmm

htonl() and ntohl() operate on unsinged types, so they must zero-extend,
not sign-extend. Fix a comment in the former to that effect, and change
the latter over to do the right conversion.


92991 22-Mar-2002 obrien

Fix the style of the SCM ID's.
I believe have made all of libc .h's as consistent as possible.


92986 22-Mar-2002 obrien

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.


92942 22-Mar-2002 obrien

SCM ID tweak.


92905 21-Mar-2002 obrien

Remove __P() usage.


92889 21-Mar-2002 obrien

Remove 'register' keyword.


92055 11-Mar-2002 tmm

Fix some bugs that would prevent %fsr to be set correctly, and add
support for fcmp and fcmpe instructions with a condition code
specification other than %fcc0.
This (primarily the first part) seems to fix a lot of problems that
people were seeing, e.g. perl and gawk failures.

Reported and analyzed by: wollman


92054 11-Mar-2002 tmm

Account for <machine/fsr.h> no longer being usable for assembler code.


92053 11-Mar-2002 tmm

Fix __dtoul to work on sparc64 (it used a half-way v8 stack layout),
and make it PIC-aware.


92049 11-Mar-2002 tmm

Save/restore the %y register around calls to the C user trap handler;
gcc emits the deprecated sparc v8 instructions that use this register
when optimizing for UltraSparc machines because they are apparetly
faster then their v9 counterpars there.


91663 05-Mar-2002 jake

Add fpsetmask(). Needed to build miniperl.

Obtained from: netbsd


91662 05-Mar-2002 jake

Fix a bug where siglongjmp would clobber the argument to return from
sigsetjmp. It would return the value of the signal flag, instead.

Pointy hat to: jake


91649 05-Mar-2002 tmm

Connect the sparc64 userland fp emulator to the build.


91174 23-Feb-2002 tmm

Add userland floating point emulator code for sparc64. This is a port
of the (never committed) in-kernel version (with some optimizations and
cleanups), which in turn was ported from NetBSD.


91160 23-Feb-2002 jake

Fix wrong offsets. Add offsets for %fsr and %tstate.

Submitted by: tmm


91159 23-Feb-2002 jake

Add space for %fsr and %tstate to utrapframe. Save them in the generic
user trap entry code. Restore %asi and %ccr from the saved %tstate before
returning to the trapping user code.

Submitted by: tmm


90868 18-Feb-2002 mike

o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
complexities associated with having MD (asm and inline) versions, and
having to prevent exposure of these functions in other headers that
happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on: alpha, i386
Reviewed by: bde, jake, tmm


88795 01-Jan-2002 jake

Connect user trap code to the build.


88794 01-Jan-2002 jake

Add libc side of user trap handling.
Add support for handling floating point disabled traps mostly in userland
for the simple single threaded case. Not yet enabled by default.
Implement __sparc_utrap_install as specified by the sparc abi.


88614 29-Dec-2001 jake

Make sure curbrk is well aligned.


88613 29-Dec-2001 jake

Use jmpbuf offsets, not ucontext_t.


88612 29-Dec-2001 jake

Add .register directives for gcc3.
Adapt to jmpbuf no longer being a ucontext_t.
Restore the context "by hand" in longjmp and call sigprocmask, instead
of just using sigreturn.


88611 29-Dec-2001 jake

__infinity is not const.


88610 29-Dec-2001 jake

Add jmpbuf offsets. Remove ucontext offsets.


88609 29-Dec-2001 jake

Add .register directives for gcc3.
Adapt to jmpbuf no longer being a ucontext_t.
Call abort if longjmperror returns.


88608 29-Dec-2001 jake

Include utrap.h for soft trap types.


86562 19-Nov-2001 jake

Actually build new files.

Forgotten by: jake


86536 18-Nov-2001 jake

Need .type and .size here too.


86535 18-Nov-2001 jake

Add more libc stuff.

Obtained from: netbsd


86534 18-Nov-2001 jake

Catch up to jmpbuf changes. Define offsets used from assmebly language
in another file so that it is easy to see what they are and keep them in
sync with the headers (grafted from the kernel generated assym.s).


86533 18-Nov-2001 jake

Remove fork and vfork wrappers. The kernel does the right thing.


86532 18-Nov-2001 jake

Add .type and .size pseudo-ops to system call macros so that dynamic binaries
will link. They must be used for weak symbols as well as strong ones.


85518 26-Oct-2001 jake

Minimal libc for sparc64.

Reviewed by: obrien