Date: Tue, 28 Oct 2008 00:08:59 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 152068 for review Message-ID: <200810280008.m9S08xch094132@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=152068 Change 152068 by peter@peter_overcee on 2008/10/28 00:08:49 Convert pipe wrapper back to C, using res/res2 Affected files ... .. //depot/projects/valgrind/coregrind/m_libcfile.c#7 edit .. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-amd64-freebsd.c#4 edit .. //depot/projects/valgrind/coregrind/m_syswrap/syswrap-x86-freebsd.c#9 edit Differences ... ==== //depot/projects/valgrind/coregrind/m_libcfile.c#7 (text+ko) ==== @@ -155,13 +155,20 @@ return ret; } -#if !defined(VGO_freebsd) Int VG_(pipe) ( Int fd[2] ) { - SysRes res = VG_(do_syscall1)(__NR_pipe, (UWord)fd); + SysRes res; +#if defined(VGO_freebsd) + res = VG_(do_syscall0)(__NR_pipe); + if (!res.isError) { + fd[0] = res.res; + fd[1] = res.res2; + } +#else + res = VG_(do_syscall1)(__NR_pipe, (UWord)fd); +#endif return res.isError ? -1 : 0; } -#endif OffT VG_(lseek) ( Int fd, OffT offset, Int whence ) { ==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-amd64-freebsd.c#4 (text+ko) ==== @@ -61,27 +61,6 @@ #include "priv_syswrap-freebsd.h" /* for decls of freebsd-ish wrappers */ #include "priv_syswrap-main.h" -/* Simulate C-style return values for pipe(2). This does not belong - here at all, it should be in m_libcfile.c. -*/ -// AAA: fix this wrapper. has to preserve C-style arg1 pointer. -asm( -".text\n" -".globl vgPlain_pipe\n" -"vgPlain_pipe:\n" -" mov $42,%eax\n" /* SYS_pipe */ -" syscall\n" -" jb 1f\n" -" movq 8(%rsp),%rcx\n" -" movq %rax,(%rcx)\n" -" movq %rdx,8(%rcx)\n" -" movl $0,%eax\n" -" ret\n" -"1: negl %eax\n" -" ret\n" -); - - /* --------------------------------------------------------------------- clone() handling ------------------------------------------------------------------ */ ==== //depot/projects/valgrind/coregrind/m_syswrap/syswrap-x86-freebsd.c#9 (text+ko) ==== @@ -60,26 +60,6 @@ #include "priv_syswrap-freebsd.h" /* for decls of linux-ish wrappers */ #include "priv_syswrap-main.h" -/* Simulate C-style return values for pipe(2). This does not belong - here at all, it should be in m_libcfile.c. -*/ -asm( -".text\n" -".globl vgPlain_pipe\n" -"vgPlain_pipe:\n" -" mov $42,%eax\n" /* SYS_pipe */ -" int $0x80\n" -" jb 1f\n" -" movl 4(%esp),%ecx\n" -" movl %eax,(%ecx)\n" -" movl %edx,4(%ecx)\n" -" movl $0,%eax\n" -" ret\n" -"1: negl %eax\n" -" ret\n" -); - - /* --------------------------------------------------------------------- clone() handling ------------------------------------------------------------------ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810280008.m9S08xch094132>