* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
[not found] <20070309152201.027c2bf5.sfr@canb.auug.org.au>
@ 2007-03-09 6:55 ` David Woodhouse
2007-03-09 7:13 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2007-03-09 6:55 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: paulus, ppc-dev, ralf, rmk, linux-arch
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] 4+ messages in thread
* Re: [PATCH] [POWERPC] Wire up sys_sync_file_range
2007-03-09 6:55 ` [PATCH] [POWERPC] Wire up sys_sync_file_range David Woodhouse
@ 2007-03-09 7:13 ` David Miller
2007-03-09 11:59 ` Ralf Baechle
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2007-03-09 7:13 UTC (permalink / raw)
To: dwmw2; +Cc: sfr, paulus, linuxppc-dev, ralf, rmk, linux-arch
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] 4+ 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; 4+ messages in thread
From: Ralf Baechle @ 2007-03-09 11:59 UTC (permalink / raw)
To: David Miller; +Cc: dwmw2, sfr, paulus, linuxppc-dev, rmk, linux-arch
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] 4+ 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; 4+ messages in thread
From: Stephen Rothwell @ 2007-03-15 10:23 UTC (permalink / raw)
To: Ralf Baechle; +Cc: David Miller, dwmw2, paulus, linuxppc-dev, rmk, linux-arch
[-- 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] 4+ messages in thread
end of thread, other threads:[~2007-03-15 10:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070309152201.027c2bf5.sfr@canb.auug.org.au>
2007-03-09 6:55 ` [PATCH] [POWERPC] Wire up sys_sync_file_range David Woodhouse
2007-03-09 7:13 ` David Miller
2007-03-09 11:59 ` Ralf Baechle
2007-03-15 10:23 ` 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).