summaryrefslogtreecommitdiffstats
path: root/lib/libc/amd64
Commit message (Collapse)AuthorAgeFilesLines
* MFC r304928:kib2016-09-032-56/+1
| | | | | | | | | | | | | Do not obliterate errno value in the main thread during ptrace(2) call on x86. MFC r304931: Follow ABI when calling __error from the ptrace(2) wrapper. MFC r305012: Rewrite ptrace(2) wrappers in C. MFC r305022: Restore the requirement of setting errno to zero before calling ptrace(2).
* MFC r285240:trasz2016-01-122-53/+1
| | | | | | | Remove reboot.S (part of libc). It's not needed and was actually broken - returning 0 from reboot(2) resulted in SIGBUS. Sponsored by: The FreeBSD Foundation
* MFC r287292:kib2015-09-052-4/+4
| | | | | | | | | | Switch libc from using _sig{procmask,action,suspend} symbols, which are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. MFC r287300: Use libthr interposed functions instead of syscalls, in posix_spawn()' child.
* libc: Access _logname_valid more efficiently.jilles2013-08-171-5/+0
| | | | | | | | | | | The variable _logname_valid is not exported via the version script; therefore, change C and i386/amd64 assembler code to remove indirection (which allowed interposition). This makes the code slightly smaller and faster. Also, remove #define PIC_GOT from i386/amd64 in !PIC mode. Without PIC, there is no place containing the address of each variable, so there is no possible definition for PIC_GOT.
* The getcontext() from the __fillcontextx() call in thekib2013-05-281-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | check_deferred_signal() returns twice, since handle_signal() emulates the return from the normal signal handler by sigreturn(2)ing the passed context. Second return is performed on the destroyed stack frame, because __fillcontextx() has already returned. This causes undefined and bad behaviour, usually the victim thread gets SIGSEGV. Avoid nested frame and the need to return from it by doing direct call to getcontext() in the check_deferred_signal() and using a new private libc helper __fillcontextx2() to complement the context with the extended CPU state if the deferred signal is still present. The __fillcontextx() is now unused, but is kept to allow older libthr.so to be used with the new libc. Mark __fillcontextx() as returning twice [1]. Reported by: pgj Pointy hat to: kib Discussed with: dim Tested by: pgj, dim Suggested by: jilles [1] MFC after: 1 week
* Rework the __vdso_* symbols attributes to only make the symbols weak,kib2013-01-301-0/+11
| | | | | | | | | | but use normal references instead of weak. This makes the statically linked binaries to use fast gettimeofday(2) by forcing the linker to resolve references and providing the neccessary functions. Reported by: bde Tested by: marius (sparc64) MFC after: 2 weeks
* libc/amd64: Do not export .cerror.jilles2012-09-0612-88/+9
| | | | | | | | | | | | | | | | | For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit in the FBSDprivate_1.0 version. It looks like there is no reason for this since it is not used from other libraries. Given that it cannot be accessed from C and its strange calling convention, it is rather unlikely that other things rely on it. Perhaps it is from a time when symbols could not be hidden. Most of the amd64 assembler code jumps to .cerror using the GOT. It can jump to it directly now, as in non-PIC mode. There are also some minor size optimizations to instructions but they yield virtually no benefit in the size of libc.so.7 due to padding. Reviewed by: kib
* Use struct vdso_timehands data to implement fast gettimeofday(2) andkib2012-06-222-1/+51
| | | | | | | | | | | | | | | clock_gettime(2) functions if supported. The speedup seen in microbenchmarks is in range 4x-7x depending on the hardware. Only amd64 and i386 architectures are supported. Libc uses rdtsc and kernel data to calculate current time, if enabled by kernel. Hopefully, this code is going to migrate into vdso in some future. Discussed with: bde Reviewed by: jhb Tested by: flo MFC after: 1 month
* Make the sys/ucontext.h self-contained by changing the return typekib2012-02-011-1/+1
| | | | | | | of __getcontextx_size(3) from size_t to int. PR: ports/164654 MFC after: 1 month
* Add API for obtaining extended machine context states that cannot bekib2012-01-212-1/+102
| | | | | | | | | | | fit into existing mcontext_t. On i386 and amd64 do return the extended FPU states using getcontextx(3). For other architectures, getcontextx(3) returns the same information as getcontext(2). Tested by: pho MFC after: 1 month
* Make sure that stack is 16-byte aligned before calling a function,kib2011-11-022-0/+6
| | | | | | | | | as it is required by amd64 ABI. Add a comment for the places were the stack is accidentally properly aligned already. PR: amd64/162214 Submitted by: yamayan <yamayan kbh biglobe ne jp> MFC after: 1 week
* Replace a proliferation of buggy MD implementations of modf() with adas2011-10-213-93/+1
| | | | | | | working MI one. The MI one only needs to be overridden on machines with non-IEEE754 arithmetic. (The last supported one was the VAX.) It can also be overridden if someone comes up with a faster one that actually passes the regression tests -- but this is harder than it sounds.
* Remove incorrect attribution.gnn2011-07-211-1/+1
| | | | | | Approved by: re (kib) Pointed out by: brueffer Pointy hat to: gnn
* Make both stpcpy and strcpy be assembly language implementationsgnn2011-07-213-20/+60
| | | | | | | | | on amd64. Submitted by: Guillaume Morin (guillaume at morinfr.org) Reviewed by: kib, jhb Approved by: re (bz) MFC after: 1 month
* Remove duplicate .note.GNU-stack section declaration. bcopy alreadykib2011-02-041-2/+0
| | | | | | made the neccessary provisions. Reported by: arundel
* Add section .note.GNU-stack for assembly files used by 386 and amd64.kib2011-01-0729-0/+57
|
* Retire the amd64 and i386 specific inline assembly versions of ldexp.c,dim2010-09-301-68/+0
| | | | | | | | as they are slower than the generic version in C, at least on modern hardware. This leaves us with just five implementations. Suggested by: bde Approved by: rpaulo (mentor)
* Apply the same workaround for clang to amd64's version of ldexp.c (as indim2010-09-291-3/+9
| | | | | | | | | | | | | r212976): order the incoming arguments to fscale as st(0), st(1), and mark temp2 volatile (only in case of compilation with clang) to force clang to pop it correctly. No binary change when compiled with gcc. This fixes ldexp() when compiled with clang on amd64, which makes drand48() and friends work correctly again, and this in turn fixes perl's tempfile(). Reported by: Renato Botelho, Derek Tattersall Approved by: rpaulo (mentor)
* Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.ed2008-11-091-2/+1
| | | | | | | | | | | | | | | | | | | | | Looking at our source code history, it seems the uname(), getdomainname() and setdomainname() system calls got deprecated somewhere after FreeBSD 1.1, but they have never been phased out properly. Because we don't have a COMPAT_FREEBSD1, just use COMPAT_FREEBSD4. Also fix the Linuxolator to build without the setdomainname() routine by just making it call userland_sysctl on kern.domainname. Also replace the setdomainname()'s implementation to use this approach, because we're duplicating code with sysctl_domainname(). I wasn't able to keep these three routines working in our COMPAT_FREEBSD32, because that would require yet another keyword for syscalls.master (COMPAT4+NOPROTO). Because this routine is probably unused already, this won't be a problem in practice. If it turns out to be a problem, we'll just restore this functionality. Reviewed by: rdivacky, kib
* We've been lax about matching END() macros in asm code for some time. Thispeter2008-11-0227-4/+46
| | | | | | | is used to set the ELF size attribute for functions. It isn't normally critical but some things can make use of it (gdb for stack traces). Valgrind needs it so I'm adding it in. The problem is present on all branches and on both i386 and amd64.
* Two FP-related setjmp/longjmp changes:das2008-06-282-2/+20
| | | | | | | | | | | | | | | 1. Save and restore the control part of the MXCSR in addition to the i387 control word to ensure that the two are consistent. Note that standards don't require longjmp to restore either control word, and none of Linux, MacOS X 10.3 and earlier, NetBSD, OpenBSD, or Solaris do it. However, it is historical FreeBSD behavior, and bde points out that it is needed to make longjmping out of a signal handler work properly, given the way FreeBSD clobbers the FPU state on signal handler entry. 2. Don't clobber the FPU exception flags in longjmp. C99 requires them to remain unchanged.
* Add an alternative view of the bits in an 80-bit long double (64+16bde2008-01-171-1/+6
| | | | | | | | | | | | | | | | | | | | instead of 32+32+15+1) on all arches that have such long doubles (amd64, ia64 and i386). Large objects should be be accessed in large units, and the 32+32+15+1[+padding] decomposition asks for almost the opposite of that, sometimes resulting in very slow accesses depending on how well the compiler ignores what we ask for and converts to the best units for the given machine. E.g., on Athlons, there is a 10-20 cycle penalty for accessing the middle 32-bit word immediately after an 80-bit store. Whether actually using the alternative view is better is very machine- dependent. A 32+32+16 view is probably best with old 32-bit systems and gcc through 4.2.1. The compiler should mostly avoid the view and generate best accesses, but gcc-4.2.1 is far from doing that. I think 64+16 is best for now. Similarly for doubles -- they should be using 64+0 especially on 64-bit machines, but fdlibm uses 32+32 extensively for them. Fortunately, in 64-bit mode for doubles, gcc already ignores the 32+32-bit view and generates best accesses in many cases.
* Since nan() is supposed to work the same as strtod("nan(...)", NULL),das2007-12-181-3/+0
| | | | | | | | | | | | my original implementation made both use the same code. Unfortunately, this meant libm depended on a vendor header at compile time and previously- unexposed vendor bits in libc at runtime. Hence, I just wrote my own version of the relevant vendor routine. As it turns out, mine has a factor of 8 fewer of lines of code, and is a bit more readable anyway. The strtod() and *scanf() routines still use vendor code. Reviewed by: bde
* Export gdtoa's __ULto{x,Q}_D2A routine in a private namespace sodas2007-12-161-0/+3
| | | | libm can use it.
* Arrange so that the NaN returned by strtod("nan", NULL) is the same asdas2007-12-161-4/+4
| | | | the NaN returned by strtod("nan()", NULL).
* In scanf, round according to the current rounding mode.das2007-12-031-1/+1
|
* Classify mmap, lseek, pread, pwrite, truncate, ftruncate as pseudopeter2007-07-041-3/+5
| | | | | | | | | | syscalls, unless WITHOUT_SYSCALL_COMPAT is defined. The default case will have the .c wrappers still. If you define WITHOUT_SYSCALL_COMPAT, the .c wrappers will go away and libc will make direct syscalls. After 7-stable starts, the direct syscall method will be default. Approved by: re (kensmith)
* Adjust the syscall stub macros to be consistent in their meaning. Inpeter2007-07-041-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | particular: SYSCALL() makes a syscall, with errno handling, and continues execution directly after the macro in the non-error case. RSYSCALL() is just like SYSCALL(), but returns after success. Both SYSCALL(name) and RSYSCALL(name) export "__sys_name" as a strong symbol, with "_name" and "name" as weak aliases. PSEUDO() is just like RSYSCALL(), but skipping the "name" weak alias. It still does "__sys_name" and "_name". Change i386 to add errno handling to PSEUDO. The same for amd64 and sparc64, with appear to have copied the behavior. ia64 was correct (as was alpha). Just remove some apparently unused variants of the macros. (untested!) I believe powerpc is correct. Fix arm to not export "name" from the PSEUDO case. Remove apparently extra unused variants. (untested!) The errno problem manifested on i386/amd64/sparc64 by having "PSEUDO" classified syscalls return without setting errno. eg: "addr = mmap()" could return with "addr" = 22 instead of setting errno to 22 and returning -1. Approved by: re (kensmith)
* Some libc symbol map cleanups.deischen2007-05-311-4/+0
| | | | | | | | | | | | | | | | | | | | | net: endhostdnsent is named _endhostdnsent and is private to netdb family of functions. posix1e: acl_size.c has been never compiled in, so there's no "acl_size". rpc: "getnetid" is a static function. stdtime: "gtime" is #ifdef'ed out in the source. some symbols are specific only to some architectures, e.g., ___tls_get_addr is only defined on i386. __htonl, __htons, __ntohl and __ntohs are no longer functions, they are now (internal) defines in <machine/endian.h>. Submitted by: ru
* Remove .mcount from gmon's Symbol map and add it to the appropriatedeischen2007-05-131-0/+1
| | | | | | | arch. It can be named differently depending on the arch (.mcount, _mcount). Submitted by: marius
* Use C comments since we now preprocess these files with CPP.deischen2007-04-291-12/+16
|
* Import amd64 assembly implementations of div(3) family from NetBSD.jkim2007-04-044-0/+51
| | | | Obtained from: NetBSD
* Remove silly n that crept inimp2007-01-091-1/+1
|
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-0916-65/+1
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* The distinction between quiet and signaling NaN formats isdas2007-01-031-0/+21
| | | | | machine-dependent; these files tell the latest version of gdtoa what to do.
* Instead of re-implementing hton[ls] and friends for each arch, add a new MIcognet2006-11-065-206/+0
| | | | | | | file, net/ntoh.c, which just implement them using the inline functions from <sys/endian.h>. Suggested by: bde
* Desupport the undocumented NO_QUAD option, just don't compileru2006-03-161-5/+0
| | | | the quad support on 64-bit platforms.
* Add each directory's symbol map file to SYM_MAPS.deischen2006-03-131-0/+1
|
* Add symbol maps and initial symbol version definitions to libc.deischen2006-03-131-0/+73
| | | | Reviewed by: davidxu
* Optimize the instruction alignment.alc2005-04-231-2/+1
|
* Do not try to store 64 bits into 32 bit errno variable. With the changed libckan2005-04-211-1/+1
| | | | | data layout, this was corrupting _PathLocale variable leading to programs dumping core in non-default locales.
* Add a machine-specific, optimized implementation of strcat.alc2005-04-102-1/+166
| | | | | | PR: 73111 Submitted by: Ville-Pertti Keinonen <will@iki.fi> (taken from NetBSD) MFC after: 3 weeks
* Eliminate a conditional branch and as a side-effect eliminate a branch toalc2005-04-101-5/+4
| | | | | | | | a return instruction. (The latter is discouraged by the Opteron optimization manual because it disables branch prediction for the return instruction.) Reviewed by: bde
* Add a machine-specific, optimized implementation of strcpy.alc2005-04-102-1/+113
| | | | | | PR: 73111 Submitted by: Ville-Pertti Keinonen <will@iki.fi> (taken from NetBSD) MFC after: 3 weeks
* Add a machine-specific, optimized implementation of strcmp.alc2005-04-092-1/+75
| | | | | | PR: 73111 Submitted by: Ville-Pertti Keinonen <will@iki.fi> (taken from NetBSD) MFC after: 3 weeks
* Add machine-specific, optimized implementations of bcmp and memcmp.alc2005-04-083-1/+67
| | | | | | PR: 73111 Submitted by: Ville-Pertti Keinonen <will@iki.fi> (taken from NetBSD) MFC after: 3 weeks
* Eliminate unneeded instructions that are a vestige of mechanicalalc2005-04-081-10/+4
| | | | translation from i386.
* Eliminate an unneeded instruction that is a vestige of mechanicalalc2005-04-071-7/+5
| | | | translation from i386.
* Add machine-specific, optimized implementations of bcopy, bzero, memcpy,alc2005-04-076-0/+212
| | | | | | | | memmove, and memset. PR: 73111 Submitted by: Ville-Pertti Keinonen <will@iki.fi> (taken from NetBSD) MFC after: 3 weeks
* Remove fpsetsticky(). This was added for SysV compatibility, but duedas2005-03-152-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to mistakes from day 1, it has always had semantics inconsistent with SVR4 and its successors. In particular, given argument M: - On Solaris and FreeBSD/{alpha,sparc64}, it clobbers the old flags and *sets* the new flag word to M. (NetBSD, too?) - On FreeBSD/{amd64,i386}, it *clears* the flags that are specified in M and leaves the remaining flags unchanged (modulo a small bug on amd64.) - On FreeBSD/ia64, it is not implemented. There is no way to fix fpsetsticky() to DTRT for both old FreeBSD apps and apps ported from other operating systems, so the best approach seems to be to kill the function and fix any apps that break. I couldn't find any ports that use it, and any such ports would already be broken on FreeBSD/ia64 and Linux anyway. By the way, the routine has always been undocumented in FreeBSD, except for an MLINK to a manpage that doesn't describe it. This manpage has stated since 5.3-RELEASE that the functions it describes are deprecated, so that must mean that functions that it is *supposed* to describe but doesn't are even *more* deprecated. ;-) Note that fpresetsticky() has been retained on FreeBSD/i386. As far as I can tell, no other operating systems or ports of FreeBSD implement it, so there's nothing for it to be inconsistent with. PR: 75862 Suggested by: bde
OpenPOWER on IntegriCloud