public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [FIX] CONFIG_REGPARM breaks non-asmlinkage syscalls
@ 2004-02-24 20:05 Andreas Gruenbacher
  2004-02-24 21:07 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Gruenbacher @ 2004-02-24 20:05 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, lkml, Chris Mason

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

Hello,

with CONFIG_REGPARM=y, syscalls must be declared asmlinkage or else
calling them will fail. Current gcc unfortunately does not warn about
this. (I have already told one of our compiler developers.) Attached is
a fix that adds a few missing declarations.

Regards,
-- 
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX AG

[-- Attachment #2: regparm-fix.diff --]
[-- Type: text/x-patch, Size: 3552 bytes --]

Index: linux-2.6.3/arch/ia64/ia32/sys_ia32.c
===================================================================
--- linux-2.6.3.orig/arch/ia64/ia32/sys_ia32.c
+++ linux-2.6.3/arch/ia64/ia32/sys_ia32.c
@@ -2990,7 +2990,7 @@ sys32_timer_create(u32 clock, struct sig
 	return err;
 }
 
-extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
+extern asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
 
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
 			__u32 len_low, __u32 len_high, int advice)
Index: linux-2.6.3/arch/x86_64/ia32/sys_ia32.c
===================================================================
--- linux-2.6.3.orig/arch/x86_64/ia32/sys_ia32.c
+++ linux-2.6.3/arch/x86_64/ia32/sys_ia32.c
@@ -1895,7 +1895,7 @@ sys32_timer_create(u32 clock, struct sig
 	return err; 
 } 
 
-extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
+extern asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
 
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
 			__u32 len_low, __u32 len_high, int advice)
Index: linux-2.6.3/include/linux/mm.h
===================================================================
--- linux-2.6.3.orig/include/linux/mm.h
+++ linux-2.6.3/include/linux/mm.h
@@ -455,8 +455,8 @@ extern int install_file_pte(struct mm_st
 extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
 extern int make_pages_present(unsigned long addr, unsigned long end);
 extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
-extern long sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long nonblock);
-extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
+extern asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long nonblock);
+extern asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
 void put_dirty_page(struct task_struct *tsk, struct page *page,
 			unsigned long address, pgprot_t prot);
 
Index: linux-2.6.3/include/linux/shm.h
===================================================================
--- linux-2.6.3.orig/include/linux/shm.h
+++ linux-2.6.3/include/linux/shm.h
@@ -90,7 +90,7 @@ struct shmid_kernel /* private to the ke
 #define SHM_LOCKED      02000   /* segment will not be swapped */
 #define SHM_HUGETLB     04000   /* segment will use huge TLB pages */
 
-long sys_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
+asmlinkage long sys_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
 asmlinkage long sys_shmget (key_t key, size_t size, int flag);
 asmlinkage long sys_shmdt (char __user *shmaddr);
 asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf);
Index: linux-2.6.3/mm/fremap.c
===================================================================
--- linux-2.6.3.orig/mm/fremap.c
+++ linux-2.6.3/mm/fremap.c
@@ -155,7 +155,7 @@ err_unlock:
  * protection is used. Arbitrary protections might be implemented in the
  * future.
  */
-long sys_remap_file_pages(unsigned long start, unsigned long size,
+asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
 	unsigned long __prot, unsigned long pgoff, unsigned long flags)
 {
 	struct mm_struct *mm = current->mm;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FIX] CONFIG_REGPARM breaks non-asmlinkage syscalls
