kvm: Conditionally apply workaround for KVM slot handling bug
[qemu] / linux-user / syscall_defs.h
index 99b17cb..7f0b0df 100644 (file)
@@ -49,7 +49,7 @@
 #define TARGET_IOC_TYPEBITS    8
 
 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
-    || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS)
+    || defined(TARGET_M68K) || defined(TARGET_CRIS)
 
 #define TARGET_IOC_SIZEBITS    14
 #define TARGET_IOC_DIRBITS     2
@@ -164,9 +164,6 @@ struct target_cmsghdr {
 
 #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
 #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
-#define TARGET_CMSG_FIRSTHDR(mhdr) \
-  ((size_t) tswapl((mhdr)->msg_controllen) >= sizeof (struct target_cmsghdr) \
-   ? (struct target_cmsghdr *) tswapl((mhdr)->msg_control) : (struct target_cmsghdr *) NULL)
 #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
                                & (size_t) ~(sizeof (abi_long) - 1))
 #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
@@ -507,9 +504,15 @@ typedef struct {
 #define TARGET_SI_PAD_SIZE     ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
 
 typedef struct target_siginfo {
+#ifdef TARGET_MIPS
+       int si_signo;
+       int si_code;
+       int si_errno;
+#else
        int si_signo;
        int si_errno;
        int si_code;
+#endif
 
        union {
                int _pad[TARGET_SI_PAD_SIZE];
@@ -833,6 +836,14 @@ struct target_pollfd {
 #define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
 #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
 
+/* loop ioctls */
+#define TARGET_LOOP_SET_FD            0x4C00
+#define TARGET_LOOP_CLR_FD            0x4C01
+#define TARGET_LOOP_SET_STATUS        0x4C02
+#define TARGET_LOOP_GET_STATUS        0x4C03
+#define TARGET_LOOP_SET_STATUS64      0x4C04
+#define TARGET_LOOP_GET_STATUS64      0x4C05
+#define TARGET_LOOP_CHANGE_FD         0x4C06
 
 /* from asm/termbits.h */
 
@@ -855,11 +866,14 @@ struct target_winsize {
 
 #include "termbits.h"
 
+/* Common */
 #define TARGET_MAP_SHARED      0x01            /* Share changes */
 #define TARGET_MAP_PRIVATE     0x02            /* Changes are private */
-#define TARGET_MAP_TYPE        0x0f            /* Mask for type of mapping */
-#define TARGET_MAP_FIXED       0x10            /* Interpret addr exactly */
+#define TARGET_MAP_TYPE                0x0f            /* Mask for type of mapping */
+
+/* Target specific */
 #if defined(TARGET_MIPS)
+#define TARGET_MAP_FIXED       0x10            /* Interpret addr exactly */
 #define TARGET_MAP_ANONYMOUS   0x0800          /* don't use a file */
 #define TARGET_MAP_GROWSDOWN   0x1000          /* stack-like segment */
 #define TARGET_MAP_DENYWRITE   0x2000          /* ETXTBSY */
@@ -868,23 +882,39 @@ struct target_winsize {
 #define TARGET_MAP_NORESERVE   0x0400          /* don't check for reservations */
 #define TARGET_MAP_POPULATE    0x10000         /* populate (prefault) pagetables */
 #define TARGET_MAP_NONBLOCK    0x20000         /* do not block on IO */
-#else
+#elif defined(TARGET_PPC)
+#define TARGET_MAP_FIXED       0x10            /* Interpret addr exactly */
 #define TARGET_MAP_ANONYMOUS   0x20            /* don't use a file */
 #define TARGET_MAP_GROWSDOWN   0x0100          /* stack-like segment */
 #define TARGET_MAP_DENYWRITE   0x0800          /* ETXTBSY */
 #define TARGET_MAP_EXECUTABLE  0x1000          /* mark it as an executable */
-#if defined(TARGET_PPC)
 #define TARGET_MAP_LOCKED      0x0080          /* pages are locked */
 #define TARGET_MAP_NORESERVE   0x0040          /* don't check for reservations */
+#define TARGET_MAP_POPULATE    0x8000          /* populate (prefault) pagetables */
+#define TARGET_MAP_NONBLOCK    0x10000         /* do not block on IO */
+#elif defined(TARGET_ALPHA)
+#define TARGET_MAP_ANONYMOUS   0x10            /* don't use a file */
+#define TARGET_MAP_FIXED       0x100           /* Interpret addr exactly */
+#define TARGET_MAP_GROWSDOWN   0x01000         /* stack-like segment */
+#define TARGET_MAP_DENYWRITE   0x02000         /* ETXTBSY */
+#define TARGET_MAP_EXECUTABLE  0x04000         /* mark it as an executable */
+#define TARGET_MAP_LOCKED      0x08000         /* lock the mapping */
+#define TARGET_MAP_NORESERVE   0x10000         /* no check for reservations */
+#define TARGET_MAP_POPULATE    0x20000         /* pop (prefault) pagetables */
+#define TARGET_MAP_NONBLOCK    0x40000         /* do not block on IO */
 #else
+#define TARGET_MAP_FIXED       0x10            /* Interpret addr exactly */
+#define TARGET_MAP_ANONYMOUS   0x20            /* don't use a file */
+#define TARGET_MAP_GROWSDOWN   0x0100          /* stack-like segment */
+#define TARGET_MAP_DENYWRITE   0x0800          /* ETXTBSY */
+#define TARGET_MAP_EXECUTABLE  0x1000          /* mark it as an executable */
 #define TARGET_MAP_LOCKED      0x2000          /* pages are locked */
 #define TARGET_MAP_NORESERVE   0x4000          /* don't check for reservations */
-#endif
 #define TARGET_MAP_POPULATE    0x8000          /* populate (prefault) pagetables */
 #define TARGET_MAP_NONBLOCK    0x10000         /* do not block on IO */
 #endif
 
-#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_CRIS)
+#if (defined(TARGET_I386) && defined(TARGET_ABI32)) || defined(TARGET_ARM) || defined(TARGET_CRIS)
 struct target_stat {
        unsigned short st_dev;
        unsigned short __pad1;
@@ -1089,27 +1119,35 @@ struct target_stat64 {
 #elif defined(TARGET_PPC)
 
 struct target_stat {
-       unsigned short st_dev;
+       abi_ulong st_dev;
        abi_ulong st_ino;
+#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
+       abi_ulong st_nlink;
+       unsigned int st_mode;
+#else
        unsigned int st_mode;
        unsigned short st_nlink;
+#endif
        unsigned int st_uid;
        unsigned int st_gid;
-       unsigned short st_rdev;
+       abi_ulong  st_rdev;
        abi_ulong  st_size;
        abi_ulong  st_blksize;
        abi_ulong  st_blocks;
        abi_ulong  target_st_atime;
-       abi_ulong  __unused1;
+       abi_ulong  target_st_atime_nsec;
        abi_ulong  target_st_mtime;
-       abi_ulong  __unused2;
+       abi_ulong  target_st_mtime_nsec;
        abi_ulong  target_st_ctime;
-       abi_ulong  __unused3;
+       abi_ulong  target_st_ctime_nsec;
        abi_ulong  __unused4;
        abi_ulong  __unused5;
+#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
+       abi_ulong  __unused6;
+#endif
 };
 
-struct target_stat64 {
+struct __attribute__((__packed__)) target_stat64 {
        unsigned long long st_dev;
         unsigned long long st_ino;
        unsigned int st_mode;
@@ -1117,19 +1155,19 @@ struct target_stat64 {
        unsigned int st_uid;
        unsigned int st_gid;
        unsigned long long st_rdev;
-       long long pad0;
-       long long st_size;
-       abi_ulong       st_blksize;
-       abi_ulong       pad1;
-       long long       st_blocks;      /* Number 512-byte blocks allocated. */
-       abi_ulong       target_st_atime;
-        abi_ulong    target_st_atime_nsec;
-       abi_ulong       target_st_mtime;
-        abi_ulong    target_st_mtime_nsec;
-       abi_ulong       target_st_ctime;
-        abi_ulong    target_st_ctime_nsec;
-        abi_ulong    __unused4;
-        abi_ulong    __unused5;
+       unsigned long long __pad0;
+       long long      st_size;
+       int            st_blksize;
+       long long      st_blocks;       /* Number 512-byte blocks allocated. */
+       unsigned int   __pad1;
+       int            target_st_atime;
+        unsigned int   target_st_atime_nsec;
+       int            target_st_mtime;
+        unsigned int   target_st_mtime_nsec;
+       int            target_st_ctime;
+        unsigned int   target_st_ctime_nsec;
+        unsigned int   __unused4;
+        unsigned int   __unused5;
 };
 
 #elif defined(TARGET_M68K)
@@ -1444,7 +1482,7 @@ struct target_stat {
 /* This matches struct stat64 in glibc2.1, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
-struct target_stat64 {
+struct __attribute__((__packed__)) target_stat64 {
        unsigned long long      st_dev;
        unsigned char   __pad0[4];
 
@@ -1477,6 +1515,30 @@ struct target_stat64 {
        unsigned long long      st_ino;
 };
 
+#elif defined(TARGET_I386) && !defined(TARGET_ABI32)
+struct target_stat {
+       abi_ulong       st_dev;
+       abi_ulong       st_ino;
+       abi_ulong       st_nlink;
+
+       unsigned int    st_mode;
+       unsigned int    st_uid;
+       unsigned int    st_gid;
+       unsigned int    __pad0;
+       abi_ulong       st_rdev;
+       abi_long        st_size;
+       abi_long        st_blksize;
+       abi_long        st_blocks;      /* Number 512-byte blocks allocated. */
+
+       abi_ulong       target_st_atime;
+       abi_ulong       target_st_atime_nsec; 
+       abi_ulong       target_st_mtime;
+       abi_ulong       target_st_mtime_nsec;
+       abi_ulong       target_st_ctime;
+       abi_ulong       target_st_ctime_nsec;
+
+       abi_long        __unused[3];
+};
 #else
 #error unsupported CPU
 #endif
@@ -1534,6 +1596,35 @@ struct target_statfs64 {
        uint32_t        f_namelen;
        uint32_t        f_spare[6];
 };
+#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
+       defined(TARGET_SPARC64)) && !defined(TARGET_ABI32)
+struct target_statfs {
+       abi_long f_type;
+       abi_long f_bsize;
+       abi_long f_blocks;
+       abi_long f_bfree;
+       abi_long f_bavail;
+       abi_long f_files;
+       abi_long f_ffree;
+       target_fsid_t f_fsid;
+       abi_long f_namelen;
+       abi_long f_frsize;
+       abi_long f_spare[5];
+};
+
+struct target_statfs64 {
+       abi_long f_type;
+       abi_long f_bsize;
+       abi_long f_blocks;
+       abi_long f_bfree;
+       abi_long f_bavail;
+       abi_long f_files;
+       abi_long f_ffree;
+       target_fsid_t f_fsid;
+       abi_long f_namelen;
+       abi_long f_frsize;
+       abi_long f_spare[5];
+};
 #else
 struct target_statfs {
        uint32_t f_type;
@@ -1665,6 +1756,25 @@ struct target_statfs64 {
 #define TARGET_O_NOFOLLOW      0x20000 /* don't follow links */
 #define TARGET_O_NOATIME       0x40000
 #define TARGET_O_NDELAY        TARGET_O_NONBLOCK
+#elif defined(TARGET_ALPHA)
+#define TARGET_O_ACCMODE       0x0003
+#define TARGET_O_RDONLY        0x0000
+#define TARGET_O_WRONLY        0x0001
+#define TARGET_O_RDWR          0x0002
+#define TARGET_O_APPEND        0x0008
+#define TARGET_O_SYNC          0x4000
+#define TARGET_O_NONBLOCK      0x0004
+#define TARGET_O_CREAT         0x0200  /* not fcntl */
+#define TARGET_O_TRUNC         0x0400  /* not fcntl */
+#define TARGET_O_EXCL          0x0800  /* not fcntl */
+#define TARGET_O_NOCTTY        0x1000  /* not fcntl */
+#define TARGET_FASYNC          0x2000  /* fcntl, for BSD compatibility */
+#define TARGET_O_LARGEFILE     0x0000  /* not necessary, always 64-bit */
+#define TARGET_O_DIRECT        0x80000 /* direct disk access hint */
+#define TARGET_O_DIRECTORY     0x8000  /* must be a directory */
+#define TARGET_O_NOFOLLOW      0x10000 /* don't follow links */
+#define TARGET_O_NOATIME       0x100000
+#define TARGET_O_NDELAY        TARGET_O_NONBLOCK
 #else
 #define TARGET_O_ACCMODE          0003
 #define TARGET_O_RDONLY             00
@@ -1696,6 +1806,9 @@ struct target_flock {
 struct target_flock64 {
        short  l_type;
        short  l_whence;
+#if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA)
+        int __pad;
+#endif
        unsigned long long l_start;
        unsigned long long l_len;
        int  l_pid;
@@ -1855,6 +1968,10 @@ struct target_eabi_flock64 {
 #define TARGET_VFAT_IOCTL_READDIR_BOTH    TARGET_IORU('r', 1)
 #define TARGET_VFAT_IOCTL_READDIR_SHORT   TARGET_IORU('r', 2)
 
+#define TARGET_MTIOCTOP        TARGET_IOW('m', 1, struct mtop)
+#define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct mtget)
+#define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct mtpos)
+
 struct target_sysinfo {
     abi_long uptime;                /* Seconds since boot */
     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
@@ -1872,6 +1989,28 @@ struct target_sysinfo {
     char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
 };
 
+struct linux_dirent {
+    long            d_ino;
+    unsigned long   d_off;
+    unsigned short  d_reclen;
+    char            d_name[256]; /* We must not include limits.h! */
+};
+
+struct linux_dirent64 {
+    uint64_t        d_ino;
+    int64_t         d_off;
+    unsigned short  d_reclen;
+    unsigned char   d_type;
+    char            d_name[256];
+};
+
+struct target_mq_attr {
+    abi_long mq_flags;
+    abi_long mq_maxmsg;
+    abi_long mq_msgsize;
+    abi_long mq_curmsgs;
+};
+
 #include "socket.h"
 
 #include "errno_defs.h"