summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/arm
AgeCommit message (Collapse)AuthorFilesLines
2020-10-19replace ad-hoc illegal instruction with the architecturally defined onenaddy1-2/+2
("permanently undefined") ok deraadt@ kettenis@
2020-10-18SYS___threxit cannot fail, but this integration looks like a gadget.deraadt1-1/+2
Put a hard-trap instruction after the syscall instruction. ok kettenis mortimer
2020-07-06Add support for timeconting in userland.pirofti2-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@
2020-03-13Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt1-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
2020-03-11Anthony Steinhauser reports that 32-bit arm cpus have the same speculationderaadt1-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
2019-11-10Mark as 'protected' all the routines from the quad/ and softfloat/ subdirs,guenther1-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@
2019-10-26Stop exporting the internal _mcount symbol as that's only referencedguenther1-1/+0
by the ASM stub, which is also in libc. The compiler only generates invocations of the latter. ok mpi@ deraadt@ kettenis@
2018-06-22Save and restore the relevant FPU state on armv7.kettenis3-28/+26
ok deraadt@
2018-05-28Clear the sign bit in the QNAN constants used by strtof, strtod and strtold,jmatthew1-4/+4
so passing "nan" and "-nan" produces a NaN with the right sign. Bug reported and diff provided by George Koehler. ok kettenis@
2018-05-17Drop memory barrier in _atomic_lock() implementation since the callers nowkettenis1-2/+1
take care of this. ok visa@, mpi@
2018-02-28Change floating-point mode/environment control functions to operate onkettenis7-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@
2018-01-21Implement ffs(3) using the CLZ instructions which has been available everkettenis1-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@
2018-01-19Partial revert of rev. 1.7, fixes build with clangjca1-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@
2018-01-18Instead of trying to handle ffs() with the normal rename-mark-hidden-and-aliasguenther1-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@
2018-01-14Add two more ARM EABI aliases that I missed in the previous libc minorkettenis1-0/+2
bump. "just go ahead -- crank" deraadt@
2017-12-26Add ARM EABI runtime aliases to the GCC runtime functions that we includekettenis2-1/+32
in libc. ok patrick@, jsg@, guenther@
2017-12-16Don't use _libc_ prefix when referencing "builtin" symbols with clang.kettenis2-3/+8
Slightly tweaked diff from guenther@
2017-11-29clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"guenther4-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@
2017-11-21Avoid .align 0. Clang's integrated assembler actually honors this directivekettenis3-9/+6
and the resulting byte-alignment triggers unaligned access. ok patrick@, deraadt@
2017-10-29Stop exporting _memcpy, an implementation detail of bcopy/memcpy/memmoveguenther5-9/+10
ok kettenis@ deraadt@
2017-10-28Stop exporting some symbols internal to the softfloat implementation,kettenis1-27/+0
unneeded linker-generated symbols and libgcc symbols that are accidentally re-exported. Riding the upcoming libc major bump. ok guenther@
2017-08-15Copy files from ../librthread in preparation for moving functionalityguenther1-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@
2016-10-04Use the userspace-visible thread register directly in __cerror insteadguenther1-6/+8
of indirecting through __errno(). Register naming tweaks and clang testing by patrick@ and jsg@ ok kettenis@
2016-09-18Use unified syntax such that this compiles with both gcc and clang.kettenis1-2/+4
ok jsg@
2016-09-18unbreak the build by including stddef.h for the definition of NULLjsg1-1/+2
fix suggested by and ok guenther@
2016-09-17Add an interface to find the ARM.exidx table for use by the ARM EHABI unwinder.kettenis4-1/+87
Makes exceptions work in C++ code work again om armv7. ok guenther@
2016-08-07Add XOR cookies for lr and sp. Stop saving/restoring r12 to/from the jmpbuf.guenther2-52/+96
Switch from calling obsolete sig{block,setmask} to directly using the sigprocmask syscall. ok deraadt@ kettenis@
2016-08-06Use internal names for __errno, _memcpy, memset, and {,_}{set,long}jmpguenther24-87/+106
Eliminate pointless use of PIC_SYM() Split out DEFS.h from SYS.h like some other archs ok kettenis@ deraadt@
2016-05-30Consistently reference '_end' instead of 'end' in the brk/sbrk implementationguenther3-7/+6
ok deraadt@
2016-05-23Stop supporting longjmperror(); it's not used, not portable, and the checksguenther2-6/+4
longjmp performs can't really be relied upon, even after we got rid of the false positives... ok millert@ deraadt@
2016-05-09Remove sigreturn declaration and the now-unused libc syscall stubguenther1-41/+0
2016-05-07Use a Thread Information Block in both single and multi-threaded programs.guenther6-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@
2016-04-28remove duplicate strrchr.c entry in SRCSjsg1-2/+2
ok deraadt@
2016-03-21The asm in the MD_DISABLE_KBIND macro was too fragile and broke alpha and hppa.guenther1-27/+0
So instead, do the kbind disabling with syscall(). debugging and ok deraadt@, ok kettenis@
2016-03-20Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther1-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@
2015-10-27Wrap the remaining math functions in libc: __fpclassify*(), __flt_rounds(),guenther1-1/+2
and ldexp(). ok millert@
2015-10-23Merge the sigaction() and sigprocmask() overloads/wrappers from libpthreadguenther2-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@
2015-10-18Pull in <float.h> instead of declaring __flt_rounds() locallyguenther1-3/+2
ok miod@ jsg@
2015-09-13Uses angle brackets to include softfloat.h, and add the proper directory tomiod1-1/+2
CFLAGS. ok guenther@
2015-09-13Do provide hidden _libc_* aliases for sig{block,setmask} and use them inguenther1-3/+3
the ASM *setjmp implementations. Skip the PLT when calling them on amd64 (other archs to do this after testing) ok miod@
2015-09-10Adds hidden _libc_FOO aliases for the system call stubs.guenther9-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@
2015-08-31use #function rather than @function on armderaadt1-2/+2
ok guenther
2015-08-31Add framework for resolving (pun intended) libc namespace issues, usingguenther11-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@
2015-08-26Hide many (194!) symbols that nothing should be using.guenther5-68/+14
Delete exect(2); it wasn't portable across archs and nothing used it. ports test build by naddy@ ok deraadt@ kettenis@
2015-08-22Explicitly list the symbols permitted to be exported by libc.guenther1-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@
2015-06-08At some point arm moved to a unified syntax for arm and thumb instructions.jsg2-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@
2015-05-15Make index/rindex weak aliases of strchr/strrchr since they are notmillert1-2/+2
part of the ISO C standard and have also been dropped from POSIX. OK guenther@ kettenis@
2015-04-07Make pthread_atfork() track the DSO that called it like atexit() does,guenther2-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@
2015-03-31Stop encoding the syscall number in the swi instruction - this has beenjsing1-4/+3
unused for around 8 years, when the kernel ABI was changed to use the syscall number specified in r12. ok miod@ jsg@
2015-03-31Simplify fork/vfork logic: the kernel has handled returning zero in the childguenther2-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@