Commit d50efc6c authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 3a556b26
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret)) #define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret))
/*
* For 32-bit UML - mark functions implemented in assembly that use
* regparm input parameters:
*/
#define asmregparm __attribute__((regparm(3)))
#endif #endif
#ifdef CONFIG_X86_ALIGNMENT_16 #ifdef CONFIG_X86_ALIGNMENT_16
......
...@@ -44,10 +44,14 @@ ...@@ -44,10 +44,14 @@
struct rwsem_waiter; struct rwsem_waiter;
extern struct rw_semaphore *FASTCALL(rwsem_down_read_failed(struct rw_semaphore *sem)); extern asmregparm struct rw_semaphore *
extern struct rw_semaphore *FASTCALL(rwsem_down_write_failed(struct rw_semaphore *sem)); rwsem_down_read_failed(struct rw_semaphore *sem);
extern struct rw_semaphore *FASTCALL(rwsem_wake(struct rw_semaphore *)); extern asmregparm struct rw_semaphore *
extern struct rw_semaphore *FASTCALL(rwsem_downgrade_wake(struct rw_semaphore *sem)); rwsem_down_write_failed(struct rw_semaphore *sem);
extern asmregparm struct rw_semaphore *
rwsem_wake(struct rw_semaphore *);
extern asmregparm struct rw_semaphore *
rwsem_downgrade_wake(struct rw_semaphore *sem);
/* /*
* the semaphore definition * the semaphore definition
......
...@@ -83,10 +83,10 @@ static inline void init_MUTEX_LOCKED (struct semaphore *sem) ...@@ -83,10 +83,10 @@ static inline void init_MUTEX_LOCKED (struct semaphore *sem)
sema_init(sem, 0); sema_init(sem, 0);
} }
void __down_failed(void /* special register calling convention */); extern asmregparm void __down_failed(atomic_t *count_ptr);
int __down_failed_interruptible(void /* params in registers */); extern asmregparm int __down_failed_interruptible(atomic_t *count_ptr);
int __down_failed_trylock(void /* params in registers */); extern asmregparm int __down_failed_trylock(atomic_t *count_ptr);
void __up_wakeup(void /* special register calling convention */); extern asmregparm void __up_wakeup(atomic_t *count_ptr);
/* /*
* This is ugly, but we want the default case to fall through. * This is ugly, but we want the default case to fall through.
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#define asmlinkage CPP_ASMLINKAGE #define asmlinkage CPP_ASMLINKAGE
#endif #endif
#ifndef asmregparm
# define asmregparm
#endif
#ifndef prevent_tail_call #ifndef prevent_tail_call
# define prevent_tail_call(ret) do { } while (0) # define prevent_tail_call(ret) do { } while (0)
#endif #endif
......
...@@ -187,7 +187,7 @@ rwsem_down_failed_common(struct rw_semaphore *sem, ...@@ -187,7 +187,7 @@ rwsem_down_failed_common(struct rw_semaphore *sem,
/* /*
* wait for the read lock to be granted * wait for the read lock to be granted
*/ */
struct rw_semaphore fastcall __sched * asmregparm struct rw_semaphore __sched *
rwsem_down_read_failed(struct rw_semaphore *sem) rwsem_down_read_failed(struct rw_semaphore *sem)
{ {
struct rwsem_waiter waiter; struct rwsem_waiter waiter;
...@@ -201,7 +201,7 @@ rwsem_down_read_failed(struct rw_semaphore *sem) ...@@ -201,7 +201,7 @@ rwsem_down_read_failed(struct rw_semaphore *sem)
/* /*
* wait for the write lock to be granted * wait for the write lock to be granted
*/ */
struct rw_semaphore fastcall __sched * asmregparm struct rw_semaphore __sched *
rwsem_down_write_failed(struct rw_semaphore *sem) rwsem_down_write_failed(struct rw_semaphore *sem)
{ {
struct rwsem_waiter waiter; struct rwsem_waiter waiter;
...@@ -216,7 +216,7 @@ rwsem_down_write_failed(struct rw_semaphore *sem) ...@@ -216,7 +216,7 @@ rwsem_down_write_failed(struct rw_semaphore *sem)
* handle waking up a waiter on the semaphore * handle waking up a waiter on the semaphore
* - up_read/up_write has decremented the active part of count if we come here * - up_read/up_write has decremented the active part of count if we come here
*/ */
struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem) asmregparm struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
{ {
unsigned long flags; unsigned long flags;
...@@ -236,7 +236,7 @@ struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem) ...@@ -236,7 +236,7 @@ struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem)
* - caller incremented waiting part of count and discovered it still negative * - caller incremented waiting part of count and discovered it still negative
* - just wake up any readers at the front of the queue * - just wake up any readers at the front of the queue
*/ */
struct rw_semaphore fastcall *rwsem_downgrade_wake(struct rw_semaphore *sem) asmregparm struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem)
{ {
unsigned long flags; unsigned long flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment