aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2016-01-05 16:43:50 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2016-01-05 16:43:50 -0800
commit9b625887a59c03c244b43550b576529f209dde11 (patch)
tree8bf5422467a001521b31484ce7123a19e5fdbd96
parentbc18ea796db39b8d3575948b3d0de28daee38261 (diff)
downloadklibc-9b625887a59c03c244b43550b576529f209dde11.tar.gz
[klibc] i386: remove special handling of socketcall
As of kernel 4.3, i386 now has direct system calls for sockets, so drop the special handling for i386 socketcall. If built on older kernels, it will still generate socketcall stubs although they will be less efficient. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--usr/klibc/arch/i386/Kbuild2
-rw-r--r--usr/klibc/arch/i386/socketcall.S55
-rw-r--r--usr/klibc/socketcalls.pl49
3 files changed, 17 insertions, 89 deletions
diff --git a/usr/klibc/arch/i386/Kbuild b/usr/klibc/arch/i386/Kbuild
index edc7b3ccfd653c..de237becc1803c 100644
--- a/usr/klibc/arch/i386/Kbuild
+++ b/usr/klibc/arch/i386/Kbuild
@@ -2,7 +2,7 @@
# klibc .o files for i386
#
-klib-y := socketcall.o setjmp.o syscall.o varsyscall.o
+klib-y := setjmp.o syscall.o varsyscall.o
klib-y += open.o openat.o vfork.o
klib-y += libgcc/__ashldi3.o libgcc/__ashrdi3.o libgcc/__lshrdi3.o
klib-y += libgcc/__muldi3.o libgcc/__negdi2.o
diff --git a/usr/klibc/arch/i386/socketcall.S b/usr/klibc/arch/i386/socketcall.S
deleted file mode 100644
index 44e2004d872658..00000000000000
--- a/usr/klibc/arch/i386/socketcall.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# socketcall.S
-#
-# Socketcalls use the following convention:
-# %eax = __NR_socketcall
-# %ebx = socketcall number
-# %ecx = pointer to arguments (up to 6)
-#
-
-#include <asm/unistd.h>
-
-#ifdef __i386__
-
- .text
- .align 4
- .globl __socketcall_common
- .type __socketcall_common, @function
-
-__socketcall_common:
- xchgl %ebx,(%esp) # The stub passes the socketcall # on stack
-
-#ifdef _REGPARM
- pushl 16(%esp) # Arg 6
- pushl 16(%esp) # Arg 5
- pushl 16(%esp) # Arg 4
- pushl %ecx
- pushl %edx
- pushl %eax
- movl %esp,%ecx
-#else
- leal 8(%esp),%ecx # Arguments already contiguous on-stack
-#endif
-
- movl $__NR_socketcall,%eax
- call *__syscall_entry
-
-#ifdef _REGPARM
- addl $6*4, %esp
-#endif
-
- cmpl $-4095,%eax # Error return?
-
- popl %ebx
-
- jb 1f
-
- negl %eax
- movl %eax,errno
- orl $-1,%eax # Return -1
-1:
- ret
-
- .size __socketcall_common,.-__socketcall_common
-
-#endif
diff --git a/usr/klibc/socketcalls.pl b/usr/klibc/socketcalls.pl
index 3dac096a99033b..9df5949417a723 100644
--- a/usr/klibc/socketcalls.pl
+++ b/usr/klibc/socketcalls.pl
@@ -42,44 +42,27 @@ while ( defined($line = <FILE>) ) {
$nargs = $i;
print " \\\n\t${name}.o";
- if ( $arch eq 'i386' ) {
- open(OUT, "> ${outputdir}/${name}.S")
- or die "$0: Cannot open ${outputdir}/${name}.S\n";
+ open(OUT, "> ${outputdir}/${name}.c")
+ or die "$0: Cannot open ${outputdir}/${name}.c\n";
- print OUT "#include <sys/socketcalls.h>\n";
- print OUT "\n";
- print OUT "\t.text\n";
- print OUT "\t.align 4\n";
- print OUT "\t.globl ${name}\n";
- print OUT "\t.type ${name},\@function\n";
- print OUT "${name}:\n";
- print OUT "\tpushl \$SYS_\U${name}\n";
- print OUT "\tjmp __socketcall_common\n";
- print OUT "\t.size ${name},.-${name}\n";
- close(OUT);
- } else {
- open(OUT, "> ${outputdir}/${name}.c")
- or die "$0: Cannot open ${outputdir}/${name}.c\n";
-
- print OUT "#include \"socketcommon.h\"\n";
- print OUT "\n";
- print OUT "#if _KLIBC_SYS_SOCKETCALL || !defined(__NR_${name})\n\n";
+ print OUT "#include \"socketcommon.h\"\n";
+ print OUT "\n";
+ print OUT "#if _KLIBC_SYS_SOCKETCALL || !defined(__NR_${name})\n\n";
- print OUT "extern long __socketcall(int, const unsigned long *);\n\n";
+ print OUT "extern long __socketcall(int, const unsigned long *);\n\n";
- print OUT "$type $name (", join(', ', @cargs), ")\n";
- print OUT "{\n";
- print OUT " unsigned long args[$nargs];\n";
- for ( $i = 0 ; $i < $nargs ; $i++ ) {
- print OUT " args[$i] = (unsigned long)a$i;\n";
- }
- print OUT " return ($type) __socketcall(SYS_\U${name}\E, args);\n";
- print OUT "}\n\n";
+ print OUT "$type $name (", join(', ', @cargs), ")\n";
+ print OUT "{\n";
+ print OUT " unsigned long args[$nargs];\n";
+ for ( $i = 0 ; $i < $nargs ; $i++ ) {
+ print OUT " args[$i] = (unsigned long)a$i;\n";
+ }
+ print OUT " return ($type) __socketcall(SYS_\U${name}\E, args);\n";
+ print OUT "}\n\n";
- print OUT "#endif\n";
+ print OUT "#endif\n";
- close(OUT);
- }
+ close(OUT);
} else {
die "$file:$.: Could not parse input\n";
}