Browse Source

+ Add missing implementation of pipe syscall

git-svn-id: trunk@21859 -
pierre 13 years ago
parent
commit
c38b78ba65
1 changed files with 13 additions and 3 deletions
  1. 13 3
      rtl/linux/mips/bsyscall.inc

+ 13 - 3
rtl/linux/mips/bsyscall.inc

@@ -17,9 +17,19 @@ Function fppipe(var fildes : tfildes):cint;assembler;
 {
 {
   This function puts the registers in place, does the call, and then
   This function puts the registers in place, does the call, and then
   copies back the registers as they are after the SysCall.
   copies back the registers as they are after the SysCall.
+  Extracted from linux/source/arch/mips/kernel/syscall.c:
+  * For historic reasons the pipe(2) syscall on MIPS has an unusual calling
+  * convention.  It returns results in registers $v0 / $v1 which means there
+  * is no need for it to do verify the validity of a userspace pointer
+  * argument.  Historically that used to be expensive in Linux.  These days
+  * the performance advantage is negligible.
 }
 }
 asm
 asm
-// At present it is NOT IMPLEMENTED for MIPS
-// simplified-work
-// DavidZhang
+  li $v0,syscall_nr_pipe
+  syscall
+  { the two files descriptors are now in v0 and v1 registers 
+    copying them back into fildes variable }
+  lw $t1,fildes
+  sw $v0,($t1)
+  sw $v1,4($t1)
 end;
 end;