diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2012-07-23 08:07:22 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2012-08-13 12:45:46 +0100 |
commit | dd6e957a142d9582df766b5c6de2fbb6773241f2 (patch) | |
tree | fe85e5897149af233de4e6b3dbcafc45393a5cd9 | |
parent | 5f72307d90a00caabdf786d940418f810bd7c095 (diff) | |
download | qemu-dd6e957a142d9582df766b5c6de2fbb6773241f2.zip qemu-dd6e957a142d9582df766b5c6de2fbb6773241f2.tar.gz qemu-dd6e957a142d9582df766b5c6de2fbb6773241f2.tar.bz2 |
linux-user: Move target_to_host_errno_table[] setup out of ioctl loop
The code to initialise the target_to_host_errno_table[] array was
accidentally inside the loop through checking and initialising all
the supported ioctls. This was harmless but meant that we reinitialised the
array several hundred times on startup.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | linux-user/syscall.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3ba3ef5..8a06131 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4606,6 +4606,12 @@ void syscall_init(void) #undef STRUCT #undef STRUCT_SPECIAL + /* Build target_to_host_errno_table[] table from + * host_to_target_errno_table[]. */ + for (i = 0; i < ERRNO_TABLE_SIZE; i++) { + target_to_host_errno_table[host_to_target_errno_table[i]] = i; + } + /* we patch the ioctl size if necessary. We rely on the fact that no ioctl has all the bits at '1' in the size field */ ie = ioctl_entries; @@ -4625,11 +4631,6 @@ void syscall_init(void) (size << TARGET_IOC_SIZESHIFT); } - /* Build target_to_host_errno_table[] table from - * host_to_target_errno_table[]. */ - for (i=0; i < ERRNO_TABLE_SIZE; i++) - target_to_host_errno_table[host_to_target_errno_table[i]] = i; - /* automatic consistency check if same arch */ #if (defined(__i386__) && defined(TARGET_I386) && defined(TARGET_ABI32)) || \ (defined(__x86_64__) && defined(TARGET_X86_64)) |