From: Eric Andersen Date: Fri, 9 Aug 2002 13:41:25 +0000 (-0000) Subject: New and improved fork for mips, thanks to the fine folks X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=63c324cb11bec09f26d4461242bb20040491bc8b;p=uclinux-h8%2Fuclibc-ng.git New and improved fork for mips, thanks to the fine folks at Brecis Communications. --- diff --git a/libc/sysdeps/linux/mips/Makefile b/libc/sysdeps/linux/mips/Makefile index 31710b0d5..34c2702ae 100644 --- a/libc/sysdeps/linux/mips/Makefile +++ b/libc/sysdeps/linux/mips/Makefile @@ -30,7 +30,7 @@ TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine) CRT0=crt0.S CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) -SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S +SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S fork.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) CSRC=__longjmp.c brk.c vfork.c setjmp_aux.c _mmap.c pipe.c __syscall_error.c diff --git a/libc/sysdeps/linux/mips/fork.S b/libc/sysdeps/linux/mips/fork.S new file mode 100644 index 000000000..6d2b33dba --- /dev/null +++ b/libc/sysdeps/linux/mips/fork.S @@ -0,0 +1,65 @@ +#include + +#define ALIGN 2 + +/* Note: .abicalls goes at top of routine, and only one of them. */ +#if defined(USER_ABICALLS) +#define ABISETUP \ + .set noreorder; \ + .cpload t9; \ + .set reorder; + + .abicalls +#else +#define ABISETUP +#endif + +#ifndef __UCLIBC_USE_UNIFIED_SYSCALL__ +#define SYSCALL__(name) \ + .text; \ + .align ALIGN; \ + .globl name; \ + .ent name, 0; \ + name: ; \ + ABISETUP \ + li v0, __NR_##name ; \ + syscall; \ + la t3, errno; \ + beqz a3, 1f; \ + negu a1, v0; \ + sw a1, 0(t3); \ + li v0, -1; \ + 1: ; \ + j ra; \ + .end name; \ + .size name,.-name; +#else /* Unified syscall */ +#define SYSCALL__(name) \ + .text; \ +/* .align ALIGN;*/ \ + .globl name; \ + .ent name, 0; \ + name: ; \ + ABISETUP \ + .set push; \ + .set noreorder; \ + j __uClibc_syscall; \ + addiu v0, zero, __NR_##name ; \ + .set pop; \ + .end name; \ + .size name,.-name; +#endif /* __UCLIBC_USE_UNIFIED_SYSCALL__ */ + +#undef ALIGN +#define __ASSEMBLY__ +#include +#include +#include +#include +/* #include */ + +#undef ALIGN +#define ALIGN 2 +#define _SYSCALL0(type,name) SYSCALL__(name) +_SYSCALL0(pid_t, fork); +