summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/arm (follow)
Commit message (Collapse)AuthorAgeFilesLines
* replace ad-hoc illegal instruction with the architecturally defined onenaddy2020-10-191-2/+2
| | | | | ("permanently undefined") ok deraadt@ 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@
* Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt2020-03-131-3/+3
| | | | | | | | | | | problems as 64-bit models. To resolve the syscall speculation, as a first step "nop; nop" was added after all occurances of the syscall ("swi 0") instruction. Then the kernel was changed to jump over the 2 extra instructions. In this final step, those pair of nops are converted into the speculation-blocking sequence ("dsb nsh; isb"). Don't try to build through these multiple steps, use a snapshot instead. Packages matching the new ABI will be out in a while... ok kettenis
* Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt2020-03-111-3/+5
| | | | | | problems as 64-bit models. For the syscall instruction issue, add nop;nop after swi 0, in preparation for jumping over a speculation barrier here later. ok kettenis
* Mark as 'protected' all the routines from the quad/ and softfloat/ subdirs,guenther2019-11-101-1/+4
| | | | | | | | | as well as those in arch/arm/gen/divsi3.S. This cleans up the PLTs on the 32bit archs. luna88k testing by aoyama@ "looks good" kettenis@, testing and ok deraadt@
* Stop exporting the internal _mcount symbol as that's only referencedguenther2019-10-261-1/+0
| | | | | | | by the ASM stub, which is also in libc. The compiler only generates invocations of the latter. ok mpi@ deraadt@ kettenis@
* Save and restore the relevant FPU state on armv7.kettenis2018-06-223-28/+26
| | | | 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@
* Drop memory barrier in _atomic_lock() implementation since the callers nowkettenis2018-05-171-2/+1
| | | | | | take care of this. ok visa@, mpi@
* Change floating-point mode/environment control functions to operate onkettenis2018-02-287-1/+215
| | | | | | | | | | both the hardfloat (FPU registers) and softfloat (software) state. This makes these functions work correctly when mixing hardfloat and softfloat code. Disable trapping for softfloat since most (if not all) ARMv7 and ARMv8 hardware that is on the market doesn't support trapping of floating-point exceptions. ok patrick@
* Implement ffs(3) using the CLZ instructions which has been available everkettenis2018-01-211-43/+6
| | | | | | | | | since ARMv5. Should be much faster but more importantly it removes the data table from .text which could introduce unwanted ROP gadgets. Based on changes in Android/Bionic by Elliott Hughes. ok patrick@
* Partial revert of rev. 1.7, fixes build with clangjca2018-01-191-2/+1
| | | | | | | | | | | The error was: --8<-- ffs.S:57:2: error: unsupported relocation on symbol adrne r2, .L_ffs_table ^ -->8-- Minimal workaround suggested by deraadt@, ok guenther@ kettenis@
* Instead of trying to handle ffs() with the normal rename-mark-hidden-and-aliasguenther2018-01-181-3/+5
| | | | | | | 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@
* Add two more ARM EABI aliases that I missed in the previous libc minorkettenis2018-01-141-0/+2
| | | | | | bump. "just go ahead -- crank" deraadt@
* Add ARM EABI runtime aliases to the GCC runtime functions that we includekettenis2017-12-262-1/+32
| | | | | | in libc. ok patrick@, jsg@, guenther@
* Don't use _libc_ prefix when referencing "builtin" symbols with clang.kettenis2017-12-162-3/+8
| | | | Slightly tweaked diff from guenther@
* clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"guenther2017-11-294-7/+16
| | | | | | | | | 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@
* Avoid .align 0. Clang's integrated assembler actually honors this directivekettenis2017-11-213-9/+6
| | | | | | and the resulting byte-alignment triggers unaligned access. ok patrick@, deraadt@
* Stop exporting _memcpy, an implementation detail of bcopy/memcpy/memmoveguenther2017-10-295-9/+10
| | | | ok kettenis@ deraadt@
* Stop exporting some symbols internal to the softfloat implementation,kettenis2017-10-281-27/+0
| | | | | | | | | unneeded linker-generated symbols and libgcc symbols that are accidentally re-exported. Riding the upcoming libc major bump. ok guenther@
* Copy files from ../librthread in preparation for moving functionalityguenther2017-08-151-0/+49
| | | | | | | from libpthread to libc. No changes to the build yet, just making it easier to review the substantive diffs. ok beck@ kettenis@ tedu@
* Use the userspace-visible thread register directly in __cerror insteadguenther2016-10-041-6/+8
| | | | | | | of indirecting through __errno(). Register naming tweaks and clang testing by patrick@ and jsg@ ok kettenis@
* Use unified syntax such that this compiles with both gcc and clang.kettenis2016-09-181-2/+4
| | | | ok jsg@
* unbreak the build by including stddef.h for the definition of NULLjsg2016-09-181-1/+2
| | | | fix suggested by and ok guenther@
* Add an interface to find the ARM.exidx table for use by the ARM EHABI unwinder.kettenis2016-09-174-1/+87
| | | | | | Makes exceptions work in C++ code work again om armv7. ok guenther@
* Add XOR cookies for lr and sp. Stop saving/restoring r12 to/from the jmpbuf.guenther2016-08-072-53/+97
| | | | | | | Switch from calling obsolete sig{block,setmask} to directly using the sigprocmask syscall. ok deraadt@ kettenis@
* Use internal names for __errno, _memcpy, memset, and {,_}{set,long}jmpguenther2016-08-0624-87/+106
| | | | | | | Eliminate pointless use of PIC_SYM() Split out DEFS.h from SYS.h like some other archs ok kettenis@ deraadt@
* Consistently reference '_end' instead of 'end' in the brk/sbrk implementationguenther2016-05-303-7/+6
| | | | ok deraadt@
* Stop supporting longjmperror(); it's not used, not portable, and the checksguenther2016-05-232-6/+4
| | | | | | | longjmp performs can't really be relied upon, even after we got rid of the false positives... ok millert@ 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-76/+16
| | | | | | | | | | | | | | | | | 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@
* remove duplicate strrchr.c entry in SRCSjsg2016-04-281-2/+2
| | | | ok deraadt@
* 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-271-1/+2
| | | | | | 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@
* Pull in <float.h> instead of declaring __flt_rounds() locallyguenther2015-10-181-3/+2
| | | | ok miod@ jsg@
* Uses angle brackets to include softfloat.h, and add the proper directory tomiod2015-09-131-1/+2
| | | | | CFLAGS. ok guenther@
* Do provide hidden _libc_* aliases for sig{block,setmask} and use them inguenther2015-09-131-3/+3
| | | | | | | 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-109-18/+38
| | | | | | | | | | 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@
* use #function rather than @function on armderaadt2015-08-311-2/+2
| | | | ok guenther
* Add framework for resolving (pun intended) libc namespace issues, usingguenther2015-08-3111-21/+55
| | | | | | | | | | | | 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-68/+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/+96
| | | | | | | | 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@
* At some point arm moved to a unified syntax for arm and thumb instructions.jsg2015-06-082-37/+41
| | | | | | | | | While binutils supports both "unified" and "divided" syntax (defaulting to divided) the integrated assembler in clang only supports unified names so switch some files to unified syntax. Similiar changes were made in bitrig and freebsd. No difference in objdump -d output. tested on zaurus by deraadt@, ok miod@
* 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-3/+17
| | | | | | | | | | 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@
* Stop encoding the syscall number in the swi instruction - this has beenjsing2015-03-311-4/+3
| | | | | | | unused for around 8 years, when the kernel ABI was changed to use the syscall number specified in r12. ok miod@ jsg@
* Simplify fork/vfork logic: the kernel has handled returning zero in the childguenther2015-03-312-23/+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@