aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:33:00 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:00 -0500
commitd50efc6c40620b2e11648cac64ebf4a824e40382 (patch)
treedaf951117c86f2d4875216eee9e708a0c01c9e4b
parent3a556b26a2718e48aa2b6ce06ea4875ddcd0778e (diff)
x86: fix UML and -regparm=3
introduce the "asmregparm" calling convention: for functions implemented in assembly with a fixed regparm input parameters calling convention. mark the semaphore and rwsem slowpath functions with that. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/asm-x86/linkage.h5
-rw-r--r--include/asm-x86/rwsem.h12
-rw-r--r--include/asm-x86/semaphore_32.h8
-rw-r--r--include/linux/linkage.h4
-rw-r--r--lib/rwsem.c8
5 files changed, 25 insertions, 12 deletions
diff --git a/include/asm-x86/linkage.h b/include/asm-x86/linkage.h
index 5a4c95905420..31739c7d66a9 100644
--- a/include/asm-x86/linkage.h
+++ b/include/asm-x86/linkage.h
@@ -9,6 +9,11 @@
9#ifdef CONFIG_X86_32 9#ifdef CONFIG_X86_32
10#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) 10#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
11#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret)) 11#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret))
12/*
13 * For 32-bit UML - mark functions implemented in assembly that use
14 * regparm input parameters:
15 */
16#define asmregparm __attribute__((regparm(3)))
12#endif 17#endif
13 18
14#ifdef CONFIG_X86_ALIGNMENT_16 19#ifdef CONFIG_X86_ALIGNMENT_16
diff --git a/include/asm-x86/rwsem.h b/include/asm-x86/rwsem.h
index a7e7e14cb430..520a379f4b80 100644
--- a/include/asm-x86/rwsem.h
+++ b/include/asm-x86/rwsem.h
@@ -44,10 +44,14 @@
44 44
45struct rwsem_waiter; 45struct rwsem_waiter;
46 46
47extern struct rw_semaphore *FASTCALL(rwsem_down_read_failed(struct rw_semaphore *sem)); 47extern asmregparm struct rw_semaphore *
48extern struct rw_semaphore *FASTCALL(rwsem_down_write_failed(struct rw_semaphore *sem)); 48 rwsem_down_read_failed(struct rw_semaphore *sem);
49extern struct rw_semaphore *FASTCALL(rwsem_wake(struct rw_semaphore *)); 49extern asmregparm struct rw_semaphore *
50extern struct rw_semaphore *FASTCALL(rwsem_downgrade_wake(struct rw_semaphore *sem)); 50 rwsem_down_write_failed(struct rw_semaphore *sem);
51extern asmregparm struct rw_semaphore *
52 rwsem_wake(struct rw_semaphore *);
53extern asmregparm struct rw_semaphore *
54 rwsem_downgrade_wake(struct rw_semaphore *sem);
51 55
52/* 56/*
53 * the semaphore definition 57 * the semaphore definition
diff --git a/include/asm-x86/semaphore_32.h b/include/asm-x86/semaphore_32.h
index cc826e85323f..ac96d3804d0c 100644
--- a/include/asm-x86/semaphore_32.h
+++ b/include/asm-x86/semaphore_32.h
@@ -83,10 +83,10 @@ static inline void init_MUTEX_LOCKED (struct semaphore *sem)
83 sema_init(sem, 0); 83 sema_init(sem, 0);
84} 84}
85 85
86void __down_failed(void /* special register calling convention */); 86extern asmregparm void __down_failed(atomic_t *count_ptr);
87int __down_failed_interruptible(void /* params in registers */); 87extern asmregparm int __down_failed_interruptible(atomic_t *count_ptr);
88int __down_failed_trylock(void /* params in registers */); 88extern asmregparm int __down_failed_trylock(atomic_t *count_ptr);
89void __up_wakeup(void /* special register calling convention */); 89extern asmregparm void __up_wakeup(atomic_t *count_ptr);
90 90
91/* 91/*
92 * This is ugly, but we want the default case to fall through. 92 * This is ugly, but we want the default case to fall through.
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index ff203dd02919..ceeeb5ea5b15 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -13,6 +13,10 @@
13#define asmlinkage CPP_ASMLINKAGE 13#define asmlinkage CPP_ASMLINKAGE
14#endif 14#endif
15 15
16#ifndef asmregparm
17# define asmregparm
18#endif
19
16#ifndef prevent_tail_call 20#ifndef prevent_tail_call
17# define prevent_tail_call(ret) do { } while (0) 21# define prevent_tail_call(ret) do { } while (0)
18#endif 22#endif
diff --git a/lib/rwsem.c b/lib/rwsem.c
index 7d02700a4b0e..3e3365e5665e 100644
--- a/lib/rwsem.c
+++ b/lib/rwsem.c
@@ -187,7 +187,7 @@ rwsem_down_failed_common(struct rw_semaphore *sem,
187/* 187/*
188 * wait for the read lock to be granted 188 * wait for the read lock to be granted
189 */ 189 */
190struct rw_semaphore fastcall __sched * 190asmregparm struct rw_semaphore __sched *
191rwsem_down_read_failed(struct rw_semaphore *sem) 191rwsem_down_read_failed(struct rw_semaphore *sem)
192{ 192{
193 struct rwsem_waiter waiter; 193 struct rwsem_waiter waiter;
@@ -201,7 +201,7 @@ rwsem_down_read_failed(struct rw_semaphore *sem)
201/* 201/*
202 * wait for the write lock to be granted 202 * wait for the write lock to be granted
203 */ 203 */
204struct rw_semaphore fastcall __sched * 204asmregparm struct rw_semaphore __sched *
205rwsem_down_write_failed(struct rw_semaphore *sem) 205rwsem_down_write_failed(struct rw_semaphore *sem)
206{ 206{
207 struct rwsem_waiter waiter; 207 struct rwsem_waiter waiter;
@@ -216,7 +216,7 @@ rwsem_down_write_failed(struct rw_semaphore *sem)
216 * handle waking up a waiter on the semaphore 216 * handle waking up a waiter on the semaphore
217 * - up_read/up_write has decremented the active part of count if we come here 217 * - up_read/up_write has decremented the active part of count if we come here
218 */ 218 */
219struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem) 219asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
220{ 220{
221 unsigned long flags; 221 unsigned long flags;
222 222
@@ -236,7 +236,7 @@ struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem)
236 * - caller incremented waiting part of count and discovered it still negative 236 * - caller incremented waiting part of count and discovered it still negative
237 * - just wake up any readers at the front of the queue 237 * - just wake up any readers at the front of the queue
238 */ 238 */
239struct rw_semaphore fastcall *rwsem_downgrade_wake(struct rw_semaphore *sem) 239asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem)
240{ 240{
241 unsigned long flags; 241 unsigned long flags;
242 242