From: Chris Metcalf <cmetcalf@tilera.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-arch@vger.kernel.org
Subject: Re: [PATCH] arch/tile: new multi-core architecture for Linux
Date: Thu, 27 May 2010 10:35:06 -0400 [thread overview]
Message-ID: <4BFE831A.8050002@tilera.com> (raw)
In-Reply-To: <201005271611.47963.arnd@arndb.de>
On 5/27/2010 10:11 AM, Arnd Bergmann wrote:
>>> > > I see. AFAICT, all other architectures don't need the wrapper in
>>> > > the 32 bit native case because they define the syscall calling
>>> > > conventions in libc such that they match what the kernel
>>> > > expects for a 64 bit argument (typically split in two subsequent
>>> > > argument slots). Would that work for you as well?
>>>
>>
>> > Yes, we could override this in libc. My assumption was that it was
>> > cleaner to do it in the kernel, since we support uclibc and glibc, and
>> > doing it in the kernel meant only doing it in one place.
>>
> That's not the way I meant. There are two options how (any) libc can
> implement this:
> 1. the calling conventions for user function calls and for kernel
> function calls are the same, so you don't need to do anything here.
> 2. the calling conventions are different, so you already need a wrapper
> in user space for 64 bit arguments to split them up and you could
> to that in exactly the way that the kernel expects to be called.
>
The issue is that libc support for 64-bit operands on 32-bit platforms
tends to look like "syscall(foo64, arg1, LOW(arg2), HIGH(arg2))". This
naturally passes the arguments in consecutive registers, for a
register-based calling convention like ours. However, invoking
"foo64(arg1, (u64)arg2)" passes the u64 argument in the next consecutive
even/odd numbered pair of registers on our architecture. Arguably this
notion of register alignment isn't particularly helpful, but we opted to
do it this way when we settled on the API. The upshot is that to match
this, userspace needs to do "syscall(foo64, arg1, dummy, LOW(arg2),
HIGH(arg2))". So we need to provide these dummy-argument versions of
the syscall wrappers to all the libcs that we use (currently uclibc,
glibc, and sometimes newlib). Where the 64-bit argument falls naturally
on an even register boundary we don't need to provide any kernel stub.
Basically the scenario is your #2 above, but userspace already has an
implementation of the user-space wrapper in the generic code, and I'm
trying to avoid having to provide a tile-specific version of it.
For reference, here's readahead() in glibc (overridden to be a pure
syscall wrapper for 64-bit architectures):
ssize_t
__readahead (int fd, off64_t offset, size_t count)
{
return INLINE_SYSCALL (readahead, 4, fd,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)),
count);
}
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
next prev parent reply other threads:[~2010-05-27 14:35 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201005200543.o4K5hFRF006079@farm-0002.internal.tilera.com>
[not found] ` <4BF757FF.6060100@tilera.com>
2010-05-23 22:08 ` [PATCH] arch/tile: new multi-core architecture for Linux Arnd Bergmann
2010-05-24 15:29 ` Chris Metcalf
2010-05-24 15:29 ` Chris Metcalf
2010-05-24 18:53 ` Arnd Bergmann
2010-05-24 21:29 ` Chris Metcalf
2010-05-24 21:29 ` Chris Metcalf
2010-05-25 13:54 ` Chris Metcalf
2010-05-25 13:54 ` Chris Metcalf
2010-05-25 15:03 ` Arnd Bergmann
2010-05-25 15:13 ` Chris Metcalf
2010-05-25 15:30 ` Arnd Bergmann
2010-05-26 2:44 ` liqin.chen
2010-05-26 13:45 ` Chris Metcalf
[not found] ` <4BFBE005.2070500@tilera.com>
[not found] ` <201005251721.23782.arnd@arndb.de>
2010-05-26 23:05 ` Chris Metcalf
2010-05-26 5:02 ` Paul Mundt
2010-05-25 21:45 ` Arnd Bergmann
2010-05-27 0:58 ` Chris Metcalf
2010-05-27 8:41 ` Arnd Bergmann
2010-05-27 13:30 ` Chris Metcalf
2010-05-27 13:41 ` Geert Uytterhoeven
2010-05-27 13:48 ` Paul Mundt
2010-05-27 14:11 ` Arnd Bergmann
2010-05-27 14:35 ` Chris Metcalf [this message]
2010-05-27 15:02 ` Arnd Bergmann
2010-05-27 15:04 ` Chris Metcalf
2010-05-27 15:20 ` Arnd Bergmann
2010-05-27 14:52 ` Marc Gauthier
2010-05-27 14:52 ` Marc Gauthier
2010-05-28 17:58 ` Chris Metcalf
2010-05-27 15:03 ` Chris Metcalf
2010-05-27 20:34 ` Jamie Lokier
2010-05-27 20:53 ` Arnd Bergmann
2010-05-28 16:45 ` Chris Metcalf
2010-05-28 17:16 ` Arnd Bergmann
2010-05-28 17:28 ` Chris Metcalf
2010-05-24 20:22 ` Sam Ravnborg
2010-05-24 21:30 ` Chris Metcalf
2010-05-25 5:02 ` Sam Ravnborg
2010-05-25 5:02 ` Sam Ravnborg
2010-05-29 3:01 ` [PATCH 1/8] Fix up the "generic" unistd.h ABI to be more useful Chris Metcalf
2010-05-29 3:01 ` Chris Metcalf
2010-05-29 3:01 ` Chris Metcalf
2010-05-29 3:09 ` [PATCH 2/8] arch/tile: infrastructure and configuration-related files Chris Metcalf
2010-05-29 3:09 ` Chris Metcalf
2010-05-31 7:47 ` Paul Mundt
2010-06-03 17:54 ` Chris Metcalf
2010-05-29 3:09 ` Chris Metcalf
2010-05-29 3:10 ` [PATCH 3/8] arch/tile: header files for the Tile architecture Chris Metcalf
2010-05-31 2:58 ` FUJITA Tomonori
2010-06-03 21:32 ` [PATCH] arch/tile: respond to reviews of the second code submission Chris Metcalf
2010-06-04 0:50 ` Paul Mundt
2010-06-04 1:31 ` FUJITA Tomonori
2010-06-07 5:25 ` FUJITA Tomonori
2010-05-29 3:10 ` [PATCH 4/8] arch/tile: core kernel/ code Chris Metcalf
2010-05-31 2:58 ` FUJITA Tomonori
2010-05-29 3:11 ` [PATCH 5/8] arch/tile: the kernel/tile-desc_32.c file Chris Metcalf
2010-05-29 3:13 ` [PATCH 6/8] arch/tile: the mm/ directory Chris Metcalf
2010-05-29 3:16 ` [PATCH 7/8] arch/tile: lib/ directory Chris Metcalf
2010-05-29 3:16 ` Chris Metcalf
2010-05-29 3:17 ` [PATCH 8/8] arch/tile: hypervisor console driver Chris Metcalf
2010-05-29 3:17 ` Chris Metcalf
2010-05-29 3:20 ` [PATCH 0/8] revised patch for arch/tile/ support Chris Metcalf
2010-05-29 3:20 ` Chris Metcalf
2010-05-29 11:29 ` Arnd Bergmann
2010-06-03 20:40 ` Arnd Bergmann
2010-06-03 21:48 ` Chris Metcalf
2010-06-04 21:32 ` Chris Metcalf
2010-06-05 12:56 ` Stephen Rothwell
2010-06-05 13:30 ` Chris Metcalf
2010-06-05 14:10 ` Stephen Rothwell
[not found] ` <dVZMmBu$KHA.5388@exchange1.tad.internal.tilera.com>
2010-05-29 3:20 ` Chris Metcalf
2010-05-29 3:20 ` Chris Metcalf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BFE831A.8050002@tilera.com \
--to=cmetcalf@tilera.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).