Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Jun Sun <jsun@mvista.com>
To: linux-mips@linux-mips.org
Cc: jsun@mvista.com
Subject: [PATCH] _syscall macros
Date: Wed, 9 Jul 2003 15:56:54 -0700	[thread overview]
Message-ID: <20030709155654.L27926@mvista.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]


In testing some new syscalls, I found that the current 
_syscall macros do not return the right errno.  A little
further probing shows that errno now is a function call,
and on returning from the call original __v0 from syscall
is corrupted.

Here is a patch to fix this.  Looks good?

Jun

[-- Attachment #2: 030709.a-errno-messed-up-in-syscall-macros.patch --]
[-- Type: text/plain, Size: 3131 bytes --]

diff -Nru link/include/asm-mips/unistd.h.orig link/include/asm-mips/unistd.h
--- link/include/asm-mips/unistd.h.orig	Thu Nov  7 14:05:44 2002
+++ link/include/asm-mips/unistd.h	Wed Jul  9 15:42:32 2003
@@ -276,7 +276,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -302,7 +302,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -325,7 +325,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -349,7 +349,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -373,7 +373,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -406,7 +406,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -437,7 +437,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -471,7 +471,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
diff -Nru link/include/asm-mips64/unistd.h.orig link/include/asm-mips64/unistd.h
--- link/include/asm-mips64/unistd.h.orig	Wed Apr  9 14:40:24 2003
+++ link/include/asm-mips64/unistd.h	Wed Jul  9 15:43:11 2003
@@ -729,7 +729,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -755,7 +755,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -778,7 +778,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -802,7 +802,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -826,7 +826,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -853,7 +853,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -884,7 +884,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -916,7 +916,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -951,7 +951,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -982,7 +982,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 
@@ -1016,7 +1016,7 @@
 	\
 	if (__a3 == 0) \
 		return (type) __v0; \
-	errno = __v0; \
+	{ int ret = __v0; errno = ret; } \
 	return -1; \
 }
 

                 reply	other threads:[~2003-07-09 22:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030709155654.L27926@mvista.com \
    --to=jsun@mvista.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox