aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/i386/gen
Commit message (Collapse)AuthorAgeFilesLines
* libc: Fix a typo in a source code commentGordon Bergling2025-08-171-1/+1
| | | | | | - s/aguments/arguments/ MFC after: 3 days
* Remove residual blank line at start of MakefileWarner Losh2024-07-151-1/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* libc: move rfork_thread(3) to libsysBrooks Davis2024-02-052-112/+1
| | | | | | | | rfork_thread(3) is assembly that makes syscalls directly and uses cerror so it belongs in libsys. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
* {amd64,i386}/SYS.h: add _SYSCALL and _SYSCALL_BODYBrooks Davis2023-12-181-4/+2
| | | | | | | | | | Add a _SYSCALL(name) which calls the SYS_name syscall. Use it to add a _SYSCALL_BODY() macro which invokes the syscall and calls cerror as required. Use the latter to implement PSEUDO() and RSYSCALL(). Reviewed by: imp, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43059
* lib: Remove ancient SCCS tags.Warner Losh2023-11-275-12/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* libc: Purge unneeded cdefs.hWarner Losh2023-11-014-4/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1610-20/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* libc: Remove _get_tp() and _set_tp().John Baldwin2021-12-093-88/+1
| | | | | | | | | Their uses have been replaced by _tcb_get() and _tcb_set() from <machine/tls.h>. Reviewed by: kib, jrtc27 Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33354
* libc: add _get_tp() private functionKonstantin Belousov2021-04-092-1/+46
| | | | | | | | which returns pointer to tcb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* Unify i386 and amd64 getcontextx.c, and use ifuncs while there.Konstantin Belousov2019-02-142-146/+1
| | | | | | | | | | | In particular, use ifuncs for __getcontextx_size(), also calculate the size of the extended save area in resolver. Same for __fillcontextx2(). Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=344120
* Remove support for SYS_sys_exit in favor of SYS_exit.Brooks Davis2018-06-011-4/+0
| | | | | | | | SYS_exit has been defined in the repo since 1994 except for a brief window when SYS_sys_exit was defined in 2000. Notes: svn path=/head/; revision=334500
* Remove bogus checks against NCARGS.John Baldwin2018-01-311-1/+1
| | | | | | | | | | | | NCARGS isn't a limit on the number of arguments to pass to a function, but the number of bytes that can be consumed by arguments to exec. As such, it is not suitable for a limit on the count of arguments passed to makecontext(). Sponsored by: DARPA / AFRL Notes: svn path=/head/; revision=328631
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-254-2/+10
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* Renumber copyright clause 4Warner Losh2017-02-284-4/+4
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Switch libc from using _sig{procmask,action,suspend} symbols, whichKonstantin Belousov2015-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 Notes: svn path=/head/; revision=287292
* siglongjmp(): Preserve floating point exception flags on i386 and amd64.Jilles Tjoelker2014-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. Notes: svn path=/head/; revision=267307
* Replace the WEAK_ALIAS() alias with the WEAK_REFERENCE() alias. Use it andAndreas Tobler2013-11-213-6/+3
| | | | | | | | | get rid of the __CONCAT and CNAME macros. Reviewed by: bde, kib Notes: svn path=/head/; revision=258451
* The getcontext() from the __fillcontextx() call in theKonstantin Belousov2013-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 Notes: svn path=/head/; revision=251047
* libc/i386: Do not export .cerror.Jilles Tjoelker2012-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 Notes: svn path=/head/; revision=240152
* Executing CPUID with EAX set to 1 to actually get feature flags.David Xu2012-07-101-1/+1
| | | | | | | PR: 169730 Notes: svn path=/head/; revision=238328
* Make the sys/ucontext.h self-contained by changing the return typeKonstantin Belousov2012-02-011-1/+1
| | | | | | | | | | of __getcontextx_size(3) from size_t to int. PR: ports/164654 MFC after: 1 month Notes: svn path=/head/; revision=230864
* Add API for obtaining extended machine context states that cannot beKonstantin Belousov2012-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 Notes: svn path=/head/; revision=230429
* Despite official i386 ABI does not mandate any stack alignment besidesKonstantin Belousov2011-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 Notes: svn path=/head/; revision=227024
* Replace a proliferation of buggy MD implementations of modf() with aDavid Schultz2011-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. Notes: svn path=/head/; revision=226606
* Add section .note.GNU-stack for assembly files used by 386 and amd64.Konstantin Belousov2011-01-077-0/+14
| | | | Notes: svn path=/head/; revision=217106
* Retire the amd64 and i386 specific inline assembly versions of ldexp.c,Dimitry Andric2010-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) Notes: svn path=/head/; revision=213308
* Workaround LLVM bug #4434:Rui Paulo2010-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 Notes: svn path=/head/; revision=212976
* Add missing END() macros, as per rev 184547 for amd64. The lack of thesePeter Wemm2008-11-027-2/+12
| | | | | | | is mostly harmless, but it does upset some of valgrind's functionality. Notes: svn path=/head/; revision=184548
* We should also save and restore the MXCSR as on amd64, but detectingDavid Schultz2008-06-282-2/+0
| | | | | | | whether the CPU supports SSE or not here is rather odious. Notes: svn path=/head/; revision=180081
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-096-24/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Handle inf/nan correctly.David Schultz2007-01-061-2/+14
| | | | Notes: svn path=/head/; revision=165842
* GC dead code. If we want to stay polite to the foreign compilers,Ruslan Ermilov2006-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. Notes: svn path=/head/; revision=162039
* Replace absolute addressing in the call instructions with position-independendKonstantin Belousov2006-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 Notes: svn path=/head/; revision=159270
* Include a couple of headers to ensure consistency between the prototype andStefan Farfeleder2005-09-122-0/+4
| | | | | | | the function definition. Notes: svn path=/head/; revision=150065
* Clean out the leftovers from the i386_set_gsbase() TLS conversion.Peter Wemm2005-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 Notes: svn path=/head/; revision=147673
* Provide stub functions for i386_set_ldt() and i386_get_ldt() even whenPeter Wemm2005-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. Notes: svn path=/head/; revision=145573
* No longer use _amd64_set_gsbase(). Use i386_set_gsbase() even whenPeter Wemm2005-04-261-1/+1
| | | | | | | building for amd64. Notes: svn path=/head/; revision=145571
* Attempt i386_set_gsbase() before using the user_ldt code. UnimplementedPeter Wemm2005-04-141-1/+4
| | | | | | | sysarch() calls return EINVAL, not SIGSYS.. so we can trivially adapt. Notes: svn path=/head/; revision=145037
* Make sure the first argument to the user function is 16-byte aligned.Daniel Eischen2004-12-051-5/+7
| | | | | | | Submitted by: tegge Notes: svn path=/head/; revision=138403
* When building the custom i386 libraries for use on amd64 kernels, wePeter Wemm2004-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. Notes: svn path=/head/; revision=137290
* Add support for TLS in statically linked programs.Doug Rabson2004-08-152-1/+53
| | | | Notes: svn path=/head/; revision=133754
* Make FLT_ROUNDS correctly reflect the dynamic rounding mode.David Schultz2004-07-192-1/+26
| | | | Notes: svn path=/head/; revision=132383
* Replace seven nominally MD implementations of frexp() that are brokenDavid Schultz2004-07-182-68/+1
| | | | | | | for subnormals with one implementation that works. Notes: svn path=/head/; revision=132366
* Implement the classification macros isfinite(), isinf(), isnan(), andDavid Schultz2004-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 Notes: svn path=/head/; revision=131852
* Follow previous change in makecontext. Use %esi to store next ucpDavid Xu2004-07-021-1/+1
| | | | | | | | pointer, here we keep orignal %ebp, so we can see where signal handler comes in and interrupt normal code. Notes: svn path=/head/; revision=131501
* Use %esi to store next ucp pointer. Mark end of stack byDavid Xu2004-07-022-3/+4
| | | | | | | | setting %ebp to zero, this avoids new gdb to dump a weird backtrace. Notes: svn path=/head/; revision=131460
* Remove the code and an associated comment for gcc 1.x compatibilityDavid Schultz2004-02-161-9/+1
| | | | | | | and fix a typo in the !__GNUC__ case. Notes: svn path=/head/; revision=125867
* Fix some aliasing problems.David Schultz2004-02-161-14/+19
| | | | Notes: svn path=/head/; revision=125865