@@ -509,150 +509,26 @@ static inline int next_free_host_timer(void)
509509
510510#define ERRNO_TABLE_SIZE 1200
511511
512- /* target_to_host_errno_table[] is initialized from
513- * host_to_target_errno_table[] in syscall_init(). */
514- static uint16_t target_to_host_errno_table [ERRNO_TABLE_SIZE ] = {
515- };
516-
517- /*
518- * This list is the union of errno values overridden in asm-<arch>/errno.h
519- * minus the errnos that are not actually generic to all archs.
520- */
521- static uint16_t host_to_target_errno_table [ERRNO_TABLE_SIZE ] = {
522- [EAGAIN ] = TARGET_EAGAIN ,
523- [EIDRM ] = TARGET_EIDRM ,
524- [ECHRNG ] = TARGET_ECHRNG ,
525- [EL2NSYNC ] = TARGET_EL2NSYNC ,
526- [EL3HLT ] = TARGET_EL3HLT ,
527- [EL3RST ] = TARGET_EL3RST ,
528- [ELNRNG ] = TARGET_ELNRNG ,
529- [EUNATCH ] = TARGET_EUNATCH ,
530- [ENOCSI ] = TARGET_ENOCSI ,
531- [EL2HLT ] = TARGET_EL2HLT ,
532- [EDEADLK ] = TARGET_EDEADLK ,
533- [ENOLCK ] = TARGET_ENOLCK ,
534- [EBADE ] = TARGET_EBADE ,
535- [EBADR ] = TARGET_EBADR ,
536- [EXFULL ] = TARGET_EXFULL ,
537- [ENOANO ] = TARGET_ENOANO ,
538- [EBADRQC ] = TARGET_EBADRQC ,
539- [EBADSLT ] = TARGET_EBADSLT ,
540- [EBFONT ] = TARGET_EBFONT ,
541- [ENOSTR ] = TARGET_ENOSTR ,
542- [ENODATA ] = TARGET_ENODATA ,
543- [ETIME ] = TARGET_ETIME ,
544- [ENOSR ] = TARGET_ENOSR ,
545- [ENONET ] = TARGET_ENONET ,
546- [ENOPKG ] = TARGET_ENOPKG ,
547- [EREMOTE ] = TARGET_EREMOTE ,
548- [ENOLINK ] = TARGET_ENOLINK ,
549- [EADV ] = TARGET_EADV ,
550- [ESRMNT ] = TARGET_ESRMNT ,
551- [ECOMM ] = TARGET_ECOMM ,
552- [EPROTO ] = TARGET_EPROTO ,
553- [EDOTDOT ] = TARGET_EDOTDOT ,
554- [EMULTIHOP ] = TARGET_EMULTIHOP ,
555- [EBADMSG ] = TARGET_EBADMSG ,
556- [ENAMETOOLONG ] = TARGET_ENAMETOOLONG ,
557- [EOVERFLOW ] = TARGET_EOVERFLOW ,
558- [ENOTUNIQ ] = TARGET_ENOTUNIQ ,
559- [EBADFD ] = TARGET_EBADFD ,
560- [EREMCHG ] = TARGET_EREMCHG ,
561- [ELIBACC ] = TARGET_ELIBACC ,
562- [ELIBBAD ] = TARGET_ELIBBAD ,
563- [ELIBSCN ] = TARGET_ELIBSCN ,
564- [ELIBMAX ] = TARGET_ELIBMAX ,
565- [ELIBEXEC ] = TARGET_ELIBEXEC ,
566- [EILSEQ ] = TARGET_EILSEQ ,
567- [ENOSYS ] = TARGET_ENOSYS ,
568- [ELOOP ] = TARGET_ELOOP ,
569- [ERESTART ] = TARGET_ERESTART ,
570- [ESTRPIPE ] = TARGET_ESTRPIPE ,
571- [ENOTEMPTY ] = TARGET_ENOTEMPTY ,
572- [EUSERS ] = TARGET_EUSERS ,
573- [ENOTSOCK ] = TARGET_ENOTSOCK ,
574- [EDESTADDRREQ ] = TARGET_EDESTADDRREQ ,
575- [EMSGSIZE ] = TARGET_EMSGSIZE ,
576- [EPROTOTYPE ] = TARGET_EPROTOTYPE ,
577- [ENOPROTOOPT ] = TARGET_ENOPROTOOPT ,
578- [EPROTONOSUPPORT ] = TARGET_EPROTONOSUPPORT ,
579- [ESOCKTNOSUPPORT ] = TARGET_ESOCKTNOSUPPORT ,
580- [EOPNOTSUPP ] = TARGET_EOPNOTSUPP ,
581- [EPFNOSUPPORT ] = TARGET_EPFNOSUPPORT ,
582- [EAFNOSUPPORT ] = TARGET_EAFNOSUPPORT ,
583- [EADDRINUSE ] = TARGET_EADDRINUSE ,
584- [EADDRNOTAVAIL ] = TARGET_EADDRNOTAVAIL ,
585- [ENETDOWN ] = TARGET_ENETDOWN ,
586- [ENETUNREACH ] = TARGET_ENETUNREACH ,
587- [ENETRESET ] = TARGET_ENETRESET ,
588- [ECONNABORTED ] = TARGET_ECONNABORTED ,
589- [ECONNRESET ] = TARGET_ECONNRESET ,
590- [ENOBUFS ] = TARGET_ENOBUFS ,
591- [EISCONN ] = TARGET_EISCONN ,
592- [ENOTCONN ] = TARGET_ENOTCONN ,
593- [EUCLEAN ] = TARGET_EUCLEAN ,
594- [ENOTNAM ] = TARGET_ENOTNAM ,
595- [ENAVAIL ] = TARGET_ENAVAIL ,
596- [EISNAM ] = TARGET_EISNAM ,
597- [EREMOTEIO ] = TARGET_EREMOTEIO ,
598- [EDQUOT ] = TARGET_EDQUOT ,
599- [ESHUTDOWN ] = TARGET_ESHUTDOWN ,
600- [ETOOMANYREFS ] = TARGET_ETOOMANYREFS ,
601- [ETIMEDOUT ] = TARGET_ETIMEDOUT ,
602- [ECONNREFUSED ] = TARGET_ECONNREFUSED ,
603- [EHOSTDOWN ] = TARGET_EHOSTDOWN ,
604- [EHOSTUNREACH ] = TARGET_EHOSTUNREACH ,
605- [EALREADY ] = TARGET_EALREADY ,
606- [EINPROGRESS ] = TARGET_EINPROGRESS ,
607- [ESTALE ] = TARGET_ESTALE ,
608- [ECANCELED ] = TARGET_ECANCELED ,
609- [ENOMEDIUM ] = TARGET_ENOMEDIUM ,
610- [EMEDIUMTYPE ] = TARGET_EMEDIUMTYPE ,
611- #ifdef ENOKEY
612- [ENOKEY ] = TARGET_ENOKEY ,
613- #endif
614- #ifdef EKEYEXPIRED
615- [EKEYEXPIRED ] = TARGET_EKEYEXPIRED ,
616- #endif
617- #ifdef EKEYREVOKED
618- [EKEYREVOKED ] = TARGET_EKEYREVOKED ,
619- #endif
620- #ifdef EKEYREJECTED
621- [EKEYREJECTED ] = TARGET_EKEYREJECTED ,
622- #endif
623- #ifdef EOWNERDEAD
624- [EOWNERDEAD ] = TARGET_EOWNERDEAD ,
625- #endif
626- #ifdef ENOTRECOVERABLE
627- [ENOTRECOVERABLE ] = TARGET_ENOTRECOVERABLE ,
628- #endif
629- #ifdef ENOMSG
630- [ENOMSG ] = TARGET_ENOMSG ,
631- #endif
632- #ifdef ERFKILL
633- [ERFKILL ] = TARGET_ERFKILL ,
634- #endif
635- #ifdef EHWPOISON
636- [EHWPOISON ] = TARGET_EHWPOISON ,
637- #endif
638- };
639-
640- static inline int host_to_target_errno (int err )
512+ static inline int host_to_target_errno (int host_errno )
641513{
642- if (err >= 0 && err < ERRNO_TABLE_SIZE &&
643- host_to_target_errno_table [err ]) {
644- return host_to_target_errno_table [err ];
514+ switch (host_errno ) {
515+ #define E (X ) case X: return TARGET_##X;
516+ #include "errnos.c.inc"
517+ #undef E
518+ default :
519+ return host_errno ;
645520 }
646- return err ;
647521}
648522
649- static inline int target_to_host_errno (int err )
523+ static inline int target_to_host_errno (int target_errno )
650524{
651- if (err >= 0 && err < ERRNO_TABLE_SIZE &&
652- target_to_host_errno_table [err ]) {
653- return target_to_host_errno_table [err ];
525+ switch (target_errno ) {
526+ #define E (X ) case TARGET_##X: return X;
527+ #include "errnos.c.inc"
528+ #undef E
529+ default :
530+ return target_errno ;
654531 }
655- return err ;
656532}
657533
658534static inline abi_long get_errno (abi_long ret )
@@ -7102,7 +6978,6 @@ void syscall_init(void)
71026978 IOCTLEntry * ie ;
71036979 const argtype * arg_type ;
71046980 int size ;
7105- int i ;
71066981
71076982 thunk_init (STRUCT_MAX );
71086983
@@ -7112,12 +6987,6 @@ void syscall_init(void)
71126987#undef STRUCT
71136988#undef STRUCT_SPECIAL
71146989
7115- /* Build target_to_host_errno_table[] table from
7116- * host_to_target_errno_table[]. */
7117- for (i = 0 ; i < ERRNO_TABLE_SIZE ; i ++ ) {
7118- target_to_host_errno_table [host_to_target_errno_table [i ]] = i ;
7119- }
7120-
71216990 /* we patch the ioctl size if necessary. We rely on the fact that
71226991 no ioctl has all the bits at '1' in the size field */
71236992 ie = ioctl_entries ;
0 commit comments