summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/gen
Commit message (Collapse)AuthorAgeFilesLines
* Switch libc from using _sig{procmask,action,suspend} symbols, whichkib2015-08-292-40/+4
| | | | | | | | | | | | | | | | | | | | | | | | are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. Since e.g. _sigaction is not interposed by libthr, calling signal() removes thr_sighandler() from the handler slot etc. The result was breaking signal semantic and rtld locking. The added __libc_sigprocmask and other symbols are hidden, they are not exported and cannot be called through PLT. The setjmp/longjmp functions for x86 were changed to use direct calls, and since PIC_PROLOGUE only needed for functional PLT indirection on i386, it is removed as well. The PowerPC bug of calling the syscall directly in the setjmp/longjmp implementation is kept as is. Reported by: Pete French <petefrench@ingresso.co.uk> Tested by: Michiel Boland <boland37@xs4all.nl> Reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* siglongjmp(): Preserve floating point exception flags on i386 and amd64.jilles2014-06-091-1/+0
| | | | | | | | | | Per POSIX, siglongjmp() shall be equivalent to longjmp() except that it must match sigsetjmp() instead of setjmp() and except for the effect on the signal mask. Therefore, it should preserve the floating point exception flags. This was fixed for longjmp() and _longjmp() in r180080 and r180081 for amd64 and i386 respectively.
* Replace the WEAK_ALIAS() alias with the WEAK_REFERENCE() alias. Use it andandreast2013-11-213-6/+3
| | | | | | get rid of the __CONCAT and CNAME macros. Reviewed by: bde, kib
* The getcontext() from the __fillcontextx() call in thekib2013-05-281-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* libc/i386: Do not export .cerror.jilles2012-09-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit in the FBSDprivate_1.0 version. It looks like there is no reason for this since it is not used from other libraries. Given that it cannot be accessed from C and its strange calling convention, it is rather unlikely that other things rely on it. Perhaps it is from a time when symbols could not be hidden. Not exporting .cerror causes it to be jumped to directly instead of via the PLT. This change also takes advantage of .cerror's new status by not saving and loading %ebx before jumping to it. (Therefore, .cerror now saves and loads %ebx itself.) Where there was a conditional jump to a jump to .cerror, the conditional jump has been changed to jump to .cerror directly (many modern CPUs don't do static prediction and in any case it is not much of a benefit anyway). This change makes libc.so.7 a few kilobytes smaller. Reviewed by: kib
* Executing CPUID with EAX set to 1 to actually get feature flags.davidxu2012-07-101-1/+1
| | | | PR: 169730
* Make the sys/ucontext.h self-contained by changing the return typekib2012-02-011-1/+1
| | | | | | | of __getcontextx_size(3) from size_t to int. PR: ports/164654 MFC after: 1 month
* Add API for obtaining extended machine context states that cannot bekib2012-01-212-1/+134
| | | | | | | | | | | 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
* Despite official i386 ABI does not mandate any stack alignment besideskib2011-11-022-0/+28
| | | | | | | | the word alignment, some versions of gcc do require 16-byte alignment. Make sure the stack is 16-byte aligned before calling a subroutine. Inspired by: PR amd64/162214 MFC after: 1 week
* Replace a proliferation of buggy MD implementations of modf() with adas2011-10-212-88/+1
| | | | | | | 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.
* Add section .note.GNU-stack for assembly files used by 386 and amd64.kib2011-01-077-0/+14
|
* Retire the amd64 and i386 specific inline assembly versions of ldexp.c,dim2010-09-301-68/+0
| | | | | | | | as they are slower than the generic version in C, at least on modern hardware. This leaves us with just five implementations. Suggested by: bde Approved by: rpaulo (mentor)
* Workaround LLVM bug #4434:rpaulo2010-09-211-3/+7
| | | | | | | | | | Reorder inline assembly arguments temp2, temp, value and texp to follow the st(0), st(1), etc. style. Also mark the temp2 variable as volatile to workaround another clang bug. This allows clang to buildworld FreeBSD/i386. Submitted by: dim
* Add missing END() macros, as per rev 184547 for amd64. The lack of thesepeter2008-11-027-2/+12
| | | | is mostly harmless, but it does upset some of valgrind's functionality.
* We should also save and restore the MXCSR as on amd64, but detectingdas2008-06-282-2/+0
| | | | whether the CPU supports SSE or not here is rather odious.
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-096-24/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* Handle inf/nan correctly.das2007-01-061-2/+14
|
* GC dead code. If we want to stay polite to the foreign compilers,ru2006-09-052-63/+1
| | | | | | 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.
* Replace absolute addressing in the call instructions with position-independendkib2006-06-051-2/+3
| | | | | | | | calls. This eliminates TEXTREL from libc, making its text segment relocatable. PR: i386/85242 Approved by: kan (mentor) MFC after: 1 month
* Include a couple of headers to ensure consistency between the prototype andstefanf2005-09-122-0/+4
| | | | the function definition.
* Clean out the leftovers from the i386_set_gsbase() TLS conversion.peter2005-06-291-18/+1
| | | | | | | | 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
* Provide stub functions for i386_set_ldt() and i386_get_ldt() even whenpeter2005-04-261-4/+0
| | | | | 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.
* No longer use _amd64_set_gsbase(). Use i386_set_gsbase() even whenpeter2005-04-261-1/+1
| | | | building for amd64.
* Attempt i386_set_gsbase() before using the user_ldt code. Unimplementedpeter2005-04-141-1/+4
| | | | sysarch() calls return EINVAL, not SIGSYS.. so we can trivially adapt.
* Make sure the first argument to the user function is 16-byte aligned.deischen2004-12-051-5/+7
| | | | Submitted by: tegge
* When building the custom i386 libraries for use on amd64 kernels, wepeter2004-11-061-0/+4
| | | | | | | | | 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.
* Add support for TLS in statically linked programs.dfr2004-08-152-1/+53
|
* Make FLT_ROUNDS correctly reflect the dynamic rounding mode.das2004-07-192-1/+26
|
* Replace seven nominally MD implementations of frexp() that are brokendas2004-07-182-68/+1
| | | | for subnormals with one implementation that works.
* Implement the classification macros isfinite(), isinf(), isnan(), anddas2004-07-092-76/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Follow previous change in makecontext. Use %esi to store next ucpdavidxu2004-07-021-1/+1
| | | | | pointer, here we keep orignal %ebp, so we can see where signal handler comes in and interrupt normal code.
* Use %esi to store next ucp pointer. Mark end of stack bydavidxu2004-07-022-3/+4
| | | | | setting %ebp to zero, this avoids new gdb to dump a weird backtrace.
* Remove the code and an associated comment for gcc 1.x compatibilitydas2004-02-161-9/+1
| | | | and fix a typo in the !__GNUC__ case.
* Fix some aliasing problems.das2004-02-161-14/+19
|
* style cleanup: Remove duplicate $FreeBSD$ tags.cperciva2004-02-101-3/+1
| | | | | | | | These files had tags after the copyright notice, inside the comment block (incorrect, removed), and outside the comment block (correct). Approved by: rwatson (mentor)
* Push the alloca #error warning farther down to play nicer with some out ofobrien2003-06-251-2/+4
| | | | | | tree local translator. Requested by: jmallett
* Only use this with a non-GCC compiler.obrien2003-06-141-0/+2
|
* Use C99 compatible ASM statements.obrien2003-06-021-1/+1
|
* Properly cleanup the stack before jumping to cerror() if rfork(2) fails.jhb2003-05-071-0/+4
| | | | | Submitted by: Igor Sysoev <is@rambler-co.ru> Approved by: re (scottl)
* Align signal frame placed on stack to 16 bytes so that SSE FPU registerdeischen2003-03-291-1/+2
| | | | | | restores can work. Also correct allocation for signal frame size. Reviewed by: mini
* Remove these from libc; they are now system calls.deischen2003-02-181-158/+0
| | | | Prompted by: mini
* Call the weak symbol for sigprocmask, so that it can be overridden.mini2003-02-171-1/+1
|
* Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).nectar2003-02-161-0/+1
| | | | | | | 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
* o Implement C99 classification macros isfinite(), isinf(), isnan(),mike2003-02-121-0/+2
| | | | | | | | | 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>
* Implement fpclassify():mike2003-02-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Disconnect the userland get/set/swapcontext() functions fromdeischen2002-11-161-2/+2
| | | | | | | | | 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.
* Re-apply the previously backed-out commit that fixes the problem wherearchie2002-10-311-1/+1
| | | | | | | | 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
* Style cleanup:mini2002-09-211-14/+11
| | | | | | | | | | | - 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
* Revert previous commit to unbreak world until we figure out thearchie2002-09-201-1/+1
| | | | right way to do it.
* Fix a problem with the definition of HUGE_VAL causing the gcc warningarchie2002-09-191-1/+1
| | | | | | "cast increases required alignment of target type" on some platforms. Reviewed by: bde
OpenPOWER on IntegriCloud