From 7be859a705aa7084b187e8007847aa4ddb049faf Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Sun, 4 Mar 2001 19:13:07 +0000 Subject: Fixed vfork on i386. Reduced size of __uClibc_syscall. --- libc/sysdeps/linux/i386/Makefile | 4 ++-- libc/sysdeps/linux/i386/__uClibc_syscall.S | 35 ++++++++++++------------------ libc/sysdeps/linux/i386/vfork.S | 22 +++++++++++++++++++ 3 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 libc/sysdeps/linux/i386/vfork.S (limited to 'libc/sysdeps/linux') diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile index 8c5fb21af..47fea7402 100644 --- a/libc/sysdeps/linux/i386/Makefile +++ b/libc/sysdeps/linux/i386/Makefile @@ -28,13 +28,13 @@ ASFLAGS=$(CFLAGS) CRT0=crt0.S CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) -SSRC=longjmp.S setjmp.S #_start.S #clone.S +SSRC=longjmp.S setjmp.S vfork.S #_start.S #clone.S ifeq ($(UNIFIED_SYSCALL),true) SSRC += __uClibc_syscall.S endif SOBJS=$(patsubst %.S,%.o, $(SSRC)) -CSRC=fork.c vfork.c __init_brk.c brk.c sbrk.c +CSRC=fork.c __init_brk.c brk.c sbrk.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(SOBJS) $(COBJS) diff --git a/libc/sysdeps/linux/i386/__uClibc_syscall.S b/libc/sysdeps/linux/i386/__uClibc_syscall.S index ecf2d6350..9e82d7acb 100644 --- a/libc/sysdeps/linux/i386/__uClibc_syscall.S +++ b/libc/sysdeps/linux/i386/__uClibc_syscall.S @@ -1,39 +1,32 @@ -.globl __uClibc_syscall - .text .align 4 +.globl __uClibc_syscall + .type __uClibc_syscall,@function __uClibc_syscall: - pushl %ebp - movl %esp,%ebp - subl $8,%esp pushl %edi pushl %esi pushl %ebx - /* movl $21,%eax */ and $0xff,%eax - movl 8(%ebp),%ebx - movl 12(%ebp),%ecx - movl 16(%ebp),%edx - movl 20(%ebp),%esi - movl 24(%ebp),%edi + movl 16(%esp),%ebx + movl 20(%esp),%ecx + movl 24(%esp),%edx + movl 28(%esp),%esi + movl 32(%esp),%edi #APP int $0x80 #NO_APP - movl %eax,-4(%ebp) - .p2align 4,,7 - cmpl $-126,-4(%ebp) + cmpl $-4095,%eax + /* jae .L5 */ + /* cmpl $-126,%eax */ jbe .L5 - movl -4(%ebp),%eax negl %eax movl %eax,errno - movl $-1,-4(%ebp) + movl $-1,%eax + .p2align 4,,7 .L5: - movl -4(%ebp),%edx - movl %edx,-8(%ebp) - movl -8(%ebp),%eax - leal -20(%ebp),%esp popl %ebx popl %esi popl %edi - leave ret +.Lfe1: + .size __uClibc_syscall,.Lfe1-__uClibc_syscall diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S new file mode 100644 index 000000000..5775daee3 --- /dev/null +++ b/libc/sysdeps/linux/i386/vfork.S @@ -0,0 +1,22 @@ +.text + .align 4 +.globl vfork + .type vfork,@function +vfork: + popl %ecx + movl $190,%eax +#APP + int $0x80 +#NO_APP + cmpl $-4095,%eax + jae .L5 + jmp *%ecx + .p2align 4,,7 +.L5: + pushl %ecx + negl %eax + movl %eax,errno + movl $-1,%eax + ret +.Lfe1: + .size vfork,.Lfe1-vfork -- cgit v1.2.3