Skip to contentSkip to conversation

x86, um: fix GETREG/PUTREG macros

PATCH In review Roel Kluin 2 participants 4 messages Jan 21, 2009 – Jan 22, 2009 User-mode Linux (UML)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 x86, um: fix GETREG/PUTREG macros

When these macros aren't called with regs, e.g. with foo this will incorectly expand to foo->foo.gp[*]

---
My other patch should probably as well have been sent to this list:
http://lkml.org/lkml/2009/1/21/203

arch/um/sys-x86_64/signal.c +4 -4
index 1a899a7..31d0e9c 100644
@@ -49,8 +49,8 @@ static int copy_sc_from_user(struct pt_regs *regs,
 	struct user_i387_struct fp;
 	int err = 0;
 
-#define GETREG(regs, regno, sc, regname)				\
-	__get_user((regs)->regs.gp[(regno) / sizeof(unsigned long)],	\
+#define GETREG(_regs, regno, sc, regname)				\
+	__get_user((_regs)->regs.gp[(regno) / sizeof(unsigned long)],	\
 		   &(sc)->regname)
 
 	err |= GETREG(regs, R8, from, r8);
@@ -104,8 +104,8 @@ static int copy_sc_to_user(struct sigcontext __user *to,
 	err |= __put_user(0, &to->gs);
 	err |= __put_user(0, &to->fs);
 
-#define PUTREG(regs, regno, sc, regname)				\
-	__put_user((regs)->regs.gp[(regno) / sizeof(unsigned long)],	\
+#define PUTREG(_regs, regno, sc, regname)				\
+	__put_user((_regs)->regs.gp[(regno) / sizeof(unsigned long)],	\
 		   &(sc)->regname)
 
 	err |= PUTREG(regs, RDI, to, di);

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#1 lore raw

PATCH 1/1 x86, um: fix EXECUTE_SYSCALL macros

Quoted 8 lines · Roel Kluin

When these macros aren't called with regs, e.g. with foo this will incorectly expand to foo->foo.gp[*]

---
My other patch should probably as well have been sent to this list:
http://lkml.org/lkml/2009/1/21/203

there were more

Fix EXECUTE_SYSCALL macros. When called with a variable named other than regs as second argument, this will result in a build failure.

---

arch/um/sys-i386/shared/sysdep/syscalls.h +2 -2
index 9056981..1cab192 100644
@@ -17,9 +17,9 @@ extern syscall_handler_t old_mmap_i386;
 
 extern syscall_handler_t *sys_call_table[];
 
-#define EXECUTE_SYSCALL(syscall, regs) \
+#define EXECUTE_SYSCALL(syscall, _regs) \
 	((long (*)(struct syscall_args)) \
-	 (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
+	 (*sys_call_table[syscall]))(SYSCALL_ARGS(&_regs->regs))
 
 extern long sys_mmap2(unsigned long addr, unsigned long len,
 		      unsigned long prot, unsigned long flags,
arch/um/sys-x86_64/shared/sysdep/syscalls.h +7 -7
index 7cfb0b0..a5be219 100644
@@ -15,14 +15,14 @@ typedef long syscall_handler_t(void);
 
 extern syscall_handler_t *sys_call_table[];
 
-#define EXECUTE_SYSCALL(syscall, regs) \
+#define EXECUTE_SYSCALL(syscall, _regs) \
 	(((long (*)(long, long, long, long, long, long)) \
-	  (*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(&regs->regs), \
-		 		      UPT_SYSCALL_ARG2(&regs->regs), \
-				      UPT_SYSCALL_ARG3(&regs->regs), \
-				      UPT_SYSCALL_ARG4(&regs->regs), \
-				      UPT_SYSCALL_ARG5(&regs->regs), \
-				      UPT_SYSCALL_ARG6(&regs->regs)))
+	  (*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(&_regs->regs), \
+		 		      UPT_SYSCALL_ARG2(&_regs->regs), \
+				      UPT_SYSCALL_ARG3(&_regs->regs), \
+				      UPT_SYSCALL_ARG4(&_regs->regs), \
+				      UPT_SYSCALL_ARG5(&_regs->regs), \
+				      UPT_SYSCALL_ARG6(&_regs->regs)))
 
 extern long old_mmap(unsigned long addr, unsigned long len,
 		     unsigned long prot, unsigned long flags,

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reviewed-by WANG Cong on v1 1/1
#3 lore raw
In reply to Roel Kluin
Quoted 4 lines · Roel Kluin

When these macros aren't called with regs, e.g. with foo this will incorectly expand to foo->foo.gp[*]

Good catch!

Signature · 12 lines
"Against stupidity, the gods themselves, contend in vain."


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Reviewed-by WANG Cong on v1 1/1
#2 lore raw

Re: [PATCH] x86, um: fix EXECUTE_SYSCALL macros

In reply to Roel Kluin
Quoted 9 lines · Roel Kluin
Quoted 8 lines · Roel Kluin

When these macros aren't called with regs, e.g. with foo this will incorectly expand to foo->foo.gp[*]

---
My other patch should probably as well have been sent to this list:
http://lkml.org/lkml/2009/1/21/203

Quoted 6 lines

there were more

Fix EXECUTE_SYSCALL macros. When called with a variable named other than regs as second argument, this will result in a build failure.

Signature · 12 lines
"Against stupidity, the gods themselves, contend in vain."


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel