summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/sh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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@
* use END_STRONG. Yes, everything in the sh ecosystem is different..deraadt2018-01-231-2/+2
|
* 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@
* Copy files from ../librthread in preparation for moving functionalityguenther2017-08-151-0/+46
| | | | | | | from libpthread to libc. No changes to the build yet, just making it easier to review the substantive diffs. ok beck@ kettenis@ tedu@
* Wrap fpgetround() so internal calls to it (seen on arm, powerpc, and sh)guenther2016-07-262-4/+5
| | | | | | go direct instead of through the PLT. ok millert@ kettenis@
* Consistently reference '_end' instead of 'end' in the brk/sbrk implementationguenther2016-05-303-6/+5
| | | | ok deraadt@
* Save and restore 'gbr' register when enter/leaving the kernel, and useguenther2016-05-188-110/+35
| | | | | | it for the TCB pointer. Eliminate __cerror. "looks good" kettenis@, testing and ok deraadt@
* Remove sigreturn declaration and the now-unused libc syscall stubguenther2016-05-091-41/+0
|
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-076-73/+25
| | | | | | | | | | | | | | | | | 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@
* Invoke the _HIDDEN() sigprocmask label rather than the public one.miod2015-10-312-8/+10
|
* This is sigprocmask, not sigpending.miod2015-10-311-2/+2
|
* Wrap the remaining math functions in libc: __fpclassify*(), __flt_rounds(),guenther2015-10-271-1/+2
| | | | | | and ldexp(). ok millert@
* Merge the sigaction() and sigprocmask() overloads/wrappers from libpthreadguenther2015-10-232-4/+5
| | | | | | | | | 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@
* Uses angle brackets to include softfloat.h, and add the proper directory tomiod2015-09-131-1/+2
| | | | | CFLAGS. ok guenther@
* Adds hidden _libc_FOO aliases for the system call stubs.guenther2015-09-107-27/+46
| | | | | | | | | | 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. alpha, arm, m88k, sh, sparc, and vax assistance miod@ hppa assistance kettenis@ ok deraadt@ miod@
* Add framework for resolving (pun intended) libc namespace issues, usingguenther2015-08-316-11/+45
| | | | | | | | | | | | 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-264-65/+14
| | | | | | | 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/+18
| | | | | | | | 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-151-2/+2
| | | | | part of the ISO C standard and have also been dropped from POSIX. OK guenther@ kettenis@
* Make pthread_atfork() track the DSO that called it like atexit() does,guenther2015-04-072-7/+21
| | | | | | | | | | 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-42/+4
| | | | | | | 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@
* restructure libc/string + libc/arch/*/string coperation regardingderaadt2014-11-304-146/+488
| | | | | | | | | | | | | | | | (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
* Switch from <sys/endian.h> or <machine/endian.h> to the new,guenther2014-07-216-13/+13
| | | | | | being-standardized <endian.h> ok deraadt@ millert@ beck@
* Apply "unifdef -D__STDC__" to libc/arch/*/SYS.hmatthew2014-06-041-18/+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
* It's been a quarter century: we can assume volatile is present with that name.guenther2014-04-188-19/+19
|
* Remove #ifdef _REENTRANT code that isn't used here. These days, the codekettenis2013-12-311-22/+1
| | | | | | handling per-thread errno lives in librthread. ok miod@, espie@
* Switch libc and libm to use strong aliases rather than weak aliasesmartynas2013-03-281-2/+2
| | | | | | | | | | | where appropriate. Among other things makes the symbols consistent across all architectures (notably where ldbl mantissa is 53 bits). While at it, kill unused LINTLIBRARY/PROTOLIB1 cruft which was there to trick lint into recording the right prototypes for aliased functions. Most of the work done at the awesome n2k13 hackathon. Agreed by kettenis@, guenther@, matthew@.
* Remove excessive sys/cdefs.h inclusionderaadt2012-12-051-2/+1
| | | | ok guenther millert kettenis
* remove lint leftovers; ok guenther@okan2012-09-041-3/+1
|
* Convert cpp | as rules in bsd.lib.mk and lib/libc/sys/Makefile.inc to pure ccpascal2012-08-224-13/+13
| | | | | | | 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@
* adapt the NetBSD code to make sigpending work on shjsg2012-07-031-2/+6
| | | | ok miod@ kettenis@
* Do not use <machine/float.h>, that is an deformed BSD-ism.deraadt2012-06-251-2/+2
| | | | | It turns out <float.h> is the right file to pull in. ok millert
* __tfork() needs to set the stack address of the new thread in the kernel,guenther2012-06-211-4/+3
| | | | | | | | | 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@
* remove rfork(); ok guenther miodderaadt2012-04-121-32/+0
|
* Move __tfork_thread() from rthreads (libpthread) to libc so thatguenther2012-03-221-0/+61
| | | | | | it can be used for not-strictly-threading purposes ok matthew@ kurt@
* Revert (leaving the complex math part alone). Some stuff is dependingmartynas2011-07-082-3/+43
| | | | | on this historical behavior; so we're stuck in this stupid situation. No cookie for me.
* Move fabs(3), frexp(3), and modf(3) to libm--nothing has been usingmartynas2011-07-082-43/+3
| | | | them in libc for a very long time. OK guenther@.
* Move __cerror to ___cerror with a weak alias so that rthreads can override it.guenther2011-04-042-4/+7
| | | | | | On mips64, also correct the name called from plain cerror to __cerror. "looks correct" miod@
* Provide a WEAK_ALIAS macro in <machine/asm.h> for the few platformsguenther2010-10-011-5/+3
| | | | | | | that didn't already have one, and then immediately use it in libc's SYS.h ok miod@
* remove from gen so that lint doesn't check gen if assembly versionsmartynas2009-04-211-2/+3
| | | | are available. spotted by theo
* - ldexp implementation has issues. switch to the one from libmmartynas2009-04-193-452/+2
| | | | | | - remove frexp in hppa64, cloned from hppa - move generic ieee754 implementations of modf and ldexp to gen ok kettenis@, "looks good" millert@
* this is not a write-only register. might have caused to optimizemartynas2009-04-051-2/+2
| | | | it away. ok miod@
* use sys/cdefs.h; pointed out by theomartynas2008-12-102-4/+4
|
* ditto frexpl and ldexplmartynas2008-12-091-1/+4
|
* alias fabsl to fabs on these archsmartynas2008-12-091-1/+4
|
* - replace dtoa w/ David's gdtoa, version 2008-03-15martynas2008-09-073-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - provide proper dtoa locks - use the real strtof implementation - add strtold, __hdtoa, __hldtoa - add %a/%A support - don't lose precision in printf, don't round to double anymore - implement extended-precision versions of libc functions: fpclassify, isnan, isinf, signbit, isnormal, isfinite, now that the ieee.h is fixed - separate vax versions of strtof, and __hdtoa - add complex math support. added functions: cacos, casin, catan, ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp, clog, cabs, cpow, csqrt, carg, cimag, conj, cproj, creal, cacosf, casinf, catanf, ccosf, csinf, ctanf, cacoshf, casinhf, catanhf, ccoshf, csinhf, ctanhf, cexpf, clogf, cabsf, cpowf, csqrtf, cargf, cimagf, conjf, cprojf, crealf - add fdim, fmax, fmin - add log2. (adapted implementation e_log.c. could be more acruate & faster, but it's good enough for now) - remove wrappers & cruft in libm, supposed to work-around mistakes in SVID, etc.; use ieee versions. fixes issues in python 2.6 for djm@ - make _digittoint static - proper definitions for i386, and amd64 in ieee.h - sh, powerpc don't really have extended-precision - add missing definitions for mips64 (quad), m{6,8}k (96-bit) float.h for LDBL_* - merge lead to frac for m{6,8}k, for gdtoa to work properly - add FRAC*BITS & EXT_TO_ARRAY32 definitions in ieee.h, for hdtoa&ldtoa to use - add EXT_IMPLICIT_NBIT definition, which indicates implicit normalization bit - add regression tests for libc: fpclassify and printf - arith.h & gd_qnan.h definitions - update ieee.h: hppa doesn't have quad-precision, hppa64 does - add missing prototypes to gdtoaimp - on 64-bit platforms make sure gdtoa doesn't use a long when it really wants an int - etc., what i may have forgotten... - bump libm major, due to removed&changed symbols - no libc bump, since this is riding on djm's libc major crank from a day ago discussed with / requested by / testing theo, sthen@, djm@, jsg@, merdely@, jsing@, tedu@, brad@, jakemsr@, and others. looks good to millert@ parts of the diff ok kettenis@ this commit does not include: - man page changes
* - move isinf, isnan dups to gen, since most is ieee 754martynas2008-07-244-96/+17
| | | | | | | | | | | | | | | | - is{inf,nan} should be macros for real-floating, so rename to __is{inf,nan}, per C99 - implement C99 __fpclassify(), __fpclassifyf(), __isfinite(), __isfinitef(), __isnormal(), __isnormalf(), __signbit(), __signbitf() - long functions added, but not yet enabled, till ieee.h is fixed - implement vax equivalents of the functions - reimplement isinff, isnanf in a better way, and move to libc - add qnan bytes for all archs - bump major man pages will follow ok millert@. arm bits looked over by drahn@ discussed w/ theo, who showed the right direction, to put these functions in libc
* clear sign bit, instead of comparing to zero and setting x=-x.martynas2008-07-231-6/+12
| | | | | | | fixes special cases, such as neg. zero, and makes C99 conformant ok miod@, millert@ since there's nothing else in arm's fabs.c, replace 4-clause license w/ the one at /usr/share/misc/license.template