@ 2004-02-24 20:08 Andreas Gruenbacher
  2004-02-25  2:44 ` Andreas Gruenbacher
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Gruenbacher @ 2004-02-24 20:08 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, lkml, Chris Mason

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

Hello,

with CONFIG_REGPARM=y, syscalls must be declared asmlinkage or else
calling them will fail. Current gcc unfortunately does not warn about
this. (I have already told one of our compiler developers.) Attached is
a fix that adds a few missing declarations.

Regards,
-- 
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX AG

[-- Attachment #2: regparm-fix.diff --]
[-- Type: text/x-patch, Size: 3552 bytes --]

Index: linux-2.6.3/arch/ia64/ia32/sys_ia32.c
===================================================================
--- linux-2.6.3.orig/arch/ia64/ia32/sys_ia32.c
+++ linux-2.6.3/arch/ia64/ia32/sys_ia32.c
@@ -2990,7 +2990,7 @@ sys32_timer_create(u32 clock, struct sig
 	return err;
 }
 
-extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
+extern asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
 
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
 			__u32 len_low, __u32 len_high, int advice)
Index: linux-2.6.3/arch/x86_64/ia32/sys_ia32.c
===================================================================
--- linux-2.6.3.orig/arch/x86_64/ia32/sys_ia32.c
+++ linux-2.6.3/arch/x86_64/ia32/sys_ia32.c
@@ -1895,7 +1895,7 @@ sys32_timer_create(u32 clock, struct sig
 	return err; 
 } 
 
-extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
+extern asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
 
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
 			__u32 len_low, __u32 len_high, int advice)
Index: linux-2.6.3/include/linux/mm.h
===================================================================
--- linux-2.6.3.orig/include/linux/mm.h
+++ linux-2.6.3/include/linux/mm.h
@@ -455,8 +455,8 @@ extern int install_file_pte(struct mm_st
 extern int handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma, unsigned long address, int write_access);
 extern int make_pages_present(unsigned long addr, unsigned long end);
 extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
-extern long sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long nonblock);
-extern long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
+extern asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size, unsigned long prot, unsigned long pgoff, unsigned long nonblock);
+extern asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);
 void put_dirty_page(struct task_struct *tsk, struct page *page,
 			unsigned long address, pgprot_t prot);
 
Index: linux-2.6.3/include/linux/shm.h
===================================================================
--- linux-2.6.3.orig/include/linux/shm.h
+++ linux-2.6.3/include/linux/shm.h
@@ -90,7 +90,7 @@ struct shmid_kernel /* private to the ke
 #define SHM_LOCKED      02000   /* segment will not be swapped */
 #define SHM_HUGETLB     04000   /* segment will use huge TLB pages */
 
-long sys_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
+asmlinkage long sys_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
 asmlinkage long sys_shmget (key_t key, size_t size, int flag);
 asmlinkage long sys_shmdt (char __user *shmaddr);
 asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf);
Index: linux-2.6.3/mm/fremap.c
===================================================================
--- linux-2.6.3.orig/mm/fremap.c
+++ linux-2.6.3/mm/fremap.c
@@ -155,7 +155,7 @@ err_unlock:
  * protection is used. Arbitrary protections might be implemented in the
  * future.
  */
-long sys_remap_file_pages(unsigned long start, unsigned long size,
+asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
 	unsigned long __prot, unsigned long pgoff, unsigned long flags)
 {
 	struct mm_struct *mm = current->mm;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FIX] CONFIG_REGPARM breaks non-asmlinkage syscalls
  2004-02-24 20:05 [FIX] CONFIG_REGPARM breaks non-asmlinkage syscalls Andreas Gruenbacher
@ 2004-02-24 21:07 ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2004-02-24 21:07 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: torvalds, linux-kernel, mason

Andreas Gruenbacher <agruen@suse.de> wrote:
>
> with CONFIG_REGPARM=y, syscalls must be declared asmlinkage or else
>  calling them will fail. Current gcc unfortunately does not warn about
>  this. (I have already told one of our compiler developers.) Attached is
>  a fix that adds a few missing declarations.

hm, thanks.  These should all be fixed by the "put all syscall decls in
syscalls.h" patch.  I'll hurry that along a bit.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FIX] CONFIG_REGPARM breaks non-asmlinkage syscalls
  2004-02-24 20:08 Andreas Gruenbacher
@ 2004-02-25  2:44 ` Andreas Gruenbacher
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Gruenbacher @ 2004-02-25  2:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml, Linus Torvalds

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

Hello,

> with CONFIG_REGPARM=y, syscalls must be declared asmlinkage or else
> calling them will fail. [...]

here are a couple more cases where the prototypes and definitions don't
match. I found them with a fixed gcc.

Regards,
-- 
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX AG

