Home | History | Annotate | only in /src/lib/libc/arch/x86_64
History log of /src/lib/libc/arch/x86_64
RevisionDateAuthorComments
 1.8 31-Oct-2021  thorpej Tidy up how __sigaction14_sigtramp.c is added to SRCS.
 1.7 12-Oct-2020  kamil Decorate the x86_64 signal trampoline with CFI attributes easing unwinding

Combine the approach provided by Nikhil Benesch and Andrew Cagney.

Now, the unwinders (in gccgo, backtrace(3), etc) can unwind properly
the stack from a signal handler.

Fixes lib/55719 by Nikhil Benesch
 1.6 15-Jul-2015  pooka Don't include sigtramp or foocontext routines in rumprun mode. They won't
work (since a rump kernel does not provide NetBSD _lwp syscalls nor
signals), but they cause unwanted symbols to be pulled in when the
resulting libc is linked.

problem reported by Robert Gifford on rumpkernel-users
 1.5 17-Jun-2006  uwe G/c KMSRCS and KMINCLUDES now that we have common/lib/libc
 1.4 25-Mar-2004  drochner kill sigcontext passing to signal handlers, we don't have to worry
about compatibility
 1.3 06-Oct-2003  fvdl Userland amd64 siginfo support.
 1.2 10-Jul-2002  thorpej Enable the libc-provided signal trampoline. The old __sigaction14
entry point has been replaced by the new __sigaction14() which is a
wrapper around the __sigaction_sigtramp system call (which is itself
not directly exposed outside of libc).

No shared library version change is necessary; no new symbols
are exposed outside of libc.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.12 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.11 18-Nov-2011  joerg branches: 1.11.6; 1.11.16;
Exploit hidden __cerror
 1.10 23-Nov-2007  dsl branches: 1.10.30;
Reorder the code for i386 and amd64 syscall stubs so that the 'jc' on error
is a forwards jump instead of a backwards jump that a P4 will mispredect (and
probably immediatly get a cache-line miss due to the way the code gets
aligned).
 1.9 08-Mar-2007  ad branches: 1.9.4;
Remove an obsolete comment.
 1.8 09-Mar-2004  drochner Really, there is no need to use the old int0x80 syscall entry just for
getcontext(). There are some registers not properly saved with the
new syscall entry, but these are calee-saved, scratch or meaningless.
It's the setcontext() return path what matters.
 1.7 18-Oct-2003  fvdl Use the int 0x80 path for context system calls.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.5 03-Jun-2002  fvdl Use the syscall insn for system calls. Fix up some assembly to
remove either previously made errors, or to account for the
fact that syscall clobbers %ecx.
 1.4 26-May-2002  wiz Revert previous: .S files are currently compiled with -traditional-cpp,
so __STDC__ is _not_ always defined.
 1.3 26-May-2002  wiz __STDC__ is always defined on NetBSD.
 1.2 14-Jan-2002  thorpej * Add WSYSCALL() to SYS.h, which creates a system call with an
internal name and a weak alias for the name.
* Add a WEAKASM syscall list, and process it.
* Make sysarch() have an internal name (_sysarch()).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.9.4.1 09-Jan-2008  matt sync with HEAD
 1.10.30.1 17-Apr-2012  yamt sync with head
 1.11.16.1 10-Aug-2014  tls Rebase.
 1.11.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 12-Oct-2020  kamil Add CVS Id
 1.1 12-Oct-2020  kamil Decorate the x86_64 signal trampoline with CFI attributes easing unwinding

Combine the approach provided by Nikhil Benesch and Andrew Cagney.

Now, the unwinders (in gccgo, backtrace(3), etc) can unwind properly
the stack from a signal handler.

Fixes lib/55719 by Nikhil Benesch
 1.1 15-Mar-2006  kleink Add strtof(3) and strtold(3); welcome libc 12.137.
 1.1 25-Jan-2006  kleink Add machine-dependent definitions for gdtoa.
 1.3 05-Jun-2011  christos Revert previous and make frach be 0xc0000000 for NAN's generated by strtold()
as suggested by tron.
 1.2 20-Mar-2011  christos branches: 1.2.2;
Add ld formats for the unit-tests.
 1.1 25-Jan-2006  kleink Add machine-dependent definitions for gdtoa.
 1.2.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.19 26-Apr-2019  maya Unify signbitl implementations.
(Unclear why they were different, it was only the comments that
differed)

Add a comment describing why the generic version works for both 80-bit
and 128-bit double.
 1.18 15-Jul-2015  pooka branches: 1.18.16;
Don't include sigtramp or foocontext routines in rumprun mode. They won't
work (since a rump kernel does not provide NetBSD _lwp syscalls nor
signals), but they cause unwanted symbols to be pulled in when the
resulting libc is linked.

problem reported by Robert Gifford on rumpkernel-users
 1.17 15-Jul-2015  pooka Remove "objects built from C sources" comments. Everyone can see
they're built from C sources because the source files end in .c (???)
 1.16 26-Mar-2011  christos add fpgetprec/fpsetprec
 1.15 14-Jan-2010  joerg Move AMD64's bswap64 implementation from libc to src/common and share it
with the kernel.
 1.14 06-Dec-2009  uebayasi Rename ${SRCS.{alpha,arm,...}.gen} to ${LSRCS.{alpha,arm,...}.gen} because
they ended up in ${LSRCS}, not ${SRCS}. ${SRCS.*} namespace will be used
for more useful things. No functional changes intended.
 1.13 03-Jul-2006  drochner build {frexp,ldexp,modf} in the "compat" subtree
(Drop the modf assembler version. We have the same code in libm.)
(Drop the ldexp inline-assembler version. The same code is in libm as
scalbn; the ldexp there is just a wrapper providing error handling.)
 1.12 15-Apr-2005  kleink Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.11 04-Mar-2004  kleink branches: 1.11.6;
* Turn isinf(3) and isnan(3) into C99-style macros.
* Make it possible for ports to override these (i.e., VAX).
* Remove isnanl(), which was internal to libc only.
 1.10 15-Jan-2004  kleink Add C99 fpclassify(), isfinite(), isnormal(), and signbit() macros.
 1.9 28-Oct-2003  matt Fix tpyo. (ieee854 -> ieee754)
 1.8 25-Oct-2003  kleink Add __infinityf and __infinityl, float respectively long double analogs
of __infinity.
 1.7 24-Oct-2003  kleink * Since there is no single portable IEEE 754 format for a long double,
keep a common implementation of isinfl() and isnanl() to be used by
platforms where `long double' == `double'; move others into
machine-dependent code.
* In due course, consider __VFP_FP__ on arm.
 1.6 01-Aug-2003  lukem Rework how dependency generation is performed:

* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
This is a change of behaviour. If a Makefile wants the clean semantics
it must specifically append to CLEANFILES.
Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
 1.5 17-May-2003  thorpej Build _isinfl() and _isnanl().
 1.4 12-May-2003  kleink Rename ieee754_function.c to function_ieee754.c, following the convention
