Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2016 17:29:01 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294515 - head/lib/libc/mips
Message-ID:  <201601211729.u0LHT1Sn012249@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Thu Jan 21 17:29:01 2016
New Revision: 294515
URL: https://svnweb.freebsd.org/changeset/base/294515

Log:
  Fix the implementations of PSEUDO_NOERROR and PSEUDO.
  
  The PSEUDO* macros should not declare <syscall>, only _<syscall> and
  __sys_<syscall>.  This was causing the interposing C wrappers to be
  ignored due to link order.
  
  Reviewed by:	kib
  Obtained from:	CheriBSD (4e8e13c90fc6a80e1520de44a6864cfd78b3b56d)
  MFC after:	1 week
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D4097

Modified:
  head/lib/libc/mips/SYS.h

Modified: head/lib/libc/mips/SYS.h
==============================================================================
--- head/lib/libc/mips/SYS.h	Thu Jan 21 17:25:41 2016	(r294514)
+++ head/lib/libc/mips/SYS.h	Thu Jan 21 17:29:01 2016	(r294515)
@@ -100,13 +100,31 @@
  * Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
  */
 #define RSYSCALL_NOERROR(x)						\
-	PSEUDO_NOERROR(x)
+LEAF(__sys_ ## x);							\
+	.weak _C_LABEL(x);						\
+	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
+	.weak _C_LABEL(__CONCAT(_,x));					\
+	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
+	SYSTRAP(x);							\
+	j ra;								\
+END(__sys_ ## x)
 
 /*
  * Do a normal syscall.
  */
 #define RSYSCALL(x)							\
-	PSEUDO(x)
+LEAF(__sys_ ## x);							\
+	.weak _C_LABEL(x);						\
+	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
+	.weak _C_LABEL(__CONCAT(_,x));					\
+	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
+	PIC_PROLOGUE(__sys_ ## x);					\
+	SYSTRAP(x);							\
+	bne a3,zero,err;						\
+	PIC_RETURN();							\
+err:									\
+	PIC_TAILCALL(__cerror);						\
+END(__sys_ ## x)
 
 /*
  * Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
@@ -114,18 +132,14 @@
  */
 #define PSEUDO_NOERROR(x)						\
 LEAF(__sys_ ## x);							\
-	.weak _C_LABEL(x);						\
-	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
 	SYSTRAP(x);							\
 	j ra;								\
-	END(__sys_ ## x)
+END(__sys_ ## x)
 
 #define PSEUDO(x)							\
 LEAF(__sys_ ## x);							\
-	.weak _C_LABEL(x);						\
-	_C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x));			\
 	.weak _C_LABEL(__CONCAT(_,x));					\
 	_C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x));		\
 	PIC_PROLOGUE(__sys_ ## x);					\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601211729.u0LHT1Sn012249>