Commit Graph

88 Commits

Author SHA1 Message Date
Ruslan Ermilov
3c03c7095e GC dead code. If we want to stay polite to the foreign compilers,
we can find another way to issue an #error, but using a preprocessed
assembler for that purpose and clobbering libc.a with an empty .o
just for the sake of #error reporting is way too much of a burden.
2006-09-05 16:21:26 +00:00
Konstantin Belousov
3d5fa0356e Replace absolute addressing in the call instructions with position-independend
calls. This eliminates TEXTREL from libc, making its text segment relocatable.

PR:	i386/85242
Approved by:	kan (mentor)
MFC after:	1 month
2006-06-05 14:59:33 +00:00
Stefan Farfeleder
613100918d Include a couple of headers to ensure consistency between the prototype and
the function definition.
2005-09-12 19:52:42 +00:00
Peter Wemm
3b4399f6a7 Clean out the leftovers from the i386_set_gsbase() TLS conversion.
Like on libthr, there is an i386_set_gsbase() stub implementation here
to avoid libc.so.5 issues.  This should likely be a weak symbol and I
expect this will be fixed soon.

Approved by:	re
2005-06-29 23:15:36 +00:00
Peter Wemm
3bbf3512ad Provide stub functions for i386_set_ldt() and i386_get_ldt() even when
compiling as an amd64 support binary.  They will return EINVAL on an amd64
kernel, but this simplifies other #ifdefs that were getting a bit nasty.
2005-04-26 20:51:15 +00:00
Peter Wemm
8fa4081fe3 No longer use _amd64_set_gsbase(). Use i386_set_gsbase() even when
building for amd64.
2005-04-26 20:46:11 +00:00
Peter Wemm
4453c6dc67 Attempt i386_set_gsbase() before using the user_ldt code. Unimplemented
sysarch() calls return EINVAL, not SIGSYS.. so we can trivially adapt.
2005-04-14 00:02:37 +00:00
Daniel Eischen
6c68cb596e Make sure the first argument to the user function is 16-byte aligned.
Submitted by:	tegge
2004-12-05 21:22:08 +00:00
Peter Wemm
5bc7bd5ff2 When building the custom i386 libraries for use on amd64 kernels, we
can't use the i386_set_ldt() family of routines, because they are not
implemented.  Instead, use the recently exposed direct access sysarch
routines for setting what %fs and %gs point to.

Use this for the i386 TLS _set_tp() routine, but only when compiling to
run as a 32 bit support binary for amd64 kernels.
2004-11-06 03:28:26 +00:00
Doug Rabson
ccd13c49b5 Add support for TLS in statically linked programs. 2004-08-15 16:18:52 +00:00
David Schultz
479f8d2214 Make FLT_ROUNDS correctly reflect the dynamic rounding mode. 2004-07-19 08:17:25 +00:00
David Schultz
39bcea8689 Replace seven nominally MD implementations of frexp() that are broken
for subnormals with one implementation that works.
2004-07-18 21:23:39 +00:00
David Schultz
240dbabfa8 Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify().  This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number.  In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5.  I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X.  At the same time, the new macros
should remain C99-compliant.

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

Prodded by:	kris
2004-07-09 03:32:40 +00:00
David Xu
39ba326d65 Follow previous change in makecontext. Use %esi to store next ucp
pointer, here we keep orignal %ebp, so we can see where signal handler
comes in and interrupt normal code.
2004-07-02 23:20:05 +00:00
David Xu
a5a5d84784 Use %esi to store next ucp pointer. Mark end of stack by
setting %ebp to zero, this avoids new gdb to dump a weird
backtrace.
2004-07-02 14:19:44 +00:00
David Schultz
a94707138b Remove the code and an associated comment for gcc 1.x compatibility
and fix a typo in the !__GNUC__ case.
2004-02-16 10:03:02 +00:00
David Schultz
36e22bed27 Fix some aliasing problems. 2004-02-16 10:02:40 +00:00
Colin Percival
d623b765cf style cleanup: Remove duplicate $FreeBSD$ tags.
These files had tags after the copyright notice,
inside the comment block (incorrect, removed),
and outside the comment block (correct).

Approved by:	rwatson (mentor)
2004-02-10 20:42:33 +00:00
David E. O'Brien
0ab6a0c787 Push the alloca #error warning farther down to play nicer with some out of
tree local translator.

Requested by:	 jmallett
2003-06-25 19:06:40 +00:00
David E. O'Brien
5c784c8f4b Only use this with a non-GCC compiler. 2003-06-14 06:04:23 +00:00
David E. O'Brien
e683295e39 Use C99 compatible ASM statements. 2003-06-02 02:32:22 +00:00
John Baldwin
664234c6e2 Properly cleanup the stack before jumping to cerror() if rfork(2) fails.
Submitted by:	Igor Sysoev <is@rambler-co.ru>
Approved by:	re (scottl)
2003-05-07 17:23:25 +00:00
Daniel Eischen
67aba1c6a4 Align signal frame placed on stack to 16 bytes so that SSE FPU register
restores can work.  Also correct allocation for signal frame size.