used in exec_format.c, loadfile_format.c, subsys_machdep.c etc.
Per discussion with Christos.
 1.3 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.2 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.11.6.1 19-Apr-2005  tron Pull up revision 1.12 (requested by kleink in ticket #163):
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.
IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.18.16.1 10-Jun-2019  christos Sync with HEAD
 1.5 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.4 04-Apr-2024  riastradh branches: 1.4.2;
amd64 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp

PR lib/57946
 1.3 22-May-2014  uebayasi branches: 1.3.26; 1.3.34;
Put missing END() markers to set ELF symbol size.
 1.2 12-Sep-2013  joerg branches: 1.2.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.1 19-Jun-2001  fvdl branches: 1.1.58; 1.1.64;
Initial commit of x86-64 specific parts of libc.
 1.1.64.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.58.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.3.34.1 23-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #795):

tests/lib/libc/setjmp/Makefile: revision 1.3
distrib/sets/lists/debug/mi: revision 1.425
lib/libc/arch/sh3/gen/setjmp.S: revision 1.12
lib/libc/arch/i386/gen/sigsetjmp.S: revision 1.19
lib/libc/arch/x86_64/gen/__setjmp14.S: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.10
tests/lib/libc/setjmp/t_sigstack.c: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.12
tests/lib/libc/setjmp/t_sigstack.c: revision 1.1
lib/libc/arch/sh3/gen/sigsetjmp.S: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.2
tests/lib/libc/setjmp/t_sigstack.c: revision 1.3
tests/lib/libc/setjmp/t_sigstack.c: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.5
tests/lib/libc/setjmp/t_sigstack.c: revision 1.6
lib/libc/arch/arm/gen/setjmp.S: revision 1.19
tests/lib/libc/setjmp/t_sigstack.c: revision 1.7
tests/lib/libc/setjmp/t_sigstack.c: revision 1.8
tests/lib/libc/setjmp/t_sigstack.c: revision 1.9
lib/libc/arch/i386/gen/setjmp.S: revision 1.18
lib/libc/arch/x86_64/gen/__sigsetjmp14.S: revision 1.4
distrib/sets/lists/tests/mi: revision 1.1306

longjmp(3): Add test for PR lib/57946.

longjmp(3): Paranoia: more error checking in PR lib/57946 test.

longjmp(3): Test signal mask vs stack restore with siglongjmp too.
PR lib/57946

longjmp(3) t_sigstack: Print which entry failed.
PR lib/57946

longjmp(3) t_sigstack: Note aarch64 seems to DTRT.
But only by code inspection; it appears to have another problem: on
re-entry, the signal handler is called on the normal stack, not on
the alternate signal stack.
PR lib/57946

longjmp(3) t_sigstack: Use a sigaltstack per handler entry.
longjmp evidently doesn't reset the state of whether the process is
executing on the alternate signal stack. So when we re-enter the
signal handler, the alternate stack appears to be still in use, and
the system chooses the original stack for the second call to the
signal handler -- which trips our assertion asking to verify that the
signal handler is always using an alternate stack.

Not strictly necessary for the signal handler to use an alternate
stack on re-entry, but this makes it clearer that the signal handler
itself is always using the alternate stack so we can verify that the
interrupted code is _not_ in the signal handler.
With this change, the test now passes on aarch64.
PR lib/57946

longjmp(3) t_sigstack: Fix fencepost error.
Extremely unlikely to cause trouble, but let's just turn that into
`never' to keep it easier for readers.
PR lib/57946

amd64 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

i386 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

arm longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Move the botched sp and lr tests earlier.
PR lib/57946
arm has been fixed

tests/lib/libc/setjmp/t_sigstack: Add missing comment for 1.10.
PR lib/57946

sh3: siglongjmp - restore register context first (PR lib/57946)
 1.3.26.1 23-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #795):

tests/lib/libc/setjmp/Makefile: revision 1.3
distrib/sets/lists/debug/mi: revision 1.425
lib/libc/arch/sh3/gen/setjmp.S: revision 1.12
lib/libc/arch/i386/gen/sigsetjmp.S: revision 1.19
lib/libc/arch/x86_64/gen/__setjmp14.S: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.10
tests/lib/libc/setjmp/t_sigstack.c: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.12
tests/lib/libc/setjmp/t_sigstack.c: revision 1.1
lib/libc/arch/sh3/gen/sigsetjmp.S: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.2
tests/lib/libc/setjmp/t_sigstack.c: revision 1.3
tests/lib/libc/setjmp/t_sigstack.c: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.5
tests/lib/libc/setjmp/t_sigstack.c: revision 1.6
lib/libc/arch/arm/gen/setjmp.S: revision 1.19
tests/lib/libc/setjmp/t_sigstack.c: revision 1.7
tests/lib/libc/setjmp/t_sigstack.c: revision 1.8
tests/lib/libc/setjmp/t_sigstack.c: revision 1.9
lib/libc/arch/i386/gen/setjmp.S: revision 1.18
lib/libc/arch/x86_64/gen/__sigsetjmp14.S: revision 1.4
distrib/sets/lists/tests/mi: revision 1.1306 (patch)

longjmp(3): Add test for PR lib/57946.

longjmp(3): Paranoia: more error checking in PR lib/57946 test.

longjmp(3): Test signal mask vs stack restore with siglongjmp too.
PR lib/57946

longjmp(3) t_sigstack: Print which entry failed.
PR lib/57946

longjmp(3) t_sigstack: Note aarch64 seems to DTRT.
But only by code inspection; it appears to have another problem: on
re-entry, the signal handler is called on the normal stack, not on
the alternate signal stack.
PR lib/57946

longjmp(3) t_sigstack: Use a sigaltstack per handler entry.
longjmp evidently doesn't reset the state of whether the process is
executing on the alternate signal stack. So when we re-enter the
signal handler, the alternate stack appears to be still in use, and
the system chooses the original stack for the second call to the
signal handler -- which trips our assertion asking to verify that the
signal handler is always using an alternate stack.

Not strictly necessary for the signal handler to use an alternate
stack on re-entry, but this makes it clearer that the signal handler
itself is always using the alternate stack so we can verify that the
interrupted code is _not_ in the signal handler.
With this change, the test now passes on aarch64.
PR lib/57946

longjmp(3) t_sigstack: Fix fencepost error.
Extremely unlikely to cause trouble, but let's just turn that into
`never' to keep it easier for readers.
PR lib/57946

amd64 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

i386 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

arm longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Move the botched sp and lr tests earlier.
PR lib/57946
arm has been fixed

tests/lib/libc/setjmp/t_sigstack: Add missing comment for 1.10.
PR lib/57946

sh3: siglongjmp - restore register context first (PR lib/57946)
 1.4.2.1 02-Aug-2025  perseant Sync with HEAD
 1.5 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.4 04-Apr-2024  riastradh branches: 1.4.2;
amd64 longjmp: Restore stack first, then signal mask.

Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:

- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp

PR lib/57946
 1.3 22-May-2014  uebayasi branches: 1.3.26; 1.3.34;
Put missing END() markers to set ELF symbol size.
 1.2 12-Sep-2013  joerg branches: 1.2.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.1 19-Jun-2001  fvdl branches: 1.1.58; 1.1.64;
Initial commit of x86-64 specific parts of libc.
 1.1.64.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.58.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.3.34.1 23-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #795):

tests/lib/libc/setjmp/Makefile: revision 1.3
distrib/sets/lists/debug/mi: revision 1.425
lib/libc/arch/sh3/gen/setjmp.S: revision 1.12
lib/libc/arch/i386/gen/sigsetjmp.S: revision 1.19
lib/libc/arch/x86_64/gen/__setjmp14.S: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.10
tests/lib/libc/setjmp/t_sigstack.c: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.12
tests/lib/libc/setjmp/t_sigstack.c: revision 1.1
lib/libc/arch/sh3/gen/sigsetjmp.S: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.2
tests/lib/libc/setjmp/t_sigstack.c: revision 1.3
tests/lib/libc/setjmp/t_sigstack.c: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.5
tests/lib/libc/setjmp/t_sigstack.c: revision 1.6
lib/libc/arch/arm/gen/setjmp.S: revision 1.19
tests/lib/libc/setjmp/t_sigstack.c: revision 1.7
tests/lib/libc/setjmp/t_sigstack.c: revision 1.8
tests/lib/libc/setjmp/t_sigstack.c: revision 1.9
lib/libc/arch/i386/gen/setjmp.S: revision 1.18
lib/libc/arch/x86_64/gen/__sigsetjmp14.S: revision 1.4
distrib/sets/lists/tests/mi: revision 1.1306

longjmp(3): Add test for PR lib/57946.

longjmp(3): Paranoia: more error checking in PR lib/57946 test.

longjmp(3): Test signal mask vs stack restore with siglongjmp too.
PR lib/57946

longjmp(3) t_sigstack: Print which entry failed.
PR lib/57946

longjmp(3) t_sigstack: Note aarch64 seems to DTRT.
But only by code inspection; it appears to have another problem: on
re-entry, the signal handler is called on the normal stack, not on
the alternate signal stack.
PR lib/57946

longjmp(3) t_sigstack: Use a sigaltstack per handler entry.
longjmp evidently doesn't reset the state of whether the process is
executing on the alternate signal stack. So when we re-enter the
signal handler, the alternate stack appears to be still in use, and
the system chooses the original stack for the second call to the
signal handler -- which trips our assertion asking to verify that the
signal handler is always using an alternate stack.

Not strictly necessary for the signal handler to use an alternate
stack on re-entry, but this makes it clearer that the signal handler
itself is always using the alternate stack so we can verify that the
interrupted code is _not_ in the signal handler.
With this change, the test now passes on aarch64.
PR lib/57946

longjmp(3) t_sigstack: Fix fencepost error.
Extremely unlikely to cause trouble, but let's just turn that into
`never' to keep it easier for readers.
PR lib/57946

amd64 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

i386 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

arm longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Move the botched sp and lr tests earlier.
PR lib/57946
arm has been fixed

tests/lib/libc/setjmp/t_sigstack: Add missing comment for 1.10.
PR lib/57946

sh3: siglongjmp - restore register context first (PR lib/57946)
 1.3.26.1 23-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #795):

tests/lib/libc/setjmp/Makefile: revision 1.3
distrib/sets/lists/debug/mi: revision 1.425
lib/libc/arch/sh3/gen/setjmp.S: revision 1.12
lib/libc/arch/i386/gen/sigsetjmp.S: revision 1.19
lib/libc/arch/x86_64/gen/__setjmp14.S: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.10
tests/lib/libc/setjmp/t_sigstack.c: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.12
tests/lib/libc/setjmp/t_sigstack.c: revision 1.1
lib/libc/arch/sh3/gen/sigsetjmp.S: revision 1.11
tests/lib/libc/setjmp/t_sigstack.c: revision 1.2
tests/lib/libc/setjmp/t_sigstack.c: revision 1.3
tests/lib/libc/setjmp/t_sigstack.c: revision 1.4
tests/lib/libc/setjmp/t_sigstack.c: revision 1.5
tests/lib/libc/setjmp/t_sigstack.c: revision 1.6
lib/libc/arch/arm/gen/setjmp.S: revision 1.19
tests/lib/libc/setjmp/t_sigstack.c: revision 1.7
tests/lib/libc/setjmp/t_sigstack.c: revision 1.8
tests/lib/libc/setjmp/t_sigstack.c: revision 1.9
lib/libc/arch/i386/gen/setjmp.S: revision 1.18
lib/libc/arch/x86_64/gen/__sigsetjmp14.S: revision 1.4
distrib/sets/lists/tests/mi: revision 1.1306 (patch)

longjmp(3): Add test for PR lib/57946.

longjmp(3): Paranoia: more error checking in PR lib/57946 test.

longjmp(3): Test signal mask vs stack restore with siglongjmp too.
PR lib/57946

longjmp(3) t_sigstack: Print which entry failed.
PR lib/57946

longjmp(3) t_sigstack: Note aarch64 seems to DTRT.
But only by code inspection; it appears to have another problem: on
re-entry, the signal handler is called on the normal stack, not on
the alternate signal stack.
PR lib/57946

longjmp(3) t_sigstack: Use a sigaltstack per handler entry.
longjmp evidently doesn't reset the state of whether the process is
executing on the alternate signal stack. So when we re-enter the
signal handler, the alternate stack appears to be still in use, and
the system chooses the original stack for the second call to the
signal handler -- which trips our assertion asking to verify that the
signal handler is always using an alternate stack.

Not strictly necessary for the signal handler to use an alternate
stack on re-entry, but this makes it clearer that the signal handler
itself is always using the alternate stack so we can verify that the
interrupted code is _not_ in the signal handler.
With this change, the test now passes on aarch64.
PR lib/57946

longjmp(3) t_sigstack: Fix fencepost error.
Extremely unlikely to cause trouble, but let's just turn that into
`never' to keep it easier for readers.
PR lib/57946

amd64 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use `xorl %eXX,%eXX' instead of `xorq %rXX,%rXX'.
=> Same effect, one byte shorter, breaks dep chain on more uarches.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

i386 longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Tidy the code a little bit.
- Sprinkle comments to explain what's going on.
- Use forward branches for statically predicted not-taken.
=> val==0 is unlikely in longjmp
PR lib/57946

arm longjmp: Restore stack first, then signal mask.
Otherwise, a pending signal may be delivered on the wrong stack when
we restore the signal mask.

While here:
- Move the botched sp and lr tests earlier.
PR lib/57946
arm has been fixed

tests/lib/libc/setjmp/t_sigstack: Add missing comment for 1.10.
PR lib/57946

sh3: siglongjmp - restore register context first (PR lib/57946)
 1.4.2.1 02-Aug-2025  perseant Sync with HEAD
 1.8 02-Apr-2023  skrll Trailing whitespace
 1.7 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.6 02-Jul-2009  joerg branches: 1.6.2;
Fix stack alignment for the thread stack. The AMD64 stack has 16 Bytes
alignment, but this is active before the return address is pushed onto
the stack. Fixes random crashes in va_start when the SSE registers are
saved.
 1.5 01-Jul-2009  joerg Reduce diff to makecontext.
 1.4 28-Apr-2008  martin branches: 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 12-Jun-2005  lukem branches: 1.3.18;
Add missing __RCSID()
 1.2 07-Apr-2003  kleink Make sure we reference getcontext() by its internal name.
 1.1 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.3.18.1 18-May-2008  yamt sync with head.
 1.4.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4.8.1 28-Apr-2008  martin file _lwp.c was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.6.2.1 05-Mar-2011  bouyer Sync with HEAD
 1.2 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.1 19-Jun-2001  fvdl branches: 1.1.64; 1.1.76;
Initial commit of x86-64 specific parts of libc.
 1.1.76.1 10-Aug-2014  tls Rebase.
 1.1.64.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.1 19-Jun-2001  fvdl branches: 1.1.64; 1.1.76;
Initial commit of x86-64 specific parts of libc.
 1.1.76.1 10-Aug-2014  tls Rebase.
 1.1.64.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 14-Jan-2010  joerg Move AMD64's bswap64 implementation from libc to src/common and share it
with the kernel.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 23-Mar-2004  drochner branches: 1.3.62; 1.3.74;
simplify: it doesn't need an i387 to kill a sign bit
 1.2 26-Feb-2004  drochner fix copyback from fp stack - we need 64 bits
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.74.1 10-Aug-2014  tls Rebase.
 1.3.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.6 30-Sep-2011  christos branches: 1.6.8; 1.6.18;
PR/44293: Paul Goyette: Fix the mess of the rounding code.
 1.5 29-Sep-2011  christos even simpler.
 1.4 29-Sep-2011  christos add a simpler version.
 1.3 28-Sep-2011  christos Instead of using a PICGOT relocation for map, use just a pc-relative one
since it is guaranteed to be close enough. Fixes issue with binutils-2.21.1a
(probably a bug).
 1.2 06-Jun-2002  fvdl mov -> lea to access _map table.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.6.18.1 10-Aug-2014  tls Rebase.
 1.6.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 28-Apr-2008  martin branches: 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 02-Feb-2007  christos branches: 1.3.10;
ext_int bit is no more.
 1.2 18-Jan-2004  matt branches: 1.2.16;
Make this compile.
 1.1 28-Oct-2003  kleink C99 7.12.3.1: add IEEE library portions of fpclassify. Don't build these
yet as the VAX implementation is still subject to discussion.
 1.2.16.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.3.10.1 18-May-2008  yamt sync with head.
 1.4.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4.8.1 28-Apr-2008  martin file fpclassifyl.c was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 12-Jun-2002  fvdl branches: 1.3.62; 1.3.74;
Attempt to juggle the 2 seperarate status/mask bit sets for plain FP
and XMM to provide a consistent interface.
 1.2 13-Jan-2002  thorpej Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.74.1 10-Aug-2014  tls Rebase.
 1.3.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.1 26-Mar-2011  christos branches: 1.1.10; 1.1.20;
add fpgetprec/fpsetprec
 1.1.20.1 10-Aug-2014  tls Rebase.
 1.1.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.4 30-Sep-2011  christos branches: 1.4.8; 1.4.18;
PR/44293: Paul Goyette: Fix the mess of the rounding code.
 1.3 12-Jun-2002  fvdl Attempt to juggle the 2 seperarate status/mask bit sets for plain FP
and XMM to provide a consistent interface.
 1.2 13-Jan-2002  thorpej Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4.18.1 10-Aug-2014  tls Rebase.
 1.4.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 12-Jun-2002  fvdl branches: 1.3.62; 1.3.74;
Attempt to juggle the 2 seperarate status/mask bit sets for plain FP
and XMM to provide a consistent interface.
 1.2 13-Jan-2002  thorpej Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.74.1 10-Aug-2014  tls Rebase.
 1.3.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.5 19-Jan-2012  drochner branches: 1.5.6; 1.5.16;
let one bit more through to SSE, to make FP_X_IMP work
 1.4 19-Oct-2011  njoly branches: 1.4.2;
Fix fpsetmask(3) to be able to clear bits previously set.
 1.3 12-Jun-2002  fvdl Attempt to juggle the 2 seperarate status/mask bit sets for plain FP
and XMM to provide a consistent interface.
 1.2 13-Jan-2002  thorpej Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4.2.1 17-Apr-2012  yamt sync with head
 1.5.16.1 10-Aug-2014  tls Rebase.
 1.5.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.1 26-Mar-2011  christos branches: 1.1.10; 1.1.20;
add fpgetprec/fpsetprec
 1.1.20.1 10-Aug-2014  tls Rebase.
 1.1.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.4 30-Sep-2011  christos branches: 1.4.8; 1.4.18;
PR/44293: Paul Goyette: Fix the mess of the rounding code.
 1.3 12-Jun-2002  fvdl Attempt to juggle the 2 seperarate status/mask bit sets for plain FP
and XMM to provide a consistent interface.
 1.2 13-Jan-2002  thorpej Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4.18.1 10-Aug-2014  tls Rebase.
 1.4.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.5 09-Mar-2004  drochner branches: 1.5.62; 1.5.74;
we also have to reset bits in the i387 status
as required
 1.4 05-Mar-2004  drochner -clear status bits in mxcsr as required
-return the old accumulated status bits
 1.3 12-Jun-2002  fvdl Attempt to juggle the 2 seperarate status/mask bit sets for plain FP
and XMM to provide a consistent interface.
 1.2 13-Jan-2002  thorpej Add internal names for fp{get,set}{mask,round,sticky}(), and
externally-visible weak aliases for the internal names.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5.74.1 10-Aug-2014  tls Rebase.
 1.5.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 06-Jun-2011  drochner make sure the infinity returned by HUGE_VALL has the "implicit"
bit set, otherwise it is invalid
This code is unlikely to be hit because gcc (and clang) use
their builtins for these special values.
 1.3 10-Apr-2011  christos branches: 1.3.2;
make infinityl match what gdtoa thinks.
 1.2 12-Jun-2005  lukem Add missing __RCSID()
 1.1 25-Oct-2003  kleink Add __infinityf and __infinityl, float respectively long double analogs
of __infinity.
 1.3.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3 28-Apr-2008  martin branches: 1.3.8;
Remove clause 3 and 4 from TNF licenses
 1.2 02-Feb-2007  christos branches: 1.2.10;
ext_int bit is no more.
 1.1 29-Oct-2003  kleink branches: 1.1.16;
C99 7.12.3.2: add library portions of isfinite, but don't build these just
yet.
 1.1.16.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.2.10.1 18-May-2008  yamt sync with head.
 1.3.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.8.1 28-Apr-2008  martin file isfinitel.c was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.2 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.6 02-Feb-2007  christos ext_int bit is no more.
 1.5 04-Mar-2004  kleink branches: 1.5.16;
* Turn isinf(3) and isnan(3) into C99-style macros.
* Make it possible for ports to override these (i.e., VAX).
* Remove isnanl(), which was internal to libc only.
 1.4 27-Oct-2003  kleink Err, rename some members added in previous to make them reflect their
semantics better.
 1.3 27-Oct-2003  kleink Retire local union { floating-type; struct ieee_prec; } in favor of those
available from <machine/ieee.h>
 1.2 25-Oct-2003  kleink Sync with i386:
Update to account for separate handling of the explicit integer bit;
simplifies a little.
 1.1 24-Oct-2003  kleink * Since there is no single portable IEEE 754 format for a long double,
keep a common implementation of isinfl() and isnanl() to be used by
platforms where `long double' == `double'; move others into
machine-dependent code.
* In due course, consider __VFP_FP__ on arm.
 1.5.16.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.2 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.8 05-Jun-2011  christos Revert previous and make frach be 0xc0000000 for NAN's generated by strtold()
as suggested by tron.
 1.7 04-Jun-2011  christos Make NAN tests consistent with other platforms and FreeBSD.
 1.6 02-Feb-2007  christos branches: 1.6.34;
ext_int bit is no more.
 1.5 04-Mar-2004  kleink branches: 1.5.16;
* Turn isinf(3) and isnan(3) into C99-style macros.
* Make it possible for ports to override these (i.e., VAX).
* Remove isnanl(), which was internal to libc only.
 1.4 27-Oct-2003  kleink Err, rename some members added in previous to make them reflect their
semantics better.
 1.3 27-Oct-2003  kleink Retire local union { floating-type; struct ieee_prec; } in favor of those
available from <machine/ieee.h>
 1.2 25-Oct-2003  kleink Sync with i386:
Update to account for separate handling of the explicit integer bit;
simplifies a little.
 1.1 24-Oct-2003  kleink * Since there is no single portable IEEE 754 format for a long double,
keep a common implementation of isinfl() and isnanl() to be used by
platforms where `long double' == `double'; move others into
machine-dependent code.
* In due course, consider __VFP_FP__ on arm.
 1.5.16.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.6.34.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3 03-Jul-2006  drochner replaced by code in libc/compat/gen
 1.2 30-Dec-2001  thorpej Fix -Wshadow warnings.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 30-Jul-2009  dsl If SRCS contains any .S files then remove the corresponding .c file from
SRCS and add to LSRCS (for lint).
Change the 'string' Makefiles so that the arch/*/string/Makefile.inc
need only specify the .S files for that architecture and not the .c
files for all the files they don't override.
 1.3 28-Apr-2008  martin branches: 1.3.8;
Remove clause 3 and 4 from TNF licenses
 1.2 28-Feb-2004  drochner branches: 1.2.30;
Get the stack alignment right: the stack arguments must start
at a 16-byte aligned address, the return address is at an
"odd" address.
approved by fvdl
 1.1 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.2.30.1 18-May-2008  yamt sync with head.
 1.3.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.8.1 28-Apr-2008  martin file makecontext.c was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.4 03-Jul-2006  drochner build {frexp,ldexp,modf} in the "compat" subtree
(Drop the modf assembler version. We have the same code in libm.)
(Drop the ldexp inline-assembler version. The same code is in libm as
scalbn; the ldexp there is just a wrapper providing error handling.)
 1.3 16-Aug-2003  fvdl Return the right value for modf(). Fixes PR 22503.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 22-Feb-2009  martin Make NAN a compile time constant (with help from the compiler). Suggested
by krister. Fixes PR 40695.
Make references to the old construct (which we can't remove for binary
compatibility reasons) emit a linker warning.
 1.3 15-Apr-2005  kleink branches: 1.3.2; 1.3.32;
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.2 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.32.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.3.2.2 19-Apr-2005  tron Pull up revision 1.3 (requested by kleink in ticket #163):
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.
IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.3.2.1 15-Apr-2005  tron file nanf.c was added on branch netbsd-3 on 2005-04-19 12:30:51 +0000
 1.7 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.6 22-May-2014  uebayasi branches: 1.6.36;
Put missing END() markers to set ELF symbol size.
 1.5 12-Sep-2013  joerg branches: 1.5.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.4 28-Apr-2008  martin branches: 1.4.4; 1.4.8; 1.4.28;
Remove clause 3 and 4 from TNF licenses
 1.3 08-Nov-2006  drochner branches: 1.3.16;
-check for a NULL uc_link before calling setcontext(2); do a real exit(3)
instead with exit handlers and all that
-If setcontext(2) returns (which it shouldn't), do an _exit(-1) rather
than relying on a sensible return value to use as exit code. Makes
it less likely that an ucontext corruption goes unnoticed.
 1.2 27-Feb-2004  drochner alignment trouble: uc_link is at offset 8
 1.1 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.3.16.1 18-May-2008  yamt sync with head.
 1.4.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4.8.1 28-Apr-2008  martin file resumecontext.S was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.4.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.6.36.1 02-Aug-2025  perseant Sync with HEAD
 1.3 26-Apr-2019  maya Unify signbitl implementations.
(Unclear why they were different, it was only the comments that
differed)

Add a comment describing why the generic version works for both 80-bit
and 128-bit double.
 1.2 28-Apr-2008  martin branches: 1.2.8; 1.2.64;
Remove clause 3 and 4 from TNF licenses
 1.1 15-Jan-2004  kleink branches: 1.1.30;
Add C99 fpclassify(), isfinite(), isnormal(), and signbit() macros.
 1.1.30.1 18-May-2008  yamt sync with head.
 1.2.64.1 10-Jun-2019  christos Sync with HEAD
 1.2.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2.8.1 28-Apr-2008  martin file signbitl.c was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.7 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.6 22-May-2014  uebayasi branches: 1.6.36;
Put missing END() markers to set ELF symbol size.
 1.5 12-Sep-2013  joerg branches: 1.5.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.4 12-Apr-2007  pooka branches: 1.4.36; 1.4.42;
Don't clobber callee save registers r12 & r13 in swapcontext. They
were saved in the stack, but the subsequent swapcontext would return
to the earlier stack frame and never restore them. Fixes puffs
with default compiler flags on amd64.

Thanks to Mihai Chelaru for providing access to an amd64 machine
for debugging this problem.
 1.3 01-Dec-2004  ws branches: 1.3.2; 1.3.10;
Use correct stack offsets after pushing values onto it.
 1.2 07-Apr-2003  kleink branches: 1.2.2; 1.2.4;
Make sure we reference getcontext() by its internal name.
 1.1 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.2.4.1 07-Jan-2005  jdc Pull up revision 1.3 (requested by hira in ticket #1029).

Use correct stack offsets after pushing values onto it.
 1.2.2.1 07-Jan-2005  jdc Pull up revision 1.3 (requested by hira in ticket #1029).

Use correct stack offsets after pushing values onto it.
 1.3.10.1 07-May-2007  snj Pull up following revision(s) (requested by pooka in ticket #605):
lib/libc/arch/x86_64/gen/swapcontext.S: revision 1.4
Don't clobber callee save registers r12 & r13 in swapcontext. They
were saved in the stack, but the subsequent swapcontext would return
to the earlier stack frame and never restore them. Fixes puffs
with default compiler flags on amd64.
Thanks to Mihai Chelaru for providing access to an amd64 machine
for debugging this problem.
 1.3.2.1 27-May-2007  bouyer Pull up following revision(s) (requested by pooka in ticket #1772):
lib/libc/arch/x86_64/gen/swapcontext.S: revision 1.4
Don't clobber callee save registers r12 & r13 in swapcontext. They
were saved in the stack, but the subsequent swapcontext would return
to the earlier stack frame and never restore them. Fixes puffs
with default compiler flags on amd64.
Thanks to Mihai Chelaru for providing access to an amd64 machine
for debugging this problem.
 1.4.42.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.36.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.6.36.1 02-Aug-2025  perseant Sync with HEAD
 1.3 06-Dec-2009  uebayasi Rename ${SRCS.{alpha,arm,...}.gen} to ${LSRCS.{alpha,arm,...}.gen} because
they ended up in ${LSRCS}, not ${SRCS}. ${SRCS.*} namespace will be used
for more useful things. No functional changes intended.
 1.2 01-Aug-2003  lukem Rework how dependency generation is performed:

* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
This is a change of behaviour. If a Makefile wants the clean semantics
it must specifically append to CLEANFILES.
Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.6 11-Aug-2009  dsl Change NO_SRCS lines to specify .S in order to exclude the .c file from
SRCS but add it to LSRCS (sort of makes sense!).
 1.5 31-Jul-2009  dsl Add the 'abs', 'div' and 'erand48' sources to stdlib/Makefile.inc.
Change the arch files only include the .S files.
This adds imaxdiv() to some archs where it was missing.
 1.4 04-Aug-2008  matt branches: 1.4.6;
Add C99 functions imaxabs and imaxdiv.
 1.3 22-Mar-2006  drochner branches: 1.3.20;
build erand48_ieee754.c on everything but vax
 1.2 01-Aug-2003  lukem Rework how dependency generation is performed:

* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
This is a change of behaviour. If a Makefile wants the clean semantics
it must specifically append to CLEANFILES.
Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.20.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.6.2 04-Aug-2008  matt Add C99 functions imaxabs and imaxdiv.
 1.4.6.1 04-Aug-2008  matt file Makefile.inc was added on branch christos-time_t on 2008-08-04 21:29:30 +0000
 1.3 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.2 07-Aug-2003  agc branches: 1.2.62; 1.2.74;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2.74.1 10-Aug-2014  tls Rebase.
 1.2.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.1 19-Jun-2001  fvdl branches: 1.1.64; 1.1.76;
Initial commit of x86-64 specific parts of libc.
 1.1.76.1 10-Aug-2014  tls Rebase.
 1.1.64.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.2 04-Aug-2008  matt branches: 1.2.6; 1.2.26; 1.2.38;
Use WEAK_ALIAS.
Add imaxabs weak alias.
 1.1 19-Jun-2001  fvdl branches: 1.1.34;
Initial commit of x86-64 specific parts of libc.
 1.1.34.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.2.38.1 10-Aug-2014  tls Rebase.
 1.2.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 04-Aug-2008  matt Use WEAK_ALIAS.
Add imaxabs weak alias.
 1.2.6.1 04-Aug-2008  matt file labs.S was added on branch christos-time_t on 2008-08-04 20:21:27 +0000
 1.3 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.2 04-Aug-2008  matt branches: 1.2.6; 1.2.26; 1.2.38;
Use WEAK_ALIAS
 1.1 19-Jun-2001  fvdl branches: 1.1.34;
Initial commit of x86-64 specific parts of libc.
 1.1.34.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.2.38.1 10-Aug-2014  tls Rebase.
 1.2.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.2 04-Aug-2008  matt Use WEAK_ALIAS
 1.2.6.1 04-Aug-2008  matt file ldiv.S was added on branch christos-time_t on 2008-08-04 20:26:39 +0000
 1.7 27-Jan-2020  ad Make x86 use the C versions of bcmp() and memcmp().
 1.6 24-Nov-2013  christos branches: 1.6.26;
No need for bzero, memset provides it.
 1.5 23-Nov-2013  jakllsch Remove now-non-existant bzero.S from sources list.
 1.4 30-Jul-2009  dsl branches: 1.4.6; 1.4.12;
If SRCS contains any .S files then remove the corresponding .c file from
SRCS and add to LSRCS (for lint).
Change the 'string' Makefiles so that the arch/*/string/Makefile.inc
need only specify the .S files for that architecture and not the .c
files for all the files they don't override.
 1.3 17-Jul-2009  dsl Change all archs so that strchr.[cS] and strrchr.[cS] exist and generate
duplicate symbols for index() and rindex().
libc and kernel build ok for affected archs (i386, amd64, vax, sun3,
evbmips-eb) all seem ok.
(vax might lose an asm index() - but comments imply it is worse than the C)
 1.2 01-Aug-2003  lukem Rework how dependency generation is performed:

* DPSRCS contains extra dependencies, but is _NOT_ added to CLEANFILES.
This is a change of behaviour. If a Makefile wants the clean semantics
it must specifically append to CLEANFILES.
Resolves PR toolchain/5204.

* To recap: .d (depend) files are generated for all files in SRCS and DPSRCS
that have a suffix of: .c .m .s .S .C .cc .cpp .cxx

* If YHEADER is set, automatically add the .y->.h to DPSRCS & CLEANFILES

* Ensure that ${OBJS} ${POBJS} ${LOBJS} ${SOBJS} *.d depend upon ${DPSRCS}

* Deprecate the (short lived) DEPENDSRCS


Update the various Makefiles to these new semantics; generally either
adding to CLEANFILES (because DPSRCS doesn't do that anymore), or replacing
specific .o dependencies with DPSRCS entries.

Tested with "make -j 8 distribution" and "make distribution".
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.26.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.4 02-Aug-2005  rpaulo Fix typos found by Giorgos Keramid and Steve Kargl on freebsd-arch mailing
list.
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.3 26-Feb-2004  drochner the char we fill with shouldn't be sign-extended
(the way the length argument is dealt with looks suspicious
too, but this would only have an effect for >=2G fields)
this can probably be optimized...
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.4 26-Jul-2004  drochner fix alignment check for source
should fix PR port-amd64/26416 by Nicolas Joly
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.2 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.4 02-Aug-2005  rpaulo Fix typos found by Giorgos Keramid and Steve Kargl on freebsd-arch mailing
list.
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.4 02-Aug-2005  rpaulo Fix typos found by Giorgos Keramid and Steve Kargl on freebsd-arch mailing
list.
 1.3 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 03-Aug-2005  rpaulo branches: 1.3.50; 1.3.62;
Fix another typo in comments found by Ricardo Nabinger Sanchez
on the freebsd-arch mailing list.
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.62.1 10-Aug-2014  tls Rebase.
 1.3.50.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3 20-Dec-2005  christos Use reach-over sources from common/lib/libc
 1.2 19-Jul-2004  drochner replace the str*() functions by speed optimized versions, submitted by
J.T. Conklin per PR port-amd64/25411
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 02-Aug-2005  rpaulo branches: 1.3.50; 1.3.62;
Fix typos found by Giorgos Keramid and Steve Kargl on freebsd-arch mailing
list.
 1.2 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.62.1 10-Aug-2014  tls Rebase.
 1.3.50.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 11-Mar-2006  christos remove files moved to the new compat layout.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.2 03-Jun-2002  fvdl Use the syscall insn for system calls. Fix up some assembly to
remove either previously made errors, or to account for the
fact that syscall clobbers %ecx.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.6 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.5 22-May-2014  uebayasi branches: 1.5.36;
Put missing END() markers to set ELF symbol size.
 1.4 12-Sep-2013  joerg branches: 1.4.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.3 18-Nov-2011  joerg branches: 1.3.6;
Exploit hidden __cerror
 1.2 06-Jun-2002  fvdl branches: 1.2.56;
Fix the EINVAL return path.
 1.1 03-Jun-2002  fvdl Add clone(2) implementation.
 1.2.56.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.56.1 17-Apr-2012  yamt sync with head
 1.3.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.2.1 10-Aug-2014  tls Rebase.
 1.5.36.1 02-Aug-2025  perseant Sync with HEAD
 1.2 11-Mar-2006  christos remove files moved to the new compat layout.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.12 26-Oct-2021  christos Merge all MD __sigaction14_sigtramp.c copies into one:
- sparc and sparc64 were not using version 0 sigcontext when there were
no arguments in the signal version. This was probably a bug.
- vax is using +1 the version numbers of the other archs.
- Only hppa was defining __LIBC12_SOURCE__ so it was getting a working
sigcontext before. all the other ports that supported sigcontext had
the compat code disabled.
[pointed out by thorpej, thanks!]
If we want to remove sigcontext support from userland at least now there
is less work to do so.
 1.11 14-May-2014  uebayasi Whitespace.
 1.10 28-Apr-2008  martin branches: 1.10.8; 1.10.28; 1.10.40;
Remove clause 3 and 4 from TNF licenses
 1.9 19-Feb-2006  christos branches: 1.9.18;
make these consistent.
 1.8 12-Jun-2005  lukem Add missing __RCSID()
 1.7 25-Mar-2004  drochner kill sigcontext passing to signal handlers, we don't have to worry
about compatibility
 1.6 23-Mar-2004  drochner save errno while trying to install a !SA_SIGINFO trampoline -- this
is expected to fail with !COMPAT_16 kernels, and we shouldn't
overwrite errno in this case
 1.5 18-Oct-2003  briggs Need a couple more headers for the last change.
 1.4 18-Oct-2003  briggs Sync with the i386 version.
 1.3 06-Oct-2003  fvdl Userland amd64 siginfo support.
 1.2 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.1 09-Jul-2002  thorpej New __sigaction14() system call stub which registers the signal
trampoline, and the signal trampolines themselves.

NOTE: These are not yet enabled; they will be enabled after further
testing on more architectures.
 1.9.18.1 18-May-2008  yamt sync with head.
 1.10.40.1 10-Aug-2014  tls Rebase.
 1.10.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.8.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10.8.1 28-Apr-2008  martin file __sigaction14_sigtramp.c was added on branch christos-time_t on 2008-04-28 20:22:59 +0000
 1.4 11-Mar-2006  christos remove files moved to the new compat layout.
 1.3 26-Mar-2004  drochner disembowel -- there is no kernel support anyway
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 25-Mar-2004  drochner kill sigcontext passing to signal handlers, we don't have to worry
about compatibility
 1.4 15-Mar-2003  fvdl No need to use movq for the small immediate values here, they'll be
zero-extended with movl.
 1.3 13-Dec-2002  fvdl The fast syscall path clobbers 2 registers. Which is fine for a plain
system call, as long as the stub knows about it. However, it's bad
for sigreturn. Hence, use the old entry point for sigreturn. XXX
 1.2 14-Jul-2002  fvdl Remove fs and gs kludge.
 1.1 09-Jul-2002  thorpej New __sigaction14() system call stub which registers the signal
trampoline, and the signal trampolines themselves.

NOTE: These are not yet enabled; they will be enabled after further
testing on more architectures.
 1.9 19-Oct-2020  kamil Restore RSP from mcontext

Fixes unwinding of multiple frames without base pointer.

Patch by: Nikhil Benesch via PR lib/55719
 1.8 12-Oct-2020  kamil Decorate the x86_64 signal trampoline with CFI attributes easing unwinding

Combine the approach provided by Nikhil Benesch and Andrew Cagney.

Now, the unwinders (in gccgo, backtrace(3), etc) can unwind properly
the stack from a signal handler.

Fixes lib/55719 by Nikhil Benesch
 1.7 02-Dec-2019  christos Add cfi annotations so that gdb can unwind the stack through signal handlers.
 1.6 22-May-2014  uebayasi branches: 1.6.24;
Put missing END() markers to set ELF symbol size.
 1.5 08-Nov-2006  drochner branches: 1.5.48; 1.5.60;
if setcontext(2) returns, _exit(2) with a return code of -1 instead
of relying on a sensible return value
 1.4 23-Mar-2004  drochner replace the last occurence of an "int 0x80" syscall
 1.3 18-Oct-2003  fvdl Use the int 0x80 path for context system calls.
 1.2 17-Oct-2003  fvdl Get ucontext pointer back out of callee-saved register %r15.
 1.1 06-Oct-2003  fvdl Userland amd64 siginfo support.
 1.5.60.1 10-Aug-2014  tls Rebase.
 1.5.48.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.24.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.4 18-Nov-2011  joerg branches: 1.4.6; 1.4.16;
Exploit hidden __cerror
 1.3 07-Aug-2003  agc branches: 1.3.56;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.2 03-Jun-2002  fvdl Use the syscall insn for system calls. Fix up some assembly to
remove either previously made errors, or to account for the
fact that syscall clobbers %ecx.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.56.1 17-Apr-2012  yamt sync with head
 1.4.16.1 10-Aug-2014  tls Rebase.
 1.4.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.5 12-Sep-2013  joerg branches: 1.5.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.4 18-Nov-2011  joerg branches: 1.4.6;
Exploit hidden __cerror
 1.3 07-Aug-2003  agc branches: 1.3.56;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.2 03-Jun-2002  fvdl Use the syscall insn for system calls. Fix up some assembly to
remove either previously made errors, or to account for the
fact that syscall clobbers %ecx.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.56.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.56.1 17-Apr-2012  yamt sync with head
 1.4.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.8 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.7 22-May-2014  uebayasi branches: 1.7.36;
Put missing END() markers to set ELF symbol size.
 1.6 12-Sep-2013  joerg branches: 1.6.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.5 27-Feb-2012  joerg branches: 1.5.2;
Make __cerror protected to restore ABI leak in older libc versions,
where e.g. librt referenced the copy from libc. This still allows libc
to use PC-relative jumps.
 1.4 18-Nov-2011  joerg branches: 1.4.2;
Explicitly mark __cerror as hidden
 1.3 07-Aug-2003  agc branches: 1.3.56;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.2 03-Jun-2002  fvdl Use the syscall insn for system calls. Fix up some assembly to
remove either previously made errors, or to account for the
fact that syscall clobbers %ecx.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.56.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.56.1 17-Apr-2012  yamt sync with head
 1.4.2.1 27-Feb-2012  riz Pull up following revision(s) (requested by joerg in ticket #57):
lib/libc/arch/arm/sys/cerror.S: revision 1.8
lib/libc/arch/vax/SYS.h: revision 1.12
lib/libc/arch/powerpc64/sys/cerror.S: revision 1.3
lib/libc/arch/powerpc64/sys/cerror.S: revision 1.4
lib/libc/arch/i386/sys/cerror.S: revision 1.16
lib/libc/arch/x86_64/sys/cerror.S: revision 1.5
lib/libc/arch/powerpc/sys/cerror.S: revision 1.10
lib/libc/arch/mips/sys/cerror.S: revision 1.17
lib/libc/arch/powerpc/sys/cerror.S: revision 1.9
Make __cerror protected to restore ABI leak in older libc versions,
where e.g. librt referenced the copy from libc. This still allows libc
to use PC-relative jumps.
PowerPC doesn't have CERROR since it never had a.out.
Use _C_LABEL(__cerror) instead.
 1.5.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.2.1 10-Aug-2014  tls Rebase.
 1.7.36.1 02-Aug-2025  perseant Sync with HEAD
 1.5 07-Feb-2017  kamil Mark exect(3) obsolete and bind it to plain execve(2) on all platforms

The original exect(2) from BSD4.2 was enabling bit for tracing
(single-step mode) and calling execve(2). The purpose of it was to generate
a signal for a tracer once the application will change its image to a new
program.

This approach no longer works as:
- exect(2) traces (single-steps) libc and it requires hundreds or
thousands steps before entering a new image
- it's vax and x86 specific code
- this functionality has been moved to the kernel - once a process is
traced it will generate SIGTRAP with si_code TRAP_EXEC and route it to
its debugger
- the side effects and unportability make this interface unusable
- there are no known users of this interface
- it apparently never worked better since day0 of NetBSD ("day0 bug")

Users are requested to move to other execve(2) variants. Calling current
execve(2) as it is the most similar behavior to this one from BSD4.2.

Discussed several times on mailing lists and in PR/51700.

Add warning to exect(3) telling about marking this function obsolete.

This function is prepared to be removed in next libc major bump.

Sponsored by <The NetBSD Foundation>
 1.4 22-May-2014  uebayasi branches: 1.4.6; 1.4.10;
Put missing END() markers to set ELF symbol size.
 1.3 18-Nov-2011  joerg branches: 1.3.6; 1.3.16;
Exploit hidden __cerror
 1.2 07-Aug-2003  agc branches: 1.2.56;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2.56.1 17-Apr-2012  yamt sync with head
 1.3.16.1 10-Aug-2014  tls Rebase.
 1.3.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.10.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.6.1 20-Mar-2017  pgoyette Sync with HEAD
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 07-Aug-2003  agc branches: 1.3.62; 1.3.74;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.2 13-Feb-2003  nathanw Implement pthread_atfork() (in libc, because the required threadlib
stub behavior is exactly the same as the usual behavior).
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.74.1 10-Aug-2014  tls Rebase.
 1.3.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.3 09-Mar-2004  drochner branches: 1.3.62; 1.3.74;
Really, there is no need to use the old int0x80 syscall entry just for
getcontext(). There are some registers not properly saved with the
new syscall entry, but these are calee-saved, scratch or meaningless.
It's the setcontext() return path what matters.
 1.2 18-Oct-2003  fvdl Use the int 0x80 path for context system calls.
 1.1 30-Jan-2003  fvdl Add ucontext glue for x86_64.
 1.3.74.1 10-Aug-2014  tls Rebase.
 1.3.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 11-Mar-2006  christos remove files moved to the new compat layout.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.2 07-Aug-2003  agc branches: 1.2.62; 1.2.74;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2.74.1 10-Aug-2014  tls Rebase.
 1.2.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8 03-May-2025  riastradh libc/x86_64: Omit needless __PIC__ conditionals.

PR lib/59391: unnecessary __PIC__ conditionals clutter .S files
 1.7 19-Mar-2016  christos branches: 1.7.28;
Save and restore all the registers we need instead of playing tricks and
"knowing" which registers the compiler clobbers. gcc-5.3 clobbers both
rcx and rdx...
 1.6 24-Nov-2014  christos Fix ptrace %rcx corruption when pthread_errno() is used. Small example:
#include <sys/types.h>
#include <stdio.h>
#include <sys/ptrace.h>
int main(void) { ptrace(18, getpid(), NULL, 0xabcd); }
The -lpthread cases pases 0 instead of 0xabcd
 1.5 22-May-2014  uebayasi branches: 1.5.2;
Put missing END() markers to set ELF symbol size.
 1.4 12-Sep-2013  joerg branches: 1.4.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.3 18-Nov-2011  joerg branches: 1.3.6;
Exploit hidden __cerror
 1.2 07-Aug-2003  agc branches: 1.2.56;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2.56.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.56.1 17-Apr-2012  yamt sync with head
 1.3.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.2.1 10-Aug-2014  tls Rebase.
 1.5.2.1 25-Nov-2014  martin Pull up following revision(s) (requested by christos in ticket #263):
lib/libc/arch/x86_64/sys/ptrace.S: revision 1.6
Fix ptrace %rcx corruption when pthread_errno() is used. Small example:
#include <sys/types.h>
#include <stdio.h>
#include <sys/ptrace.h>
int main(void) { ptrace(18, getpid(), NULL, 0xabcd); }
The -lpthread cases pases 0 instead of 0xabcd
 1.7.28.1 02-Aug-2025  perseant Sync with HEAD
 1.6 22-May-2014  uebayasi Put missing END() markers to set ELF symbol size.
 1.5 12-Sep-2013  joerg branches: 1.5.2;
Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.4 18-Nov-2011  joerg branches: 1.4.6;
Exploit hidden __cerror
 1.3 02-Jul-2008  rmind branches: 1.3.2; 1.3.6;
Avoid calling a syscall when argument to sbrk(2) is zero.
OK by <ad>.
 1.2 07-Aug-2003  agc branches: 1.2.32;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2.32.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.3.6.2 02-Jul-2008  rmind Avoid calling a syscall when argument to sbrk(2) is zero.
OK by <ad>.
 1.3.6.1 02-Jul-2008  rmind file sbrk.S was added on branch christos-time_t on 2008-07-02 20:07:44 +0000
 1.3.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.2.1 17-Apr-2012  yamt sync with head
 1.4.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.2 18-Jan-2003  thorpej These files are obsolete; setlogin() is now implemented in C with a
small syscall stub.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 11-Mar-2006  christos remove files moved to the new compat layout.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.2 11-Mar-2006  christos remove files moved to the new compat layout.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 11-Mar-2006  christos remove files moved to the new compat layout.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 11-Mar-2006  christos remove files moved to the new compat layout.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.4 11-Mar-2006  christos remove files moved to the new compat layout.
 1.3 26-Mar-2004  drochner disembowel -- there is no kernel support anyway
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3 11-Mar-2006  christos remove files moved to the new compat layout.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.5 18-Apr-2020  thorpej Rename "syscall" to "_syscall" and provide "syscall" as a weak alias.
 1.4 05-Nov-2007  dsl branches: 1.4.72;
syscall() has to be implemented in the kernel - so is a normal system call here.This has always been broken, so I suspect everything is using __syscall().
 1.3 07-Aug-2003  agc branches: 1.3.22;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.2 03-Jun-2002  fvdl Use the syscall insn for system calls. Fix up some assembly to
remove either previously made errors, or to account for the
fact that syscall clobbers %ecx.
 1.1 19-Jun-2001  fvdl Initial commit of x86-64 specific parts of libc.
 1.3.22.1 06-Nov-2007  matt sync with HEAD
 1.4.72.1 21-Apr-2020  martin Sync with HEAD

RSS XML Feed