* [PATCH] [POWERPC] Wire up sys_sync_file_range
@ 2007-03-09 4:22 Stephen Rothwell
2007-03-09 6:55 ` David Woodhouse
2007-03-17 15:10 ` Stephen Rothwell
0 siblings, 2 replies; 6+ messages in thread
From: Stephen Rothwell @ 2007-03-09 4:22 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev, David Woodhouse
This requires an architecture specific compat routine as u64s are passed
in odd/even (high/low) register pairs on ppc32.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
arch/powerpc/kernel/sys_ppc32.c | 9 +++++++++
include/asm-powerpc/systbl.h | 1 +
include/asm-powerpc/unistd.h | 3 ++-
3 files changed, 12 insertions(+), 1 deletions(-)
David, the other two missing syscalls were wired up in the previous patch
set I sent today. Thanks for your patch to push us along.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 673e8d9..b282035 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -814,3 +814,12 @@ asmlinkage long compat_sys_request_key(const char __user *_type,
return sys_request_key(_type, _description, _callout_info, destringid);
}
+asmlinkage long compat_sys_sync_file_range(int fd, u32 unused,
+ u32 offset_high, u32 offset_low,
+ u32 nbytes_high, u32 nbytes_low,
+ compat_uint_t flags)
+{
+ return sys_sync_file_range(fd, (loff_t)offset_high << 32 | offset_low,
+ (loff_t)nbytes_high << 32 | nbytes_low,
+ (unsigned int)flags);
+}
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 8d853c5..3676a20 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -307,3 +307,4 @@ COMPAT_SYS_SPU(set_robust_list)
COMPAT_SYS_SPU(move_pages)
SYSCALL_SPU(getcpu)
COMPAT_SYS(epoll_pwait)
+COMPAT_SYS_SPU(sync_file_range)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index 2baedbe..17c2b96 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -326,10 +326,11 @@
#define __NR_move_pages 301
#define __NR_getcpu 302
#define __NR_epoll_pwait 303
+#define __NR_sync_file_range 304
#ifdef __KERNEL__
-#define __NR_syscalls 304
+#define __NR_syscalls 305
#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
--
1.5.0.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
2007-03-09 4:22 [PATCH] [POWERPC] Wire up sys_sync_file_range Stephen Rothwell
@ 2007-03-09 6:55 ` David Woodhouse
2007-03-09 7:13 ` David Miller
2007-03-17 15:10 ` Stephen Rothwell
1 sibling, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2007-03-09 6:55 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-arch, ppc-dev, paulus, rmk, ralf
On Fri, 2007-03-09 at 15:22 +1100, Stephen Rothwell wrote:
> This requires an architecture specific compat routine as u64s are passed
> in odd/even (high/low) register pairs on ppc32.
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Doesn't that apply to ARM and to 32-bit MIPS too? And perhaps others?
> --- a/arch/powerpc/kernel/sys_ppc32.c
> +++ b/arch/powerpc/kernel/sys_ppc32.c
> @@ -814,3 +814,12 @@ asmlinkage long compat_sys_request_key(const char __user *_type,
> return sys_request_key(_type, _description, _callout_info, destringid);
> }
>
> +asmlinkage long compat_sys_sync_file_range(int fd, u32 unused,
> + u32 offset_high, u32 offset_low,
> + u32 nbytes_high, u32 nbytes_low,
> + compat_uint_t flags)
> +{
> + return sys_sync_file_range(fd, (loff_t)offset_high << 32 | offset_low,
> + (loff_t)nbytes_high << 32 | nbytes_low,
> + (unsigned int)flags);
> +}
--
dwmw2
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
2007-03-09 6:55 ` David Woodhouse
@ 2007-03-09 7:13 ` David Miller
2007-03-09 11:59 ` Ralf Baechle
0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2007-03-09 7:13 UTC (permalink / raw)
To: dwmw2; +Cc: linux-arch, sfr, ralf, linuxppc-dev, paulus, rmk
From: David Woodhouse <dwmw2@infradead.org>
Date: Fri, 09 Mar 2007 06:55:41 +0000
> On Fri, 2007-03-09 at 15:22 +1100, Stephen Rothwell wrote:
> > This requires an architecture specific compat routine as u64s are passed
> > in odd/even (high/low) register pairs on ppc32.
> >
> > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>
> Doesn't that apply to ARM and to 32-bit MIPS too? And perhaps others?
Unfortunately in the MIPS case you'll have to do some ifdef'ing because
the order of the "high" and "low" sub-part arguments is dependant upon
endianness and MIPS can be both big and little endian.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
2007-03-09 7:13 ` David Miller
@ 2007-03-09 11:59 ` Ralf Baechle
2007-03-15 10:23 ` Stephen Rothwell
0 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2007-03-09 11:59 UTC (permalink / raw)
To: David Miller; +Cc: linux-arch, sfr, linuxppc-dev, paulus, dwmw2, rmk
On Thu, Mar 08, 2007 at 11:13:41PM -0800, David Miller wrote:
> > On Fri, 2007-03-09 at 15:22 +1100, Stephen Rothwell wrote:
> > > This requires an architecture specific compat routine as u64s are passed
> > > in odd/even (high/low) register pairs on ppc32.
> > >
> > > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> >
> > Doesn't that apply to ARM and to 32-bit MIPS too? And perhaps others?
>
> Unfortunately in the MIPS case you'll have to do some ifdef'ing because
> the order of the "high" and "low" sub-part arguments is dependant upon
> endianness and MIPS can be both big and little endian.
I'd rather let the C compiler sort it out:
asmlinkage long compat_sys_sync_file_range(int fd, int dummy,
loff_t offset, loff_t nbytes, unsigned int flags)
{
sys_sync_file_range(fd, offset, nbytes, flags);
}
Which looks like it could be portable to PPC even, so maybe a little cpp
magic like:
#ifdef CONFIG_ABI_NEEDS_PADDING_
#define PAD_64BIT_ARG(x) unsigned int x,
#else
#define PAD_64BIT_ARG(x)
#endif
[...]
asmlinkage long sys_sync_file_range(int fd, PAD_64BIT_ARG(pad1)
loff_t offset, loff_t nbytes, unsigned int flags)
Ralf
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
2007-03-09 11:59 ` Ralf Baechle
@ 2007-03-15 10:23 ` Stephen Rothwell
0 siblings, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2007-03-15 10:23 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-arch, linuxppc-dev, paulus, dwmw2, David Miller, rmk
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
On Fri, 9 Mar 2007 11:59:02 +0000 Ralf Baechle <ralf@linux-mips.org> wrote:
>
> I'd rather let the C compiler sort it out:
>
> asmlinkage long compat_sys_sync_file_range(int fd, int dummy,
> loff_t offset, loff_t nbytes, unsigned int flags)
> {
> sys_sync_file_range(fd, offset, nbytes, flags);
> }
>
> Which looks like it could be portable to PPC even, so maybe a little cpp
> magic like:
>
> #ifdef CONFIG_ABI_NEEDS_PADDING_
> #define PAD_64BIT_ARG(x) unsigned int x,
> #else
> #define PAD_64BIT_ARG(x)
> #endif
>
> [...]
> asmlinkage long sys_sync_file_range(int fd, PAD_64BIT_ARG(pad1)
> loff_t offset, loff_t nbytes, unsigned int flags)
Except the compat routines are built with a 64 bit compiler and the
callinf convention is different for 64 bit. i.e. on ppc64 that routine
uses a single register for each parameter, while on 32 bit it uses 2
registers for each of the loff_t's. It is this difference that we have
to cope with in the 64 bit kernel when the user process is 32 bit.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
2007-03-09 4:22 [PATCH] [POWERPC] Wire up sys_sync_file_range Stephen Rothwell
2007-03-09 6:55 ` David Woodhouse
@ 2007-03-17 15:10 ` Stephen Rothwell
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Rothwell @ 2007-03-17 15:10 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: ppc-dev, paulus, David Woodhouse
[-- Attachment #1: Type: text/plain, Size: 741 bytes --]
On Fri, 9 Mar 2007 15:22:01 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> +asmlinkage long compat_sys_sync_file_range(int fd, u32 unused,
> + u32 offset_high, u32 offset_low,
> + u32 nbytes_high, u32 nbytes_low,
> + compat_uint_t flags)
> +{
> + return sys_sync_file_range(fd, (loff_t)offset_high << 32 | offset_low,
> + (loff_t)nbytes_high << 32 | nbytes_low,
> + (unsigned int)flags);
> +}
As pointed out elsewhere, this won't work as it needs to many registers
(we only have 6 for syscall args). Probably our best bet is to follow in
arm's footsteps and create a wrapper that puts the flags arg after fd.
Comments?
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-03-17 15:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 4:22 [PATCH] [POWERPC] Wire up sys_sync_file_range Stephen Rothwell
2007-03-09 6:55 ` David Woodhouse
2007-03-09 7:13 ` David Miller
2007-03-09 11:59 ` Ralf Baechle
2007-03-15 10:23 ` Stephen Rothwell
2007-03-17 15:10 ` Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).