Remove as many hard-coded constants from the MIPS vfork.S as possible.

We could do better, but not without MIPS cleaning up their kernel headers.

Change-Id: Ib4d4ce5d720ce8ca27a3f9a1ae07a9a277675af9
This commit is contained in:
Elliott Hughes 2014-01-02 15:41:33 -08:00
parent 7b0c23f1ac
commit c5bf703c4c

View File

@ -27,11 +27,14 @@
*/ */
#include <asm/unistd.h> #include <asm/unistd.h>
#include <linux/sched.h>
// TODO: mips' uapi signal.h is missing #ifndef __ASSEMBLY__.
// #include <asm/signal.h>
#define SIGCHLD 18
.text .text
/* int vfork() implemented using clone() */
.type vfork, @function .type vfork, @function
.global vfork .global vfork
.align 4 .align 4
@ -40,17 +43,22 @@ vfork:
.set noreorder .set noreorder
.cpload $t9 .cpload $t9
li $a0, 0x4112 /* CLONE_VM | CLONE_VFORK | SIGCHLD */ li $a0, (CLONE_VM | CLONE_VFORK | SIGCHLD)
move $a1, $sp li $a1, 0
li $a2, 0
li $a3, 0
subu $sp, 8
sw $0, 16($sp)
li $v0, __NR_clone li $v0, __NR_clone
syscall syscall
bnez $a3,1f addu $sp, 8
nop bnez $a3, 1f
move $a0, $v0
j $ra j $ra
nop nop
1: 1:
la $t9,__set_errno la $t9, __set_errno
j $t9 j $t9
move $a0,$v0 nop
.end vfork .end vfork