Commit Graph

69 Commits

Author SHA1 Message Date
Andriy Gapon
c722ec3a51 remove needless inclusion of machine/cpu.h in userland
MFC after:	21 days
2013-07-28 18:35:43 +00:00
Ed Maste
9eafd63574 Remove clause 3 and 4 from TNF licenses
Per the NetBSD Foundation statement
  Third parties are encouraged to change the license on any files which
  have a 4-clause license contributed to the NetBSD Foundation to a
  2-clause license.
2013-05-29 01:54:10 +00:00
Konstantin Belousov
55a1911ef2 The getcontext() from the __fillcontextx() call in the
check_deferred_signal() returns twice, since handle_signal() emulates
the return from the normal signal handler by sigreturn(2)ing the
passed context.  Second return is performed on the destroyed stack
frame, because __fillcontextx() has already returned.  This causes
undefined and bad behaviour, usually the victim thread gets SIGSEGV.

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

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

Mark __fillcontextx() as returning twice [1].

Reported by:	pgj
Pointy hat to:	kib
Discussed with:	dim
Tested by:	pgj, dim
Suggested by:	jilles [1]
MFC after:	1 week
2013-05-28 04:54:16 +00:00
Konstantin Belousov
150facd256 Rework the __vdso_* symbols attributes to only make the symbols weak,
but use normal references instead of weak.  This makes the statically
linked binaries to use fast gettimeofday(2) by forcing the linker to
resolve references and providing the neccessary functions.

Reported by:	bde
Tested by:	marius (sparc64)
MFC after:	2 weeks
2013-01-30 12:48:16 +00:00
Nathan Whitehorn
88fe385600 Do not restore the register holding the TLS pointer when doing various
usermode context switches (long jumps and ucontext operations). If these
are used across threads, multiple threads can end up with the same TLS base.
Madness will then result.

This makes behavior on PPC match that on x86 systems and on Linux.

MFC after:	10 days
2012-04-11 00:00:40 +00:00
Nathan Whitehorn
351f30528e Properly resolve the _ctx_start function descriptor (the symbol _ctx_start
is a descriptor, not a code address), which prevents crashes when starting
a context. This fixes QEMU on powerpc64.

MFC after:	3 days
2012-04-07 22:28:50 +00:00
Andreas Tobler
54558cdc0e Replace the assembler macro WEAK_ALIAS with a new macro WEAK_REFERENCE which
has the same API as __weak_reference(). Give 'x' in SYS.h a more meaningful
name.

Tested on 32- and 64-bit PowerMac.

Reviewed by:	bde
2012-02-05 20:04:43 +00:00
Konstantin Belousov
754f1c1e63 Make the sys/ucontext.h self-contained by changing the return type
of __getcontextx_size(3) from size_t to int.

PR:	ports/164654
MFC after:	1 month
2012-02-01 13:33:53 +00:00
Konstantin Belousov
2b1de0afd1 Add API for obtaining extended machine context states that cannot be
fit into existing mcontext_t.

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

Tested by:  pho
MFC after:  1 month
2012-01-21 18:00:28 +00:00
Andreas Tobler
9eab2f146a This commit adds profiling support for powerpc64. Now we can do application
profiling and kernel profiling. To enable kernel profiling one has to build
kgmon(8). I will enable the build once I managed to build and test powerpc
(32-bit) kernels with profiling support.

- add a powerpc64 PROF_PROLOGUE for _mcount.
- add macros to avoid adding the PROF_PROLOGUE in certain assembly entries.
- apply these macros where needed.
- add size information to the MCOUNT function.

MFC after:	3 weeks, together with r230291
2012-01-20 22:34:19 +00:00
Andreas Tobler
d172493d20 Two other places where we can use WEAK_ALIAS. 2012-01-08 11:57:38 +00:00
Andreas Tobler
b286f80c2d Use the macro WEAK_ALIAS. Tested on 32 and 64-bit. 2012-01-06 09:21:40 +00:00
David Schultz
6232589aeb Replace a proliferation of buggy MD implementations of modf() with a
working MI one.  The MI one only needs to be overridden on machines
with non-IEEE754 arithmetic.  (The last supported one was the VAX.)
It can also be overridden if someone comes up with a faster one that
actually passes the regression tests -- but this is harder than it sounds.
2011-10-21 06:40:36 +00:00
Rebecca Cran
6bccea7c2b Fix typos - remove duplicate "the".
PR:	bin/154928
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after: 	3 days
2011-02-21 09:01:34 +00:00
Nathan Whitehorn
79c77d726e Turn off default generation of userland dot symbols on powerpc64 now that
we have a binutils that supports it. Kernel dot symbols remain on to assist
DDB.
2011-02-18 21:44:53 +00:00
Konstantin Belousov
8f861da99c Mark assembler sources from libc as working with non-executable stack.
Reviewed and tested by:	nwhitehorn
2011-01-14 11:33:40 +00:00
Nathan Whitehorn
4268c54530 Fix stack alignment (required to be to 16 bytes) instead of ptrace and
cerror on powerpc64.
2010-12-11 17:57:42 +00:00
Dimitry Andric
da2bbf0cbd Make sure to specify the alignment of minbrk and curbrk. They were correctly
aligned by accident with earlier binutils, but no longer are, causing link
failures.

Submitted by:	nwhitehorn
Obtained from:	projects/binutils-2.17
2010-11-11 22:35:42 +00:00
Nathan Whitehorn
840b91cc52 Provide 64-bit PowerPC support in libc.
Obtained from:	projects/ppc64
2010-07-10 14:45:03 +00:00