summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/i386 (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Geode CPU does not support SSE, so MXCSR does not exists there. Asbluhm2020-12-133-9/+3
| | | | | | | | our i386 compiler does not generate SSE instructions by default, it is not strictly necessary to save MXCSR content between setjmp(3) and longjmp(3). We do not want to end supporting such old processors now. Remove the stmxcsr and ldmxcsr instructions from libc. reported by Johan Huldtgren; OK jsg@ kettenis@
* On i386 setjmp(3) should store the FPU state and longjmp(3) restorebluhm2020-12-063-3/+15
| | | | | | it. There is enough space in jmp_buf to save MXCSR and CW register. Idea taken from amd64. This fixes regress/lib/libc/setjmp-fpu . OK kettenis@
* Introduce constants to access the setjmp(3) jmp_buf fields frombluhm2020-12-063-76/+79
| | | | | | | i386 libc. The assembler code is more readable than with magic numbers. This brings i386 in line with amd64. No change in object file. OK kettenis@
* SYS___threxit cannot fail, but this integration looks like a gadget.deraadt2020-10-181-1/+2
| | | | | Put a hard-trap instruction after the syscall instruction. ok kettenis mortimer
* Add support for timeconting in userland.pirofti2020-07-062-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* Remove FBSDID.kevlo2019-03-151-4/+1
| | | | ok deraadt@
* Clear the sign bit in the QNAN constants used by strtof, strtod and strtold,jmatthew2018-05-281-4/+4
| | | | | | so passing "nan" and "-nan" produces a NaN with the right sign. Bug reported and diff provided by George Koehler. ok kettenis@
* Instead of trying to handle ffs() with the normal rename-mark-hidden-and-aliasguenther2018-01-181-2/+3
| | | | | | | dance, mark it protected. This works better for both gcc and clang: gcc blocks overriding of internal calls, while clang permits inlining again. ok otto@
* clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"guenther2017-11-2918-57/+86
| | | | | | | | | to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when building with clang, instead mark those as protected visibility to get rid of the PLT relocations. We can't take the address of them then, but that's ok: it's a build-time error not a run-time error. ok kettenis@
* GNU ld has prefixed the contents of .gnu.warning.SYMBOL sectionstb2017-11-282-4/+4
| | | | | | | | with "warning: " since 2003, so the messages themselves need not contain the prefix anymore. From Scott Cheloha ok jca, deraadt
* Use 0xcc trapsleds instead of default/nop/0xcc in BTC alignmentsderaadt2017-08-193-6/+6
|
* Don't need .text before ENTRY(), also minor spacing cleanupsderaadt2017-08-192-6/+2
|
* Put _map table into .rodata instead of .textderaadt2017-08-191-2/+2
|
* Copy files from ../librthread in preparation for moving functionalityguenther2017-08-151-0/+25
| | | | | | | from libpthread to libc. No changes to the build yet, just making it easier to review the substantive diffs. ok beck@ kettenis@ tedu@
* Remove branch prediction hint from conditional branch instruction.naddy2017-06-011-2/+2
| | | | | These hints are not recognized by clang's builtin assembler. From the corresponding amd64 change. ok visa@ kettenis@
* Do setjmp cookies for eip, esp, and ebp. For bonus points, mix howguenther2016-05-303-70/+124
| | | | | | | | the cookies are used in setjmp/_setjmp/sigsetjmp so that mixing calls (e.g., longjmp on a _setjmp buffer) will scramble all three registers and jump you to a random location on a random stack! ok deraadt@
* Remove sigreturn declaration and the now-unused libc syscall stubguenther2016-05-091-48/+0
|
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-0710-201/+40
| | | | | | | | | | | | | | | | | This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
* The asm in the MD_DISABLE_KBIND macro was too fragile and broke alpha and hppa.guenther2016-03-211-27/+0
| | | | | | So instead, do the kbind disabling with syscall(). debugging and ok deraadt@, ok kettenis@
* Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther2016-03-201-0/+27
| | | | | | | | | | | move their definitions and initialization in static links to libc.a Make crt0 always invoke a new func _csu_finish() in libc to process the auxv and to either register the ld.so cleanup function (in dynamic links) or initialize environ and __progname and do MC_DISABLE_KBIND (in static links). In libc, get pagesize from auxv; cache that between getpagesize() and sysconf(_SC_PAGESIZE) ok mpi@ "good time" deraadt@
* Wrap the remaining math functions in libc: __fpclassify*(), __flt_rounds(),guenther2015-10-273-4/+7
| | | | | | and ldexp(). ok millert@
* Merge the sigaction() and sigprocmask() overloads/wrappers from libpthreadguenther2015-10-232-4/+6
| | | | | | | | | into libc, and move pthread_sigmask() as well (just a trivial wrapper). This provides consistent handling of SIGTHR between single- and multi-threaded programs and is a step in the merge of all the libpthread overloads, providing some ASM and Makefile bits that the other wrappers will need. ok deraadt@ millert@
* Need SYS.h for END_STRONG()guenther2015-09-134-4/+4
|
* Add hidden _libc_ aliases and symbol sizesguenther2015-09-134-0/+4
| | | | prodded by semarie@
* Wrap <stdlib.h> so that calls go direct and the symbols not in theguenther2015-09-132-3/+2
| | | | | | C standard are all weak. Apply __{BEGIN,END}_HIDDEN_DECLS to gdtoa{,imp}.h, hiding the arch-specific __strtorx, __ULtox_D2A, __strtorQ, __ULtoQ_D2A symbols.
* Do provide hidden _libc_* aliases for sig{block,setmask} and use them inguenther2015-09-132-10/+10
| | | | | | | the ASM *setjmp implementations. Skip the PLT when calling them on amd64 (other archs to do this after testing) ok miod@
* Adds hidden _libc_FOO aliases for the system call stubs.guenther2015-09-0511-30/+56
| | | | | | | | Stop generating _brk and _sbrk symbols: they've already been hidden. Set the ELF symbol size on the syscall stubs. Give the __{min,cur}brk symbols a size and type, and hide more jump labels. ok deraadt@
* Add framework for resolving (pun intended) libc namespace issues, usingguenther2015-08-3114-27/+63
| | | | | | | | | | | | wrapper .h files and asm labels to let internal calls resolve directly and not be overridable or use the PLT. Then, apply that framework to most of the functions in stdio.h, string.h, err.h, and wchar.h. Delete the should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here. tests clean on i386, amd64, sparc64, powerpc, and mips64 naming feedback from kettenis@ and millert@ ok kettenis@
* Hide many (194!) symbols that nothing should be using.guenther2015-08-265-64/+9
| | | | | | | Delete exect(2); it wasn't portable across archs and nothing used it. ports test build by naddy@ ok deraadt@ kettenis@
* Explicitly list the symbols permitted to be exported by libc.guenther2015-08-221-0/+10
| | | | | | | | This is primed with the current list of exported symbols so it doesn't change the ABI yet, but will prevent unintentional additions in the future and sets the stage for reductions. ok deraadt@ kettenis@
* Make index/rindex weak aliases of strchr/strrchr since they are notmillert2015-05-152-4/+4
| | | | | part of the ISO C standard and have also been dropped from POSIX. OK guenther@ kettenis@
* Use STRONG_ALIAS instead of ALTENTRY.kettenis2015-05-142-4/+6
| | | | ok millert@
* Eliminate the last uses of *fork's second syscall return register; the pidguenther2015-04-211-3/+3
| | | | | | is zero in the child ok deraadt@ miod@
* Make pthread_atfork() track the DSO that called it like atexit() does,guenther2015-04-072-3/+30
| | | | | | | | | | unregistering callbacks if the DSO is unloaded. Move the callback handling from libpthread to libc, though libpthread still overrides the inner call to handle locking and thread-library reinitialization. Major version bump for both libc and libpthread. verification that this fixes various ports ajacoutot@ asm assistance miod@; ok millert@ deraadt@
* Simplify fork/vfork logic: the kernel has handled returning zero in the childguenther2015-03-312-15/+3
| | | | | | | for a long time, so there's no need to test the second return register here in the asm stub. ok and testing of many archs by krw@ miod@
* remove code for ancient gcc.daniel2015-01-041-6/+1
| | | | ok millert@, kettenis@
* we do not need the complexity of an assembly swab function here.tedu2014-12-112-69/+2
| | | | ok deraadt
* Noone cares what castle the princess is inderaadt2014-12-023-5/+3
|
* sync bcopy/memmove/memcpy implementation with the kernel. ok deraadttedu2014-12-023-161/+46
|
* restructure libc/string + libc/arch/*/string coperation regardingderaadt2014-11-308-91/+207
| | | | | | | | | | | | | | | | (potentially) MD versions (function dependent, not filename dependent) split out memcpy/memmove/bcopy and strchr/index/strrchr/rindex Bring back amd64 .S versions And the final touch: switch all architectures temporarily to MI memcpy.c, which contains syslog + abort for overlapping copies. A nice harsh undefined behaviour. We will clean the entire userland of the remaining issues in this catagory, then switch to the optimised memcpy which skips the memmove check. I tried to cut this change into pieces, but testing each sub-step on every architecture is too time consuming and mindnumbing. ok miod
* let this compile with clang; no binary change with gcc.daniel2014-11-141-2/+2
| | | | ok deraadt@
* Nuke the machinery to sync libkern with libc, it's not been used in themiod2014-06-091-5/+1
| | | | | | last 15 years and there is no point to use it in the future. From Jean-Philippe Ouellet
* Apply "unifdef -D__STDC__" to libc/arch/*/SYS.hmatthew2014-06-041-14/+1
| | | | | | | | A while back, pascal@ converted our system call stubs from using "cpp | as" to "cc -x assembler-with-cpp", so there's no need to stay compatible with ancient preprocessor semantics. ok miod
* add proto for amd64 case; unify otherwisederaadt2013-11-121-1/+1
|
* Make sure the stack is 16-byte aligned otherwise the use of certain SSEkettenis2012-12-221-1/+4
| | | | | | instructions will fail. ok guenther@
* remove lint leftovers; ok guenther@okan2012-09-042-5/+2
|
* Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure ccpascal2012-08-2214-31/+31
| | | | | | | invocations. This allows us to use the compiler builtin define __PIC__ to check for PIC/PIEness rather than passing -DPIC. Simplifies PIE work a lot. ok matthew@, conceptually ok kurt@
* __tfork() needs to set the stack address of the new thread in the kernel,guenther2012-06-211-24/+20
| | | | | | | | | so that it can't get a signal while still running on the parent thread's stack. Also, pass in sizeof(struct __tfork) to provide forward compat when more members are added. This is an ABI change, so switch syscall numbers and bump lib majors this time. ok deraadt@ matthew@
* rely on the compiler giving us a built-in alloca. any new architecturederaadt2012-04-192-52/+2
| | | | | or compiler we use will. ok millert
* alloca.c cannot be usedderaadt2012-04-121-3/+1
|