On 10 June 2018 at 13:32, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 10 June 2018 at 04:00, Richard Henderson > <richard.hender...@linaro.org> 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 <richard.hender...@linaro.org>
>> +/* 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