summaryrefslogtreecommitdiff
path: root/src/internal/i386
AgeCommit message (Collapse)AuthorFilesLines
2019-04-10remove external __syscall function and last remaining usersRich Felker1-21/+0
the weak version of __syscall_cp_c was using a tail call to __syscall to avoid duplicating the 6-argument syscall code inline in small static-linked programs, but now that __syscall no longer exists, the inline expansion is no longer duplication. the syscall.h machinery suppported up to 7 syscall arguments, only via an external __syscall function, but we presently have no syscall call points that actually make use of that many, and the kernel only defines 7-argument calling conventions for arm, powerpc (32-bit), and sh. if it turns out we need them in the future, they can easily be added.
2019-04-10overhaul i386 syscall mechanism not to depend on external asm sourceRich Felker2-69/+21
this is the first part of a series of patches intended to make __syscall fully self-contained in the object file produced using syscall.h, which will make it possible for crt1 code to perform syscalls. the (confusingly named) i386 __vsyscall mechanism, which this commit removes, was introduced before the presence of a valid thread pointer was mandatory; back then the thread pointer was setup lazily only if threads were used. the intent was to be able to perform syscalls using the kernel's fast entry point in the VDSO, which can use the sysenter (Intel) or syscall (AMD) instruction instead of int $128, but without inlining an access to the __syscall global at the point of each syscall, which would incur a significant size cost from PIC setup everywhere. the mechanism also shuffled registers/calling convention around to avoid spills of call-saved registers, and to avoid allocating ebx or ebp via asm constraints, since there are plenty of broken-but-supported compiler versions which are incapable of allocating ebx with -fPIC or ebp with -fno-omit-frame-pointer. the new mechanism preserves the properties of avoiding spills and avoiding allocation of ebx/ebp in constraints, but does it inline, using some fairly simple register shuffling, and uses a field of the thread structure rather than global data for the vdso-provided syscall code address. for now, the external __syscall function is refactored not to use the old __vsyscall so it can be kept, but the intent is to remove it too.
2015-04-14fix inconsistent visibility for internal syscall symbolsRich Felker1-0/+1
2015-04-14use hidden visibility for i386 asm-internal __vsyscall symbolRich Felker1-0/+2
otherwise the call instruction in the inline syscall asm results in textrels without ld-time binding.
2012-11-11fix clobber of edx in i386 vsyscall asmRich Felker1-1/+2
this function does not obey the normal calling convention; like a syscall instruction, it's expected not to clobber any registers except the return value. clobbering edx could break callers that were reusing the value cached in edx after the syscall returns.
2012-10-11comment possibly-confusing i386 vsyscall asmRich Felker1-1/+13
2012-10-11i386 vsyscall support (vdso-provided sysenter/syscall instruction based)Rich Felker1-16/+58
this doubles the performance of the fastest syscalls on the atom I tested it on; improvement is reportedly much more dramatic on worst-case cpus. cannot be used for cancellable syscalls.
2011-06-14restore use of .type in asm, but use modern @function (vs %function)Rich Felker1-0/+1
this seems to be necessary to make the linker accept the functions in a shared library (perhaps to generate PLT entries?) strictly speaking libc-internal asm should not need it. i might clean that up later.
2011-06-13remove all .size and .type directives for functions from the asmRich Felker1-2/+0
these are useless and have caused problems for users trying to build with non-gnu tools like tcc's assembler.
2011-03-19overhaul syscall interfaceRich Felker1-0/+21
this commit shuffles around the location of syscall definitions so that we can make a syscall() library function with both SYS_* and __NR_* style syscall names available to user applications, provides the syscall() library function, and optimizes the code that performs the actual inline syscalls in the library itself. previously on i386 when built as PIC (shared library), syscalls were incurring bus lock (lock prefix) overhead at entry and exit, due to the way the ebx register was being loaded (xchg instruction with a memory operand). now the xchg takes place between two registers. further cleanup to arch/$(ARCH)/syscall.h is planned.