Reviewed by:	mini
2003-03-29 16:38:15 +00:00
Daniel Eischen
cd7be69206 Remove these from libc; they are now system calls.
Prompted by:	mini
2003-02-18 12:31:57 +00:00
Jonathan Mini
2129373618 Call the weak symbol for sigprocmask, so that it can be overridden. 2003-02-17 07:47:13 +00:00
Jacques Vidrine
e0554a531f Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
Mike Barcroft
5d62092f94 o Implement C99 classification macros isfinite(), isinf(), isnan(),
isnormal().  The current isinf() and isnan() are perserved for
  binary compatibility with 5.0, but new programs will use the macros.
o Implement C99 comparison macros isgreater(), isgreaterequal(),
  isless(), islessequal(), islessgreater(), isunordered().

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

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

PR:		23103
Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
		(significant portions)
Reviewed by:	bde, fenner (earlier versions)
2003-02-08 20:37:55 +00:00
Daniel Eischen
9ed358fddc Disconnect the userland get/set/swapcontext() functions from
libc.  I want to keep these in some version for the thread
library/ies, but don't know whether to have them repo-copied
to libc_r or renamed and kept in libc.

Change the name of an alpha macro that was changed with the
system call commit.
2002-11-16 06:39:11 +00:00
Archie Cobbs
83999f5a32 Re-apply the previously backed-out commit that fixes the problem where
HUGE_VAL is not properly aligned on some architectures. The previous
fix now works because the two versions of 'math.h' (include/math.h
and lib/msun/src/math.h) have since been merged into one.

PR:	bin/43544
2002-10-31 23:05:20 +00:00
Jonathan Mini
dcf0aad852 Style cleanup:
- Sort local variable declarations.
- Protect a hand-formatted comment from indent(1).
- Use portable casts, even though this is machine-dependant code.
- Remove extraneous blank lines.
- Remove trailing newline.
- Use sigdelset(3), not SIGDELSET(9).

Requested by:	bde
2002-09-21 23:54:32 +00:00
Archie Cobbs
ae8a4b2f36 Revert previous commit to unbreak world until we figure out the
right way to do it.
2002-09-20 15:43:26 +00:00
Archie Cobbs
f5f1272284 Fix a problem with the definition of HUGE_VAL causing the gcc warning
"cast increases required alignment of target type" on some platforms.

Reviewed by:	bde
2002-09-19 19:47:27 +00:00
Bruce Evans
ff5250b3e7 Fixed editing error in previous commit (*blush*). 2002-09-17 19:43:53 +00:00
Bruce Evans
803e437fb0 Fixed unsorting of SRCS. 2002-09-17 14:33:23 +00:00
Jonathan Mini
7630ea31ed Use a weak symbol for signalcontext(). 2002-09-17 03:15:47 +00:00
Jonathan Mini
1d6e1c66b2 Add signalcontext(), which adds a signal frame to a ucontext_t. 2002-09-17 03:11:07 +00:00
Jonathan Mini
f990583656 Save and restore FPU state properly in ucontext_t's.
Reviewed by:	deischen, julian
Approved by:	-arch
2002-09-16 19:24:31 +00:00
Robert Drehmel
b78411b153 Include <stdlib.h> to have abort() and exit() declared. 2002-08-15 11:58:24 +00:00
David E. O'Brien
c04447ba03 Standardize on our SCM ID style. 2002-03-23 02:44:19 +00:00
David E. O'Brien
0f4f02856d Restore CSRG ID's lost in January 1995. 2002-03-23 02:10:28 +00:00
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
Peter Wemm
cc2dbb21e5 Move swapcontext.c to the ${MACHINE_ARCH}/gen/Makefile.inc area, otherwise
it causes undefined references to getcontext() and setcontext() on
platforms other than i386 and alpha.
2002-03-21 06:45:32 +00:00
Bruce Evans
b9c35b6942 Fixed unsorting and splitting of SRCS in previous commit. 2002-01-11 17:10:35 +00:00
Daniel Eischen
b66b8326e5 Add getcontext, setcontext, makecontext, and swapcontext. These
functions are defined in SUSv2 and the latest POSIX spec.

Thanks to Bernd Walter <ticso@cicely8.cicely.de> for helping debug my
alpha assembly.

Approved by:	-arch
2002-01-10 02:40:59 +00:00
John Baldwin
a1d8094b9e Use 'mov' instead of 'lea' for setting the syscall number in %eax as that
is clearer about what we are actually doing.

Requested by:	bde
2001-11-27 20:51:26 +00:00
Peter Wemm
e6d808aee3 De-orbit DEFS.h - the other arches do not use it, and it got replaced
with <machine/asm.h>.

Reviewed by:	bde
2001-10-24 20:29:14 +00:00
Ruslan Ermilov
8af1452cf8 Removed duplicate VCS ID tags, as per style(9). 2001-08-13 14:06:34 +00:00
Daniel Eischen
d201fe46e3 Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
2001-01-24 13:01:12 +00:00
John Baldwin
9a51cfcde1 Prefix the register argument of indirect 'jmp's with a * to make gas 2.10.x
happy.
2000-11-28 22:59:14 +00:00