Module: xenomai-jki
Branch: for-forge
Commit: cff234b456113c1b76e5848dcb448573fbcfd26c
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=cff234b456113c1b76e5848dcb448573fbcfd26c

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Feb 12 18:29:12 2015 +0100

cobalt/posix: Add support for return long values from syscalls

So far, handle_head/root_syscall limited to width of return values to
int, thus 32-bit. This was waiting to break, and it did over the rework
of the mayday syscall which now passed a pointer back. But also I/O
syscalls were vulnerable on 64-bit platforms, at least in principle.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h      |    2 +-
 kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall.h |    2 +-
 kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h    |    2 +-
 kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h  |    2 +-
 kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h       |    2 +-
 kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h      |    2 +-
 kernel/cobalt/posix/syscall.c                             |    6 ++++--
 7 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
index fec3c59..d80df77 100644
--- a/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/arm/include/asm/xenomai/syscall.h
@@ -57,7 +57,7 @@ static inline void __xn_error_return(struct pt_regs *regs, 
int v)
        __xn_reg_rval(regs) = v;
 }
 
-static inline void __xn_status_return(struct pt_regs *regs, int v)
+static inline void __xn_status_return(struct pt_regs *regs, long v)
 {
        __xn_reg_rval(regs) = v;
 }
diff --git a/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall.h
index e0fc958..12760a1 100644
--- a/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/blackfin/include/asm/xenomai/syscall.h
@@ -39,7 +39,7 @@ static inline void __xn_error_return(struct pt_regs *regs, 
int v)
        __xn_reg_rval(regs) = v;
 }
 
-static inline void __xn_status_return(struct pt_regs *regs, int v)
+static inline void __xn_status_return(struct pt_regs *regs, long v)
 {
        __xn_reg_rval(regs) = v;
 }
diff --git a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h
index e226ddc..c329dc3 100644
--- a/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/nios2/include/asm/xenomai/syscall.h
@@ -42,7 +42,7 @@ static inline void __xn_error_return(struct pt_regs *regs, 
int v)
        __xn_reg_rval(regs) = v;
 }
 
-static inline void __xn_status_return(struct pt_regs *regs, int v)
+static inline void __xn_status_return(struct pt_regs *regs, long v)
 {
        __xn_reg_rval(regs) = v;
 }
diff --git a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h
index 5cfe49c..a0e6103 100644
--- a/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/powerpc/include/asm/xenomai/syscall.h
@@ -48,7 +48,7 @@ static inline void __xn_error_return(struct pt_regs *regs, 
int v)
        __xn_reg_rval(regs) = v;
 }
 
-static inline void __xn_status_return(struct pt_regs *regs, int v)
+static inline void __xn_status_return(struct pt_regs *regs, long v)
 {
        __xn_reg_rval(regs) = v;
 }
diff --git a/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h
index 74809e0..b84fb24 100644
--- a/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/sh/include/asm/xenomai/syscall.h
@@ -39,7 +39,7 @@ static inline void __xn_error_return(struct pt_regs *regs, 
int v)
        __xn_reg_rval(regs) = v;
 }
 
-static inline void __xn_status_return(struct pt_regs *regs, int v)
+static inline void __xn_status_return(struct pt_regs *regs, long v)
 {
        __xn_reg_rval(regs) = v;
 }
diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h 
b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
index b9eea7a..018e348 100644
--- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
+++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall.h
@@ -54,7 +54,7 @@ static inline void __xn_error_return(struct pt_regs *regs, 
int v)
        __xn_reg_rval(regs) = v;
 }
 
-static inline void __xn_status_return(struct pt_regs *regs, int v)
+static inline void __xn_status_return(struct pt_regs *regs, long v)
 {
        __xn_reg_rval(regs) = v;
 }
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 416e18f..9ad65e3 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -710,12 +710,13 @@ static const int cobalt_sysmodes[] = {
 static int handle_head_syscall(struct ipipe_domain *ipd, struct pt_regs *regs)
 {
        struct cobalt_process *process;
-       int switched, ret, sigs;
+       int switched, sigs;
        struct xnthread *thread;
        cobalt_syshand handler;
        struct task_struct *p;
        unsigned int nr, code;
        int sysflags;
+       long ret;
 
        if (!__xn_syscall_p(regs))
                goto linux_syscall;
@@ -890,11 +891,12 @@ bad_syscall:
 
 static int handle_root_syscall(struct ipipe_domain *ipd, struct pt_regs *regs)
 {
-       int sysflags, switched, ret, sigs;
+       int sysflags, switched, sigs;
        struct xnthread *thread;
        cobalt_syshand handler;
        struct task_struct *p;
        unsigned int nr, code;
+       long ret;
 
        /*
         * Catch cancellation requests pending for user shadows


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to