On 7/8/21 7:11 AM, Philippe Mathieu-Daudé wrote:
Convert the host_to_target_errno_table[] array to a switch case
to allow compiler optimizations. Extract the errnos list as to
a new includible unit, using a generic macro. Remove the code
related to target_to_host_errno_table[] initialization.
Suggested-by: Richard Henderson <richard.hender...@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
linux-user/syscall.c | 169 +++++-----------------------------------
linux-user/errnos.c.inc | 140 +++++++++++++++++++++++++++++++++
2 files changed, 161 insertions(+), 148 deletions(-)
create mode 100644 linux-user/errnos.c.inc
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 56682b06cbd..8bb528d2cf7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -507,157 +507,37 @@ static inline int next_free_host_timer(void)
}
#endif
-#define ERRNO_TABLE_SIZE 1200
-
static inline bool errno_exists(int err)
{
- return err >= 0 && err < ERRNO_TABLE_SIZE;
+ switch (err) {
+#define E(X) case X: return true;
+#include "errnos.c.inc"
+#undef E
+ default:
+ return false;
+ }
}
Not true. As documented, errnos.c.inc only contains those errno values which are
overridden, not all errno values which are valid.
r~