summaryrefslogtreecommitdiffstats
path: root/lib/libc/arch/powerpc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add retguard to macppc kernel locore.S, ofwreal.S, setjmp.Sgkoehler2020-11-287-24/+24
| | | | | | | | | This changes RETGUARD_SETUP(ffs) to RETGUARD_SETUP(ffs, %r11, %r12) and RETGUARD_CHECK(ffs) to RETGUARD_CHECK(ffs, %r11, %r12) to show that r11 and r12 are in use between setup and check, and to pick registers other than r11 and r12 in some kernel functions. ok mortimer@ deraadt@
* Retguard asm macros for powerpc libc, ld.sogkoehler2020-10-269-64/+87
| | | | | | | | | | Add retguard to some, but not all, asm functions in libc. Edit SYS.h in libc to remove the PREFIX macros and add SYSENTRY (more like aarch64 and powerpc64), so we can insert RETGUARD_SETUP after SYSENTRY. Some .S files in this commit don't get retguard, but do stop using the old prefix macros. Tested by deraadt@, who put this diff in a macppc snap.
* SYS___threxit cannot fail, but this integration looks like a gadget.deraadt2020-10-181-1/+3
| | | | | Put a hard-trap instruction after the syscall instruction. ok kettenis mortimer
* Userland timecounter for macppcgkoehler2020-07-171-2/+22
| | | | | | | Tested by cwen@ and myself. Thanks to pirofti@ for creating the userland timecounter feature. ok kettenis@ pirofti@ deraadt@ cheloha@
* Add support for timeconting in userland.pirofti2020-07-062-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Provide an optimized implementation of ffs(3) in libc onnaddy2020-06-262-2/+18
| | | | | | aarch64/powerpc/powerpc64, making use of the count leading zeros instruction. Also add a brief regression test. ok deraadt@ kettenis@
* Unexport __floatundidf.kettenis2019-10-231-1/+0
| | | | ok deraadt@
* Unlike gas, clang's assembler complains about duplicate symbol assignments.guenther2019-07-141-2/+2
| | | | | | Tweak the PSEUDO() macro to avoid that. problem noted and tested by kettenis@
* Copy files from ../librthread in preparation for moving functionalityguenther2017-08-151-0/+53
| | | | | | | from libpthread to libc. No changes to the build yet, just making it easier to review the substantive diffs. ok beck@ kettenis@ tedu@
* RELRO means the __{got,plt}_{start,end} symbols are superfluousguenther2017-02-271-2/+0
| | | | ok kettenis@
* Wrap fpgetround() so internal calls to it (seen on arm, powerpc, and sh)guenther2016-07-262-4/+6
| | | | | | go direct instead of through the PLT. ok millert@ kettenis@
* Consistently reference '_end' instead of 'end' in the brk/sbrk implementationguenther2016-05-303-8/+7
| | | | ok deraadt@
* Only require 4 byte alignment on ILP32 archsguenther2016-05-291-2/+2
|
* Use .balign instead of .align; only need 8 byte alignment not 2^8guenther2016-05-291-2/+2
|
* Add XOR cookies for r1 (stack) and lr. Switch from calling obsoleteguenther2016-05-222-108/+209
| | | | | | | | sig{block,setmask} to directly using the sigprocmask syscall. Rewrite sig{set,long}jmp based on {set,long}jmp to avoid the deprecated store/load-multiple instructions. in snaps; ok deraadt@
* Oh right, actually delete this now that __cerror is unusedguenther2016-05-221-61/+0
|
* Add END() to match ENTRY() macrosguenther2016-05-152-3/+8
| | | | ok kettenis@
* TIB conversion is complete, so set errno in the syscall stub and eliminateguenther2016-05-156-21/+33
| | | | | | __cerror ok ketternis@
* Remove sigreturn declaration and the now-unused libc syscall stubguenther2016-05-091-29/+0
|
* No, sigaltstack's onstack flag shouldn't be saved. Delete commentguenther2016-05-081-2/+1
| | | | wondering about that
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-0710-57/+24
| | | | | | | | | | | | | | | | | 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-23/+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/+23
| | | | | | | | | | | 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-7/+7
| | | | | | | | | 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@
* Do provide hidden _libc_* aliases for sig{block,setmask} and use them inguenther2015-09-131-5/+5
| | | | | | | the ASM *setjmp implementations. Skip the PLT when calling them on amd64 (other archs to do this after testing) ok miod@
* Backtrack a little bit and don't try to use the per-thread errno location ifkettenis2015-09-091-23/+21
| | | | | | | | | | r2 is zero. Some upcoming changes will probably change the offset at which the errno pointer is stored, or might even store errno directly. Instead, call __errno to get the location of errno. Make sure we go through the PLT such that we call the version in libpthread if it is linked in. Set up r30 for this purpose. The ___cerrno function itself remains protected. ok guenther@
* Fix previous: restore a PSEUDO_SUFFIX macro to actually handle errno and returnguenther2015-09-051-1/+2
| | | | | cone of shame guenther@ ok deraadt@
* Adds hidden _libc_FOO aliases for the system call stubs.guenther2015-09-058-17/+34
| | | | | | | | 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-312-3/+28
| | | | | | | | | | | | 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@
* fix commentguenther2015-08-271-2/+2
|
* Hide many (194!) symbols that nothing should be using.guenther2015-08-264-51/+17
| | | | | | | Delete exect(2); it wasn't portable across archs and nothing used it. ports test build by naddy@ ok deraadt@ kettenis@
* Make __cerror() use the per-thread errno location if r2 isn't zero. This waykettenis2015-08-234-17/+25
| | | | | | | | | | | | libpthread no longer has to override it which means that we can use a local call and can avoid setting up r30 as a _GLOBAL_OFFSET_TABLE_ pointer, which is hard the way the powerpc ABI works. For now we continue to provide __cerror as a weak symbol, but ___cerror is now protected and internal calls within libc now use ___cerror instead of __cerror. discussed with guenther@
* Fetch the _GLOBAL_OFFSET_TABLE_ pointer in a way that's compatible with thekettenis2015-08-232-8/+12
| | | | Secure-PLT ABI.
* Set up r30 with the _GLOBAL_OFFSET_TABLE_ pointer as required by thekettenis2015-08-231-3/+21
| | | | Secure-PLT ABI.
* Explicitly list the symbols permitted to be exported by libc.guenther2015-08-221-0/+15
| | | | | | | | 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-5/+8
| | | | | | | | | | 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-311-2/+1
| | | | | | | 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@
* asm version from libkern, but mempcy() remains tied to thederaadt2014-12-042-2/+170
| | | | | MI syslog_r/abort version for the time being. ok miod
* restructure libc/string + libc/arch/*/string coperation regardingderaadt2014-11-301-3/+5
| | | | | | | | | | | | | | | | (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
* zap trailing newlines; "go for it" deraadtokan2014-07-161-1/+0
|
* Nuke the machinery to sync libkern with libc, it's not been used in themiod2014-06-091-4/+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-9/+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-178-19/+19
|
* 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
* these are no longer used; ok guentherderaadt2012-09-041-43/+0
|
* Fix missing PIC -> __PIC__ conversions; ok pascalderaadt2012-08-224-10/+10
|
* make this actually workkettenis2012-07-011-23/+21
| | | | ok miod@