[-- Attachment #2: regparm-fix2.diff --]
[-- Type: text/x-patch, Size: 3194 bytes --]

Index: linux-2.6.3/arch/i386/kernel/semaphore.c
===================================================================
--- linux-2.6.3.orig/arch/i386/kernel/semaphore.c
+++ linux-2.6.3/arch/i386/kernel/semaphore.c
@@ -48,12 +48,14 @@
  *    we cannot lose wakeup events.
  */
 
-void __up(struct semaphore *sem)
+asmlinkage void
+__up(struct semaphore *sem)
 {
 	wake_up(&sem->wait);
 }
 
-void __down(struct semaphore * sem)
+asmlinkage void
+__down(struct semaphore * sem)
 {
 	struct task_struct *tsk = current;
 	DECLARE_WAITQUEUE(wait, tsk);
@@ -90,7 +92,8 @@ void __down(struct semaphore * sem)
 	tsk->state = TASK_RUNNING;
 }
 
-int __down_interruptible(struct semaphore * sem)
+asmlinkage int
+__down_interruptible(struct semaphore * sem)
 {
 	int retval = 0;
 	struct task_struct *tsk = current;
@@ -153,7 +156,8 @@ int __down_interruptible(struct semaphor
  * single "cmpxchg" without failure cases,
  * but then it wouldn't work on a 386.
  */
-int __down_trylock(struct semaphore * sem)
+asmlinkage int
+__down_trylock(struct semaphore * sem)
 {
 	int sleepers;
 	unsigned long flags;
Index: linux-2.6.3/drivers/isdn/hysdn/hysdn_defs.h
===================================================================
--- linux-2.6.3.orig/drivers/isdn/hysdn/hysdn_defs.h
+++ linux-2.6.3/drivers/isdn/hysdn/hysdn_defs.h
@@ -235,7 +235,6 @@ extern hysdn_card *card_root;	/* pointer
 /*************************/
 /* im/exported functions */
 /*************************/
-extern int printk(const char *fmt,...);
 extern char *hysdn_getrev(const char *);
 
 /* hysdn_procconf.c */
Index: linux-2.6.3/kernel/exit.c
===================================================================
--- linux-2.6.3.orig/kernel/exit.c
+++ linux-2.6.3/kernel/exit.c
@@ -748,7 +748,7 @@ static void exit_notify(struct task_stru
 
 }
 
-NORET_TYPE void do_exit(long code)
+asmlinkage NORET_TYPE void do_exit(long code)
 {
 	struct task_struct *tsk = current;
 
Index: linux-2.6.3/kernel/power/swsusp.c
===================================================================
--- linux-2.6.3.orig/kernel/power/swsusp.c
+++ linux-2.6.3/kernel/power/swsusp.c
@@ -72,7 +72,7 @@ extern long sys_sync(void);
 
 unsigned char software_suspend_enabled = 0;
 
-extern void do_magic(int resume);
+asmlinkage extern void do_magic(int resume);
 
 #define NORESUME		1
 #define RESUME_SPECIFIED	2
@@ -584,7 +584,7 @@ static void suspend_power_down(void)
  * Magic happens here
  */
 
-void do_magic_resume_1(void)
+asmlinkage void do_magic_resume_1(void)
 {
 	barrier();
 	mb();
@@ -597,7 +597,7 @@ void do_magic_resume_1(void)
 			   driver scheduled DMA, we have good chance for DMA to finish ;-). */
 }
 
-void do_magic_resume_2(void)
+asmlinkage void do_magic_resume_2(void)
 {
 	BUG_ON (nr_copy_pages_check != nr_copy_pages);
 	BUG_ON (pagedir_order_check != pagedir_order);
@@ -641,7 +641,7 @@ void do_magic_resume_2(void)
 
  */
 
-void do_magic_suspend_1(void)
+asmlinkage void do_magic_suspend_1(void)
 {
 	mb();
 	barrier();
@@ -649,7 +649,7 @@ void do_magic_suspend_1(void)
 	spin_lock_irq(&suspend_pagedir_lock);
 }
 
-void do_magic_suspend_2(void)
+asmlinkage void do_magic_suspend_2(void)
 {
 	int is_problem;
 	read_swapfiles();

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-25  2:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-24 20:05 [FIX] CONFIG_REGPARM breaks non-asmlinkage syscalls Andreas Gruenbacher
2004-02-24 21:07 ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2004-02-24 20:08 Andreas Gruenbacher
2004-02-25  2:44 ` Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox