From: Chris Metcalf <cmetcalf@tilera.com>
To: Arnd Bergmann <arnd@arndb.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org
Subject: Re: [PATCH] arch/tile: new multi-core architecture for Linux
Date: Wed, 26 May 2010 19:05:56 -0400 [thread overview]
Message-ID: <4BFDA954.7070701@tilera.com> (raw)
In-Reply-To: <201005251721.23782.arnd@arndb.de>
On 5/25/2010 11:21 AM, Arnd Bergmann wrote (in private email):
> I just realized that the the sys_call_table is not yet
> being generated automatically. The code is only present
> in arch/score/kernel/sys_call_table.c.
>
> To do this correctly, you should take that file and
> put it into kernel/sys_call_table.c, configured with
> CONFIG_GENERIC_SYSCALLTABLE, which you then enable
> in your arch/tile/Kconfig.
> The unistd.h is also missing the compat syscall table
> entries. It would be good to extend the macros to cover
> that as well, similar to how it's done in
> arch/powerpc/include/asm/systbl.h.
>
The hard part to applying this approach turned out to be the COMPAT code
for our 64-bit platform. The approach I am using now is to extend
<linux/compat.h> with all the compat syscalls that are not currently
prototyped, and then to include a a set of #defines that allow all the
compat syscalls to be invoked as "compat_sys_foo()", e.g.
+/* Standard Linux functions that don't have "compat" versions. */
+#define compat_sys_accept sys_accept
+#define compat_sys_accept4 sys_accept4
+#define compat_sys_access sys_access
+#define compat_sys_acct sys_acct
[...]
+#define compat_sys_uselib sys_uselib
+#define compat_sys_vfork sys_vfork
+#define compat_sys_vhangup sys_vhangup
+#define compat_sys_write sys_write
With that in place, you can then use the "arch/score" mechanism to
generate not just the main syscall table, but the compat table as well,
by doing something like this:
+#undef __SYSCALL
+#define __SYSCALL(nr, call) [nr] = (compat_##call),
+
+void *compat_sys_call_table[__NR_syscalls] = {
+ [0 ... __NR_syscalls-1] = sys_ni_syscall,
+#include <asm/unistd.h>
+};
To make this really work out, I also had to add a __SYSCALL_COMPAT
notion to <asm-generic/unistd.h>; when this is set, the __NR_xxx values
and the __SYSCALL stuff are set up as if for a 32-bit platform, even if
the real platform is 64-bit, so that the header can be used to create
the compat_sys_call_table[] properly.
I fixed a few other minor glitches too, like the fact that we need
sys_fadvise64_64 to be the "primary" syscall even in the 64-bit case
(not sys_fadvise64), and adding an __ARCH_WANT_SYNC_FILE_RANGE2 flag to
the generic ABI so platforms can request the use of that flavor of the
ABI instead. (It makes a difference on our platform.) And I took
Arnd's suggestion and added 16 architecture-specific syscalls from 244
to 259.
Note that it turns out not to be quite right to make the
sys_call_table.c a generic file, at least in our case, since you really
want to allow tweaking the actual syscall functions as part of
generating the sys_call_table[] array. For example, on our 32-bit
platforms some of the 64-bit syscalls need wrappers since otherwise
there is a mismatch between the generic code in libc that splits 64-bit
values into 32-bit registers, and the actual registers pairs used by our
ABI for native 64-bit values. In any case it's only half a dozen lines
of common code. And in compat mode there are additional overrides you
want, such as using sys_newstat() for compat_sys_stat64(), if your
architecture will tolerate it, etc.
I'll send a complete patch later once I've finished digesting all the
various suggestions folks have sent, but this was a big enough piece
that I thought I'd at least summarize the design back to LKML in case
people would care to comment.
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
next prev parent reply other threads:[~2010-05-26 23:06 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-20 5:43 [PATCH] arch/tile: new multi-core architecture for Linux Chris Metcalf
2010-05-20 8:04 ` Barry Song
2010-05-20 14:32 ` Linus Torvalds
2010-05-20 19:10 ` Chris Metcalf
2010-05-21 4:52 ` Barry Song
2010-05-21 15:13 ` Chris Metcalf
2010-05-20 19:12 ` [PATCH] generic: make lowmem_page_address() use PFN_PHYS() for improved portability Chris Metcalf
2010-05-22 4:05 ` [PATCH] arch/tile: new multi-core architecture for Linux Chris Metcalf
2010-05-23 22:08 ` Arnd Bergmann
2010-05-24 15:29 ` Chris Metcalf
2010-05-24 18:53 ` Arnd Bergmann
2010-05-24 21:29 ` 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 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 [this message]
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
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-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
2011-05-16 18:23 ` [PATCH] arch/tile: support signal "exception-trace" hook Chris Metcalf
2011-05-18 18:14 ` Chris Metcalf
2011-05-17 20:26 ` [PATCH] arch/tile: add /proc/tile, /proc/sys/tile, and a sysfs cpu attribute Chris Metcalf
2011-05-19 13:41 ` Arnd Bergmann
2011-05-19 15:12 ` Chris Metcalf
2011-05-19 15:22 ` Arnd Bergmann
2011-05-20 14:26 ` Chris Metcalf
2011-05-20 14:37 ` Arnd Bergmann
2011-05-20 14:37 ` Arnd Bergmann
2011-05-20 15:00 ` Chris Metcalf
2011-05-20 15:00 ` Chris Metcalf
2011-05-20 15:13 ` Arnd Bergmann
2011-05-20 15:13 ` Arnd Bergmann
2011-05-20 19:59 ` Arnd Bergmann
2011-05-25 19:09 ` Chris Metcalf
2011-05-25 19:17 ` Chris Metcalf
2011-05-25 19:18 ` Chris Metcalf
2011-05-25 20:20 ` Arnd Bergmann
2011-05-25 20:31 ` Chris Metcalf
2011-05-25 20:34 ` Arnd Bergmann
2011-05-25 20:34 ` Arnd Bergmann
2011-05-25 20:31 ` Chris Metcalf
2011-05-25 20:20 ` Arnd Bergmann
2011-05-25 19:18 ` Chris Metcalf
2011-05-20 19:59 ` Arnd Bergmann
2011-05-20 14:26 ` Chris Metcalf
2011-05-24 15:38 ` Arnd Bergmann
2011-05-24 15:38 ` Arnd Bergmann
2011-05-19 15:22 ` Arnd Bergmann
2011-05-26 16:40 ` [PATCH v2] arch/tile: more /proc and /sys file support Chris Metcalf
2011-05-26 16:40 ` Chris Metcalf
2011-05-27 14:23 ` Arnd Bergmann
2011-05-27 14:23 ` Arnd Bergmann
2010-05-24 20:22 ` [PATCH] arch/tile: new multi-core architecture for Linux Sam Ravnborg
2010-05-24 21:30 ` Chris Metcalf
2010-05-25 5:02 ` Sam Ravnborg
2010-05-25 20:12 ` Thomas Gleixner
2010-05-26 1:57 ` Chris Metcalf
2010-05-26 16:22 ` Chris Metcalf
2010-05-26 17:09 ` Arnd Bergmann
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:09 ` [PATCH 2/8] arch/tile: infrastructure and configuration-related files 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
[not found] ` <dVZMmBu$KHA.5388@exchange1.tad.internal.tilera.com>
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
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=4BFDA954.7070701@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.