summaryrefslogtreecommitdiffstats
path: root/lib/libc/amd64/sys
Commit message (Collapse)AuthorAgeFilesLines
* MFC r304285:kib2016-09-162-71/+1
| | | | Implement userspace gettimeofday(2) with HPET timecounter.
* 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).
* Replace use of the pipe(2) system call with pipe2(2) with a zero flagsbrooks2016-06-222-54/+1
| | | | | | | | | | | | | | | | value. This eliminates the need for machine dependant assembly wrappers for pipe(2). It also make passing an invalid address to pipe(2) return EFAULT rather than triggering a segfault. Document this behavior (which was already true for pipe2(2), but undocumented). Reviewed by: andrew Approved by: re (gjb) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6815
* libc/{i386,amd64}: Do not export .cerror when building WITHOUT_SYMVERemaste2016-03-081-0/+1
| | | | | | | | | | | | | | | Further to r240152 (i386) and r240178 (amd64), hide the .cerror symbol so that it is not exported if symbol versioning is not in use. Without this change WITHOUT_SYMVER libc contains .text relocations for .cerror, as described in LLVM PR 26813 (http://llvm.org/pr26813). This is a no-op for the regular build as the symbol version script already controls .cerror visibility. PR: 207712 Submitted by: Rafael EspĂ­ndola Reviewed by: jilles, kib Differential Revision: https://reviews.freebsd.org/D5571
* Copy the fencing of the algorithm to do lock-less update and readingkib2015-08-041-3/+13
| | | | | | | | | | | | | | of the timehands, from the kern_tc.c implementation to vdso. Add comments giving hints where to look for the algorithm explanation. To compensate the removal of rmb() in userspace binuptime(), add explicit lfence instruction before rdtsc. On i386, add usual complications to detect SSE2 presence; assume that old CPUs which do not implement SSE2 also execute rdtsc almost in order. Reviewed by: alc, bde (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Remove reboot.S (part of libc). It's not needed and was actuallytrasz2015-07-072-51/+1
| | | | | | | broken - returning 0 from reboot(2) resulted in SIGBUS. MFC after: 1 month Sponsored by: The FreeBSD Foundation
* The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), andkib2015-04-181-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | pwrite(2) syscalls are wrapped to provide compatibility with pre-7.x kernels which required padding before the off_t parameter. The fcntl(2) contains compatibility code to handle kernels before the struct flock was changed during the 8.x CURRENT development. The shims were reasonable to allow easier revert to the older kernel at that time. Now, two or three major releases later, shims do not serve any purpose. Such old kernels cannot handle current libc, so revert the compatibility code. Make padded syscalls support conditional under the COMPAT6 config option. For COMPAT32, the syscalls were under COMPAT6 already. Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to (partially) disable the removed shims. Reviewed by: jhb, imp (previous versions) Discussed with: peter Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Convert from WITHOUT_SYSCALL_COMPAT to MK_SYSCALL_COMPAT.imp2014-04-051-1/+1
|
* Introduce a WEAK_REFERENCE() alias and use it. Get rid of the CNAME and theandreast2013-11-215-20/+10
| | | | | | CONCAT macros in SYS.h. Reviewed by: bde, kib
* 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.
* 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-069-60/+5
| | | | | | | | | | | | | | | | | 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
* Add section .note.GNU-stack for assembly files used by 386 and amd64.kib2011-01-0711-0/+21
|
* 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-029-0/+10
| | | | | | | 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.
* 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)
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-0910-40/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* 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.
* Fix brk(3). The stack was unbalanced when we jumped to cerror. Oops!peter2004-10-271-0/+1
| | | | | | This causes nasty things like SEGV or a cpu spin when we return. Submitted by: "James R. Van Artsalen" <james@jrv.org>
* Change the syscall stub branch orders so that the static branch predictionpeter2004-02-223-3/+45
| | | | will assume that syscalls will succeed rather than fail.
* Provide sysarch(2) prototypes in the MD sysarch.h headers. While I'mnectar2004-01-094-12/+4
| | | | | | | | | | at it, use the ANSI C generic pointer type for the second argument, thus matching the documentation. Remove the now extraneous (and now conflicting) function declarations in various libc sources. Remove now unnecessary casts. Reviewed by: bde
* Add implementations of amd64_[gs]et_[fg]sbase().peter2003-10-235-0/+158
|
* Sigh. I can't win anything. Use addq rather than addl with %rsp.peter2003-09-041-1/+1
|
* Apply same basic fix for getcontext(2) as for i386. Store the returnpeter2003-09-042-2/+56
| | | | | | value for getcontext() in a preserved register rather than on the stack. The second time around, the stack value would likely have changed so we can't depend on it for the return value.
* Fix some minor whitespace botchespeter2003-09-041-1/+1
|
* Add the mlockall() and munlockall() system calls.bms2003-08-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - All those diffs to syscalls.master for each architecture *are* necessary. This needed clarification; the stub code generation for mlockall() was disabled, which would prevent applications from linking to this API (suggested by mux) - Giant has been quoshed. It is no longer held by the code, as the required locking has been pushed down within vm_map.c. - Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES to express their intention explicitly. - Inspected at the vmstat, top and vm pager sysctl stats level. Paging-in activity is occurring correctly, using a test harness. - The RES size for a process may appear to be greater than its SIZE. This is believed to be due to mappings of the same shared library page being wired twice. Further exploration is needed. - Believed to back out of allocations and locks correctly (tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC). PR: kern/43426, standards/54223 Reviewed by: jake, alc Approved by: jake (mentor) MFC after: 2 weeks
* Repair PIC mode. It seems I was a bit too excited about thepeter2003-05-246-14/+77
| | | | implications of native PC relative addressing.
* Delete i386_* syscall wrappers and manpages. Rename Ovfork.S to vfork.S.peter2003-04-301-12/+2
|
* Update for AMD64 after repocopy from i386/sys/*. This means:peter2003-04-306-105/+35
| | | | | | | - strip out the nasty PIC_PROLOGUE/EPILOGUE stuff, since we dont have to lose a register in PIC mode anymore (we use %rip-relative addressing). - update for C register argument passing conventions. - convert 32 bit to 64 bit register sizes etc.
* I have no idea why the reboot(2) syscall wrapper ends with iret, butpeter2003-04-301-1/+1
| | | | update it to be iretq for completeness.
* Update for AMD64. Depend on %rdi (first syscall argument) being preservedpeter2003-04-301-4/+3
| | | | across a "syscall"-style syscall
* Update for AMD64 (repocopied from i386/sys/Ovfork.S - why is it O?)peter2003-04-301-5/+4
| | | | | Depend on %rsi being preserved across the "syscall"-style syscall and strip out the PIC stuff (this cpu has full PC-relative addressing, at last!)
* libc_r wasn't so tied to libc for 22 months.ru2002-11-181-2/+0
|
* Use '_end' symbol instead of 'end' to initialize minbrk and curbrkkan2002-08-081-3/+3
| | | | | | | | | | | | | variables. Both symbols are set to the same value by the linker, and _end symbol has less chances to clash with application defined global symbols. alpha, ia64 and sparc64 ports already use _end, i386 is now consistent with them. Reviewed by: bde Approved by: obrien Reported by: pirzyk
* Generate the normal asm stubs for all sysv system calls. Use these insteadjake2002-05-231-5/+3
| | | | | | | of C wrappers for the *sys indirect system calls. The indirect system calls are horribly broken on sparc64. Submitted by: tmm
* Restore CSRG ID's lost in January 1995.obrien2002-03-2310-40/+50
|
* Use 'mov' instead of 'lea' for setting the syscall number in %eax as thatjhb2001-11-275-7/+7
| | | | | | is clearer about what we are actually doing. Requested by: bde
* Cleanups after previous change:jhb2001-11-131-9/+2
| | | | | | | | | | | - Renumber labels since the previous revision removed one. - Remove useless and wrong comment. - Repeating the function name is just redundant. - The previous revision made the comment about %edx useless. - The comment about %eax was wrong (but did explain why %eax used to be fixed up). Submitted by: bde
* The kernel already fixes up %eax for parents that return from fork, sojhb2001-11-132-6/+2
| | | | | don't bother manually fixing up %eax for the parent process by testing the value in %edx and zeroing and already zeroed %eax.
* De-orbit DEFS.h - the other arches do not use it, and it got replacedpeter2001-10-241-1/+0
| | | | | | with <machine/asm.h>. Reviewed by: bde
* Just use RSYSCALL.ru2001-10-191-2/+1
|
* Removed duplicate VCS ID tags, as per style(9).ru2001-08-1310-20/+0
|
* MAN[1-9] -> MAN.ru2001-03-271-2/+2
|
* Clean up syscall generation in libc by removing HIDDEN_SYSCALLSdeischen2001-01-293-7/+3
| | | | | | | | | | | | | | and treating (almost) all system calls the same way: __sys_foo - actual syscall foo, _foo - weak definitions to __sys_foo Change PSEUDO syscalls (currently only _exit and _getlogin) to be __sys_foo (T) and _foo (W). Add $FreeBSD$ to a few files to satisfy commitprep. Suggested by: bde
* Comment only change; s/_thread_sys_/__sys_/deischen2001-01-261-2/+2
|
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-242-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* Remove last vestiges of thr_sleep and thr_wakeup from libc.jake2000-12-021-1/+1
|
* Prefix the register argument of indirect 'jmp's with a * to make gas 2.10.xjhb2000-11-281-1/+1
| | | | happy.
* Add a couple of debug register helper functions to assist in settingbsd2000-09-211-2/+4
| | | | | | and clearing watchpoints. Reviewed by: jwd@FreeBSD.org, -hackers@
OpenPOWER on IntegriCloud