qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 009/108] linux-user: Set up infrastructure fo


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 009/108] linux-user: Set up infrastructure for table-izing syscalls
Date: Sun, 10 Jun 2018 13:39:12 +0100

On 10 June 2018 at 13:32, Peter Maydell <address@hidden> wrote:
> On 10 June 2018 at 04:00, Richard Henderson
> <address@hidden> wrote:
>> At the same time, split out set_robust_list and get_robust_list.
>> Put them together, along with their block comment, at the top
>> of syscall_table.
>>
>> Signed-off-by: Richard Henderson <address@hidden>

>> +/* For a given syscall number, return a function implementing it.
>> + * Do this via switch statement instead of table because some targets
>> + * do not begin at 0 and others have a large split in the middle of
>> + * the numbers.  The compiler should be able to produce a dense table.
>> + */

> I was expecting this to be a table lookup, something like
>    return syscalls[num].impl;
>
> where the other entries in the syscalls[num] structs would be
> for instance the strace data we currently have in strace.list.

Ah, I see the comment covers this. I'd still rather we had all
the information related to a syscall in one place, though -- this
way we end up with the ifdefs and so on which determine whether
a syscall is implemented having to be duplicated:
 (a) in the implementation
 (b) in this switch code
 (c) in the handling of strace
It would be cleaner to have a single
#if something
static foo_impl(..) { ... }
static syscall_impl foo = {
    .name = "foo",
    .impl = foo_impl,
    .strace_stuff = ...,
};
register_syscall(foo);
#endif

Hash table?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]