Patchwork fix alpha errnos and syscalls

login
register
mail settings
Submitter Gabriele Gorla
Date Sept. 10, 2009, 4:33 a.m.
Message ID <1252557182.27795.10.camel@alpha.penguintown.net>
Download mbox | patch
Permalink /patch/33270/
State Superseded
Headers show

Comments

Gabriele Gorla - Sept. 10, 2009, 4:33 a.m.
add the correct errno numbers for alpha in linux-user/alpha/syscall.h

add EAGAIN to the list of translated errnos in linux-user/syscall.c
correct the ifdef to hide missing 32-b and use approrpiate 64-b calls in
linux-user/syscall.c

Signed-off-by: Gabriele Gorla <gorlik@penguintown.net>

---

Patch

diff -ur qemu-0.10.6_orig/linux-user/alpha/syscall.h qemu-0.10.6/linux-user/alpha/syscall.h
--- qemu-0.10.6_orig/linux-user/alpha/syscall.h	2009-07-16 17:56:23.000000000 -0700
+++ qemu-0.10.6/linux-user/alpha/syscall.h	2009-09-09 14:56:04.000000000 -0700
@@ -38,4 +38,216 @@ 
         abi_ulong unique;
 };
 
+
+/* from kernel include/asm-alpha/errno.h */
+
+#undef TARGET_EDEADLK
+#define	TARGET_EDEADLK		11	/* Resource deadlock would occur */
+
+#undef TARGET_EAGAIN
+#define	TARGET_EAGAIN		35	/* Try again */
+#undef TARGET_EINPROGRESS
+#define	TARGET_EINPROGRESS	36	/* Operation now in progress */
+#undef TARGET_EALREADY
+#define	TARGET_EALREADY	    37	/* Operation already in progress */
+#undef TARGET_ENOTSOCK
+#define	TARGET_ENOTSOCK	    38	/* Socket operation on non-socket */
+#undef TARGET_EDESTADDRREQ
+#define	TARGET_EDESTADDRREQ	39	/* Destination address required */
+#undef TARGET_EMSGSIZE
+#define	TARGET_EMSGSIZE	    40	/* Message too long */
+#undef TARGET_EPROTOTYPE
+#define	TARGET_EPROTOTYPE	41	/* Protocol wrong type for socket */
+#undef TARGET_ENOPROTOOPT
+#define	TARGET_ENOPROTOOPT	42	/* Protocol not available */
+#undef TARGET_EPROTONOSUPPORT
+#define	TARGET_EPROTONOSUPPORT	43	/* Protocol not supported */
+#undef TARGET_ESOCKTNOSUPPORT
+#define	TARGET_ESOCKTNOSUPPORT	44	/* Socket type not supported */
+#undef TARGET_EOPNOTSUPP
+#define	TARGET_EOPNOTSUPP	45	/* Operation not supported on transport endpoint */
+#undef TARGET_EPFNOSUPPORT
+#define	TARGET_EPFNOSUPPORT	46	/* Protocol family not supported */
+#undef TARGET_EAFNOSUPPORT
+#define	TARGET_EAFNOSUPPORT	47	/* Address family not supported by protocol */
+#undef TARGET_EADDRINUSE
+#define	TARGET_EADDRINUSE	48	/* Address already in use */
+#undef TARGET_EADDRNOTAVAIL
+#define	TARGET_EADDRNOTAVAIL	49	/* Cannot assign requested address */
+#undef TARGET_ENETDOWN
+#define	TARGET_ENETDOWN	    50	/* Network is down */
+#undef TARGET_ENETUNREACH
+#define	TARGET_ENETUNREACH	51	/* Network is unreachable */
+#undef TARGET_ENETRESET
+#define	TARGET_ENETRESET	52	/* Network dropped connection because of reset */
+#undef TARGET_ECONNABORTED
+#define	TARGET_ECONNABORTED	53	/* Software caused connection abort */
+#undef TARGET_ECONNRESET
+#define	TARGET_ECONNRESET	54	/* Connection reset by peer */
+#undef TARGET_ENOBUFS
+#define	TARGET_ENOBUFS		55	/* No buffer space available */
+#undef TARGET_EISCONN
+#define	TARGET_EISCONN		56	/* Transport endpoint is already connected */
+#undef TARGET_ENOTCONN
+#define	TARGET_ENOTCONN	  	57	/* Transport endpoint is not connected */
+#undef TARGET_ESHUTDOWN
+#define	TARGET_ESHUTDOWN	58	/* Cannot send after transport endpoint shutdown */
+#undef TARGET_ETOOMANYREFS
+#define	TARGET_ETOOMANYREFS	59	/* Too many references: cannot splice */
+#undef TARGET_ETIMEDOUT
+#define	TARGET_ETIMEDOUT	60	/* Connection timed out */
+#undef TARGET_ECONNREFUSED
+#define	TARGET_ECONNREFUSED	61	/* Connection refused */
+#undef TARGET_ELOOP
+#define	TARGET_ELOOP		62	/* Too many symbolic links encountered */
+#undef TARGET_ENAMETOOLONG
+#define	TARGET_ENAMETOOLONG	63	/* File name too long */
+#undef TARGET_EHOSTDOWN
+#define	TARGET_EHOSTDOWN	64	/* Host is down */
+#undef TARGET_EHOSTUNREACH
+#define	TARGET_EHOSTUNREACH	65	/* No route to host */
+#undef TARGET_ENOTEMPTY
+#define	TARGET_ENOTEMPTY	66	/* Directory not empty */
+
+#undef TARGET_EUSERS
+#define	TARGET_EUSERS		68	/* Too many users */
+#undef TARGET_EDQUOT
+#define	TARGET_EDQUOT		69	/* Quota exceeded */
+#undef TARGET_ESTALE
+#define	TARGET_ESTALE		70	/* Stale NFS file handle */
+#undef TARGET_EREMOTE
+#define	TARGET_EREMOTE		71	/* Object is remote */
+
+#undef TARGET_ENOLCK
+#define	TARGET_ENOLCK		77	/* No record locks available */
+#undef TARGET_ENOSYS
+#define	TARGET_ENOSYS		78	/* Function not implemented */
+
+#undef TARGET_ENOMSG
+#define	TARGET_ENOMSG		80	/* No message of desired type */
+#undef TARGET_EIDRM
+#define	TARGET_EIDRM		81	/* Identifier removed */
+#undef TARGET_ENOSR
+#define	TARGET_ENOSR		82	/* Out of streams resources */
+#undef TARGET_ETIME
+#define	TARGET_ETIME		83	/* Timer expired */
+#undef TARGET_EBADMSG
+#define	TARGET_EBADMSG		84	/* Not a data message */
+#undef TARGET_EPROTO
+#define	TARGET_EPROTO		85	/* Protocol error */
+#undef TARGET_ENODATA
+#define	TARGET_ENODATA		86	/* No data available */
+#undef TARGET_ENOSTR
+#define	TARGET_ENOSTR		87	/* Device not a stream */
+
+#undef TARGET_ENOPKG
+#define	TARGET_ENOPKG		92	/* Package not installed */
+
+#undef TARGET_EILSEQ
+#define	TARGET_EILSEQ		116	/* Illegal byte sequence */
+
+/* The following are just random noise.. */
+#undef TARGET_ECHRNG
+#define	TARGET_ECHRNG		88	/* Channel number out of range */
+#undef TARGET_EL2NSYNC
+#define	TARGET_EL2NSYNC	    89	/* Level 2 not synchronized */
+#undef TARGET_EL3HLT
+#define	TARGET_EL3HLT		90	/* Level 3 halted */
+#undef TARGET_EL3RST
+#define	TARGET_EL3RST		91	/* Level 3 reset */
+
+#undef TARGET_ELNRNG
+#define	TARGET_ELNRNG		93	/* Link number out of range */
+#undef TARGET_EUNATCH
+#define	TARGET_EUNATCH		94	/* Protocol driver not attached */
+#undef TARGET_ENOCSI
+#define	TARGET_ENOCSI		95	/* No CSI structure available */
+#undef TARGET_EL2HLT
+#define	TARGET_EL2HLT		96	/* Level 2 halted */
+#undef TARGET_EBADE
+#define	TARGET_EBADE		97	/* Invalid exchange */
+#undef TARGET_EBADR
+#define	TARGET_EBADR		98	/* Invalid request descriptor */
+#undef TARGET_EXFULL
+#define	TARGET_EXFULL		99	/* Exchange full */
+#undef TARGET_ENOANO
+#define	TARGET_ENOANO		100	/* No anode */
+#undef TARGET_EBADRQC
+#define	TARGET_EBADRQC		101	/* Invalid request code */
+#undef TARGET_EBADSLT
+#define	TARGET_EBADSLT		102	/* Invalid slot */
+
+#undef TARGET_EBFONT
+#define	TARGET_EBFONT		104	/* Bad font file format */
+#undef TARGET_ENONET
+#define	TARGET_ENONET		105	/* Machine is not on the network */
+#undef TARGET_ENOLINK
+#define	TARGET_ENOLINK		106	/* Link has been severed */
+#undef TARGET_EADV
+#define	TARGET_EADV			107	/* Advertise error */
+#undef TARGET_ESRMNT
+#define	TARGET_ESRMNT		108	/* Srmount error */
+#undef TARGET_ECOMM
+#define	TARGET_ECOMM		109	/* Communication error on send */
+#undef TARGET_EMULTIHOP
+#define	TARGET_EMULTIHOP	110	/* Multihop attempted */
+#undef TARGET_EDOTDOT
+#define	TARGET_EDOTDOT		111	/* RFS specific error */
+#undef TARGET_EOVERFLOW
+#define	TARGET_EOVERFLOW	112	/* Value too large for defined data type */
+#undef TARGET_ENOTUNIQ
+#define	TARGET_ENOTUNIQ		113	/* Name not unique on network */
+#undef TARGET_EBADFD
+#define	TARGET_EBADFD		114	/* File descriptor in bad state */
+#undef TARGET_EREMCHG
+#define	TARGET_EREMCHG		115	/* Remote address changed */
+
+#undef TARGET_EUCLEAN
+#define	TARGET_EUCLEAN		117	/* Structure needs cleaning */
+#undef TARGET_ENOTNAM
+#define	TARGET_ENOTNAM		118	/* Not a XENIX named type file */
+#undef TARGET_ENAVAIL
+#define	TARGET_ENAVAIL		119	/* No XENIX semaphores available */
+#undef TARGET_EISNAM
+#define	TARGET_EISNAM		120	/* Is a named type file */
+#undef TARGET_EREMOTEIO
+#define	TARGET_EREMOTEIO	121	/* Remote I/O error */
+
+#undef TARGET_ELIBACC
+#define	TARGET_ELIBACC		122	/* Can not access a needed shared library */
+#undef TARGET_ELIBBAD
+#define	TARGET_ELIBBAD		123	/* Accessing a corrupted shared library */
+#undef TARGET_ELIBSCN
+#define	TARGET_ELIBSCN		124	/* .lib section in a.out corrupted */
+#undef TARGET_ELIBMAX
+#define	TARGET_ELIBMAX		125	/* Attempting to link in too many shared libraries */
+#undef TARGET_ELIBEXEC
+#define	TARGET_ELIBEXEC	    126	/* Cannot exec a shared library directly */
+#undef TARGET_ERESTART
+#define	TARGET_ERESTART	    127	/* Interrupted system call should be restarted */
+#undef TARGET_ESTRPIPE
+#define	TARGET_ESTRPIPE	    128	/* Streams pipe error */
+
+#undef TARGET_ENOMEDIUM
+#define TARGET_ENOMEDIUM	129	/* No medium found */
+#undef TARGET_EMEDIUMTYPE
+#define TARGET_EMEDIUMTYPE	130	/* Wrong medium type */
+#undef TARGET_ECANCELED
+#define	TARGET_ECANCELED	131	/* Operation Cancelled */
+#undef TARGET_ENOKEY
+#define	TARGET_ENOKEY		132	/* Required key not available */
+#undef TARGET_EKEYEXPIRED
+#define	TARGET_EKEYEXPIRED	133	/* Key has expired */
+#undef TARGET_EKEYREVOKED
+#define	TARGET_EKEYREVOKED	134	/* Key has been revoked */
+#undef TARGET_EKEYREJECTED
+#define	TARGET_EKEYREJECTED	135	/* Key was rejected by service */
+
+/* for robust mutexes */
+#undef TARGET_EOWNERDEAD
+#define	TARGET_EOWNERDEAD	136	/* Owner died */
+#undef TARGET_ENOTRECOVERABLE
+#define	TARGET_ENOTRECOVERABLE	137	/* State not recoverable */
+
+
 #define UNAME_MACHINE "alpha"
diff -ur qemu-0.10.6_orig/linux-user/syscall.c qemu-0.10.6/linux-user/syscall.c
--- qemu-0.10.6_orig/linux-user/syscall.c	2009-07-16 17:56:24.000000000 -0700
+++ qemu-0.10.6/linux-user/syscall.c	2009-09-09 16:13:23.000000000 -0700
@@ -227,7 +227,7 @@ 
 _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
 #endif
 _syscall2(int, sys_getpriority, int, which, int, who);
-#if !defined (__x86_64__)
+#if !defined (__x86_64__) && !defined (__alpha__)
 _syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
           loff_t *, res, uint, wh);
 #endif
@@ -399,6 +399,7 @@ 
     [ECANCELED]		= TARGET_ECANCELED,
     [ENOMEDIUM]		= TARGET_ENOMEDIUM,
     [EMEDIUMTYPE]	= TARGET_EMEDIUMTYPE,
+    [EAGAIN]        = TARGET_EAGAIN,
 #ifdef ENOKEY
     [ENOKEY]		= TARGET_ENOKEY,
 #endif
@@ -5001,7 +5002,7 @@ 
 #ifdef TARGET_NR__llseek /* Not on alpha */
     case TARGET_NR__llseek:
         {
-#if defined (__x86_64__)
+#if defined (__x86_64__) || defined (__alpha__)
             ret = get_errno(lseek(arg1, ((uint64_t )arg2 << 32) | arg3, arg5));
             if (put_user_s64(ret, arg4))
                 goto efault;