termios support for SPARC and PPC
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 4 Jan 2004 15:52:31 +0000 (15:52 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 4 Jan 2004 15:52:31 +0000 (15:52 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@496 c046a42c-6fe2-441c-8c8c-71466251a162

linux-user/arm/termbits.h [new file with mode: 0644]
linux-user/i386/termbits.h [new file with mode: 0644]
linux-user/ppc/termbits.h [new file with mode: 0644]
linux-user/sparc/termbits.h [new file with mode: 0644]
linux-user/syscall_defs.h

diff --git a/linux-user/arm/termbits.h b/linux-user/arm/termbits.h
new file mode 100644 (file)
index 0000000..36ead08
--- /dev/null
@@ -0,0 +1,215 @@
+/* from asm/termbits.h */
+/* NOTE: exactly the same as i386 */
+
+#define TARGET_NCCS 19
+
+struct target_termios {
+    unsigned int c_iflag;               /* input mode flags */
+    unsigned int c_oflag;               /* output mode flags */
+    unsigned int c_cflag;               /* control mode flags */
+    unsigned int c_lflag;               /* local mode flags */
+    unsigned char c_line;                    /* line discipline */
+    unsigned char c_cc[TARGET_NCCS];                /* control characters */
+};
+
+/* c_iflag bits */
+#define TARGET_IGNBRK  0000001
+#define TARGET_BRKINT  0000002
+#define TARGET_IGNPAR  0000004
+#define TARGET_PARMRK  0000010
+#define TARGET_INPCK   0000020
+#define TARGET_ISTRIP  0000040
+#define TARGET_INLCR   0000100
+#define TARGET_IGNCR   0000200
+#define TARGET_ICRNL   0000400
+#define TARGET_IUCLC   0001000
+#define TARGET_IXON    0002000
+#define TARGET_IXANY   0004000
+#define TARGET_IXOFF   0010000
+#define TARGET_IMAXBEL 0020000
+
+/* c_oflag bits */
+#define TARGET_OPOST   0000001
+#define TARGET_OLCUC   0000002
+#define TARGET_ONLCR   0000004
+#define TARGET_OCRNL   0000010
+#define TARGET_ONOCR   0000020
+#define TARGET_ONLRET  0000040
+#define TARGET_OFILL   0000100
+#define TARGET_OFDEL   0000200
+#define TARGET_NLDLY   0000400
+#define   TARGET_NL0   0000000
+#define   TARGET_NL1   0000400
+#define TARGET_CRDLY   0003000
+#define   TARGET_CR0   0000000
+#define   TARGET_CR1   0001000
+#define   TARGET_CR2   0002000
+#define   TARGET_CR3   0003000
+#define TARGET_TABDLY  0014000
+#define   TARGET_TAB0  0000000
+#define   TARGET_TAB1  0004000
+#define   TARGET_TAB2  0010000
+#define   TARGET_TAB3  0014000
+#define   TARGET_XTABS 0014000
+#define TARGET_BSDLY   0020000
+#define   TARGET_BS0   0000000
+#define   TARGET_BS1   0020000
+#define TARGET_VTDLY   0040000
+#define   TARGET_VT0   0000000
+#define   TARGET_VT1   0040000
+#define TARGET_FFDLY   0100000
+#define   TARGET_FF0   0000000
+#define   TARGET_FF1   0100000
+
+/* c_cflag bit meaning */
+#define TARGET_CBAUD   0010017
+#define  TARGET_B0     0000000         /* hang up */
+#define  TARGET_B50    0000001
+#define  TARGET_B75    0000002
+#define  TARGET_B110   0000003
+#define  TARGET_B134   0000004
+#define  TARGET_B150   0000005
+#define  TARGET_B200   0000006
+#define  TARGET_B300   0000007
+#define  TARGET_B600   0000010
+#define  TARGET_B1200  0000011
+#define  TARGET_B1800  0000012
+#define  TARGET_B2400  0000013
+#define  TARGET_B4800  0000014
+#define  TARGET_B9600  0000015
+#define  TARGET_B19200 0000016
+#define  TARGET_B38400 0000017
+#define TARGET_EXTA B19200
+#define TARGET_EXTB B38400
+#define TARGET_CSIZE   0000060
+#define   TARGET_CS5   0000000
+#define   TARGET_CS6   0000020
+#define   TARGET_CS7   0000040
+#define   TARGET_CS8   0000060
+#define TARGET_CSTOPB  0000100
+#define TARGET_CREAD   0000200
+#define TARGET_PARENB  0000400
+#define TARGET_PARODD  0001000
+#define TARGET_HUPCL   0002000
+#define TARGET_CLOCAL  0004000
+#define TARGET_CBAUDEX 0010000
+#define  TARGET_B57600  0010001
+#define  TARGET_B115200 0010002
+#define  TARGET_B230400 0010003
+#define  TARGET_B460800 0010004
+#define TARGET_CIBAUD    002003600000  /* input baud rate (not used) */
+#define TARGET_CRTSCTS   020000000000          /* flow control */
+
+/* c_lflag bits */
+#define TARGET_ISIG    0000001
+#define TARGET_ICANON  0000002
+#define TARGET_XCASE   0000004
+#define TARGET_ECHO    0000010
+#define TARGET_ECHOE   0000020
+#define TARGET_ECHOK   0000040
+#define TARGET_ECHONL  0000100
+#define TARGET_NOFLSH  0000200
+#define TARGET_TOSTOP  0000400
+#define TARGET_ECHOCTL 0001000
+#define TARGET_ECHOPRT 0002000
+#define TARGET_ECHOKE  0004000
+#define TARGET_FLUSHO  0010000
+#define TARGET_PENDIN  0040000
+#define TARGET_IEXTEN  0100000
+
+/* c_cc character offsets */
+#define TARGET_VINTR   0
+#define TARGET_VQUIT   1
+#define TARGET_VERASE  2
+#define TARGET_VKILL   3
+#define TARGET_VEOF    4
+#define TARGET_VTIME   5
+#define TARGET_VMIN    6
+#define TARGET_VSWTC   7
+#define TARGET_VSTART  8
+#define TARGET_VSTOP   9
+#define TARGET_VSUSP   10
+#define TARGET_VEOL    11
+#define TARGET_VREPRINT        12
+#define TARGET_VDISCARD        13
+#define TARGET_VWERASE 14
+#define TARGET_VLNEXT  15
+#define TARGET_VEOL2   16
+
+/* ioctls */
+
+#define TARGET_TCGETS          0x5401
+#define TARGET_TCSETS          0x5402
+#define TARGET_TCSETSW         0x5403
+#define TARGET_TCSETSF         0x5404
+#define TARGET_TCGETA          0x5405
+#define TARGET_TCSETA          0x5406
+#define TARGET_TCSETAW         0x5407
+#define TARGET_TCSETAF         0x5408
+#define TARGET_TCSBRK          0x5409
+#define TARGET_TCXONC          0x540A
+#define TARGET_TCFLSH          0x540B
+
+#define TARGET_TIOCEXCL        0x540C
+#define TARGET_TIOCNXCL        0x540D
+#define TARGET_TIOCSCTTY       0x540E
+#define TARGET_TIOCGPGRP       0x540F
+#define TARGET_TIOCSPGRP       0x5410
+#define TARGET_TIOCOUTQ        0x5411
+#define TARGET_TIOCSTI         0x5412
+#define TARGET_TIOCGWINSZ      0x5413
+#define TARGET_TIOCSWINSZ      0x5414
+#define TARGET_TIOCMGET        0x5415
+#define TARGET_TIOCMBIS        0x5416
+#define TARGET_TIOCMBIC        0x5417
+#define TARGET_TIOCMSET        0x5418
+#define TARGET_TIOCGSOFTCAR    0x5419
+#define TARGET_TIOCSSOFTCAR    0x541A
+#define TARGET_FIONREAD        0x541B
+#define TARGET_TIOCINQ         TARGET_FIONREAD
+#define TARGET_TIOCLINUX       0x541C
+#define TARGET_TIOCCONS        0x541D
+#define TARGET_TIOCGSERIAL     0x541E
+#define TARGET_TIOCSSERIAL     0x541F
+#define TARGET_TIOCPKT         0x5420
+#define TARGET_FIONBIO         0x5421
+#define TARGET_TIOCNOTTY       0x5422
+#define TARGET_TIOCSETD        0x5423
+#define TARGET_TIOCGETD        0x5424
+#define TARGET_TCSBRKP         0x5425  /* Needed for POSIX tcsendbreak() */
+#define TARGET_TIOCTTYGSTRUCT  0x5426  /* For debugging only */
+#define TARGET_TIOCSBRK        0x5427  /* BSD compatibility */
+#define TARGET_TIOCCBRK        0x5428  /* BSD compatibility */
+#define TARGET_TIOCGSID        0x5429  /* Return the session ID of FD */
+#define TARGET_TIOCGPTN        TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TARGET_TIOCSPTLCK      TARGET_IOW('T',0x31, int)  /* Lock/unlock Pty */
+
+#define TARGET_FIONCLEX        0x5450  /* these numbers need to be adjusted. */
+#define TARGET_FIOCLEX         0x5451
+#define TARGET_FIOASYNC        0x5452
+#define TARGET_TIOCSERCONFIG   0x5453
+#define TARGET_TIOCSERGWILD    0x5454
+#define TARGET_TIOCSERSWILD    0x5455
+#define TARGET_TIOCGLCKTRMIOS  0x5456
+#define TARGET_TIOCSLCKTRMIOS  0x5457
+#define TARGET_TIOCSERGSTRUCT  0x5458 /* For debugging only */
+#define TARGET_TIOCSERGETLSR   0x5459 /* Get line status register */
+#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TARGET_TIOCMIWAIT      0x545C  /* wait for a change on serial input line(s) */
+#define TARGET_TIOCGICOUNT     0x545D  /* read serial port inline interrupt counts */
+#define TARGET_TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
+#define TARGET_TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
+
+/* Used for packet mode */
+#define TARGET_TIOCPKT_DATA             0
+#define TARGET_TIOCPKT_FLUSHREAD        1
+#define TARGET_TIOCPKT_FLUSHWRITE       2
+#define TARGET_TIOCPKT_STOP             4
+#define TARGET_TIOCPKT_START            8
+#define TARGET_TIOCPKT_NOSTOP          16
+#define TARGET_TIOCPKT_DOSTOP          32
+
+#define TARGET_TIOCSER_TEMT    0x01    /* Transmitter physically empty */
+
diff --git a/linux-user/i386/termbits.h b/linux-user/i386/termbits.h
new file mode 100644 (file)
index 0000000..adff802
--- /dev/null
@@ -0,0 +1,214 @@
+/* from asm/termbits.h */
+
+#define TARGET_NCCS 19
+
+struct target_termios {
+    unsigned int c_iflag;               /* input mode flags */
+    unsigned int c_oflag;               /* output mode flags */
+    unsigned int c_cflag;               /* control mode flags */
+    unsigned int c_lflag;               /* local mode flags */
+    unsigned char c_line;                    /* line discipline */
+    unsigned char c_cc[TARGET_NCCS];                /* control characters */
+};
+
+/* c_iflag bits */
+#define TARGET_IGNBRK  0000001
+#define TARGET_BRKINT  0000002
+#define TARGET_IGNPAR  0000004
+#define TARGET_PARMRK  0000010
+#define TARGET_INPCK   0000020
+#define TARGET_ISTRIP  0000040
+#define TARGET_INLCR   0000100
+#define TARGET_IGNCR   0000200
+#define TARGET_ICRNL   0000400
+#define TARGET_IUCLC   0001000
+#define TARGET_IXON    0002000
+#define TARGET_IXANY   0004000
+#define TARGET_IXOFF   0010000
+#define TARGET_IMAXBEL 0020000
+
+/* c_oflag bits */
+#define TARGET_OPOST   0000001
+#define TARGET_OLCUC   0000002
+#define TARGET_ONLCR   0000004
+#define TARGET_OCRNL   0000010
+#define TARGET_ONOCR   0000020
+#define TARGET_ONLRET  0000040
+#define TARGET_OFILL   0000100
+#define TARGET_OFDEL   0000200
+#define TARGET_NLDLY   0000400
+#define   TARGET_NL0   0000000
+#define   TARGET_NL1   0000400
+#define TARGET_CRDLY   0003000
+#define   TARGET_CR0   0000000
+#define   TARGET_CR1   0001000
+#define   TARGET_CR2   0002000
+#define   TARGET_CR3   0003000
+#define TARGET_TABDLY  0014000
+#define   TARGET_TAB0  0000000
+#define   TARGET_TAB1  0004000
+#define   TARGET_TAB2  0010000
+#define   TARGET_TAB3  0014000
+#define   TARGET_XTABS 0014000
+#define TARGET_BSDLY   0020000
+#define   TARGET_BS0   0000000
+#define   TARGET_BS1   0020000
+#define TARGET_VTDLY   0040000
+#define   TARGET_VT0   0000000
+#define   TARGET_VT1   0040000
+#define TARGET_FFDLY   0100000
+#define   TARGET_FF0   0000000
+#define   TARGET_FF1   0100000
+
+/* c_cflag bit meaning */
+#define TARGET_CBAUD   0010017
+#define  TARGET_B0     0000000         /* hang up */
+#define  TARGET_B50    0000001
+#define  TARGET_B75    0000002
+#define  TARGET_B110   0000003
+#define  TARGET_B134   0000004
+#define  TARGET_B150   0000005
+#define  TARGET_B200   0000006
+#define  TARGET_B300   0000007
+#define  TARGET_B600   0000010
+#define  TARGET_B1200  0000011
+#define  TARGET_B1800  0000012
+#define  TARGET_B2400  0000013
+#define  TARGET_B4800  0000014
+#define  TARGET_B9600  0000015
+#define  TARGET_B19200 0000016
+#define  TARGET_B38400 0000017
+#define TARGET_EXTA B19200
+#define TARGET_EXTB B38400
+#define TARGET_CSIZE   0000060
+#define   TARGET_CS5   0000000
+#define   TARGET_CS6   0000020
+#define   TARGET_CS7   0000040
+#define   TARGET_CS8   0000060
+#define TARGET_CSTOPB  0000100
+#define TARGET_CREAD   0000200
+#define TARGET_PARENB  0000400
+#define TARGET_PARODD  0001000
+#define TARGET_HUPCL   0002000
+#define TARGET_CLOCAL  0004000
+#define TARGET_CBAUDEX 0010000
+#define  TARGET_B57600  0010001
+#define  TARGET_B115200 0010002
+#define  TARGET_B230400 0010003
+#define  TARGET_B460800 0010004
+#define TARGET_CIBAUD    002003600000  /* input baud rate (not used) */
+#define TARGET_CRTSCTS   020000000000          /* flow control */
+
+/* c_lflag bits */
+#define TARGET_ISIG    0000001
+#define TARGET_ICANON  0000002
+#define TARGET_XCASE   0000004
+#define TARGET_ECHO    0000010
+#define TARGET_ECHOE   0000020
+#define TARGET_ECHOK   0000040
+#define TARGET_ECHONL  0000100
+#define TARGET_NOFLSH  0000200
+#define TARGET_TOSTOP  0000400
+#define TARGET_ECHOCTL 0001000
+#define TARGET_ECHOPRT 0002000
+#define TARGET_ECHOKE  0004000
+#define TARGET_FLUSHO  0010000
+#define TARGET_PENDIN  0040000
+#define TARGET_IEXTEN  0100000
+
+/* c_cc character offsets */
+#define TARGET_VINTR   0
+#define TARGET_VQUIT   1
+#define TARGET_VERASE  2
+#define TARGET_VKILL   3
+#define TARGET_VEOF    4
+#define TARGET_VTIME   5
+#define TARGET_VMIN    6
+#define TARGET_VSWTC   7
+#define TARGET_VSTART  8
+#define TARGET_VSTOP   9
+#define TARGET_VSUSP   10
+#define TARGET_VEOL    11
+#define TARGET_VREPRINT        12
+#define TARGET_VDISCARD        13
+#define TARGET_VWERASE 14
+#define TARGET_VLNEXT  15
+#define TARGET_VEOL2   16
+
+/* ioctls */
+
+#define TARGET_TCGETS          0x5401
+#define TARGET_TCSETS          0x5402
+#define TARGET_TCSETSW         0x5403
+#define TARGET_TCSETSF         0x5404
+#define TARGET_TCGETA          0x5405
+#define TARGET_TCSETA          0x5406
+#define TARGET_TCSETAW         0x5407
+#define TARGET_TCSETAF         0x5408
+#define TARGET_TCSBRK          0x5409
+#define TARGET_TCXONC          0x540A
+#define TARGET_TCFLSH          0x540B
+
+#define TARGET_TIOCEXCL        0x540C
+#define TARGET_TIOCNXCL        0x540D
+#define TARGET_TIOCSCTTY       0x540E
+#define TARGET_TIOCGPGRP       0x540F
+#define TARGET_TIOCSPGRP       0x5410
+#define TARGET_TIOCOUTQ        0x5411
+#define TARGET_TIOCSTI         0x5412
+#define TARGET_TIOCGWINSZ      0x5413
+#define TARGET_TIOCSWINSZ      0x5414
+#define TARGET_TIOCMGET        0x5415
+#define TARGET_TIOCMBIS        0x5416
+#define TARGET_TIOCMBIC        0x5417
+#define TARGET_TIOCMSET        0x5418
+#define TARGET_TIOCGSOFTCAR    0x5419
+#define TARGET_TIOCSSOFTCAR    0x541A
+#define TARGET_FIONREAD        0x541B
+#define TARGET_TIOCINQ         TARGET_FIONREAD
+#define TARGET_TIOCLINUX       0x541C
+#define TARGET_TIOCCONS        0x541D
+#define TARGET_TIOCGSERIAL     0x541E
+#define TARGET_TIOCSSERIAL     0x541F
+#define TARGET_TIOCPKT         0x5420
+#define TARGET_FIONBIO         0x5421
+#define TARGET_TIOCNOTTY       0x5422
+#define TARGET_TIOCSETD        0x5423
+#define TARGET_TIOCGETD        0x5424
+#define TARGET_TCSBRKP         0x5425  /* Needed for POSIX tcsendbreak() */
+#define TARGET_TIOCTTYGSTRUCT  0x5426  /* For debugging only */
+#define TARGET_TIOCSBRK        0x5427  /* BSD compatibility */
+#define TARGET_TIOCCBRK        0x5428  /* BSD compatibility */
+#define TARGET_TIOCGSID        0x5429  /* Return the session ID of FD */
+#define TARGET_TIOCGPTN        TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TARGET_TIOCSPTLCK      TARGET_IOW('T',0x31, int)  /* Lock/unlock Pty */
+
+#define TARGET_FIONCLEX        0x5450  /* these numbers need to be adjusted. */
+#define TARGET_FIOCLEX         0x5451
+#define TARGET_FIOASYNC        0x5452
+#define TARGET_TIOCSERCONFIG   0x5453
+#define TARGET_TIOCSERGWILD    0x5454
+#define TARGET_TIOCSERSWILD    0x5455
+#define TARGET_TIOCGLCKTRMIOS  0x5456
+#define TARGET_TIOCSLCKTRMIOS  0x5457
+#define TARGET_TIOCSERGSTRUCT  0x5458 /* For debugging only */
+#define TARGET_TIOCSERGETLSR   0x5459 /* Get line status register */
+#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TARGET_TIOCMIWAIT      0x545C  /* wait for a change on serial input line(s) */
+#define TARGET_TIOCGICOUNT     0x545D  /* read serial port inline interrupt counts */
+#define TARGET_TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
+#define TARGET_TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
+
+/* Used for packet mode */
+#define TARGET_TIOCPKT_DATA             0
+#define TARGET_TIOCPKT_FLUSHREAD        1
+#define TARGET_TIOCPKT_FLUSHWRITE       2
+#define TARGET_TIOCPKT_STOP             4
+#define TARGET_TIOCPKT_START            8
+#define TARGET_TIOCPKT_NOSTOP          16
+#define TARGET_TIOCPKT_DOSTOP          32
+
+#define TARGET_TIOCSER_TEMT    0x01    /* Transmitter physically empty */
+
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
new file mode 100644 (file)
index 0000000..6326747
--- /dev/null
@@ -0,0 +1,235 @@
+/* from asm/termbits.h */
+
+#define TARGET_NCCS 19
+
+struct target_termios {
+    unsigned int c_iflag;               /* input mode flags */
+    unsigned int c_oflag;               /* output mode flags */
+    unsigned int c_cflag;               /* control mode flags */
+    unsigned int c_lflag;               /* local mode flags */
+    unsigned char c_line;                    /* line discipline */
+    unsigned char c_cc[TARGET_NCCS];                /* control characters */
+    unsigned int c_ispeed;             /* input speed */
+    unsigned int c_ospeed;             /* output speed */
+};
+
+/* c_cc character offsets */
+#define TARGET_VINTR   0
+#define TARGET_VQUIT   1
+#define TARGET_VERASE  2
+#define TARGET_VKILL   3
+#define TARGET_VEOF    4
+#define TARGET_VMIN    5
+#define TARGET_VEOL    6
+#define TARGET_VTIME   7
+#define TARGET_VEOL2   8
+#define TARGET_VSWTC   9
+
+#define TARGET_VWERASE         10
+#define TARGET_VREPRINT        11
+#define TARGET_VSUSP           12
+#define TARGET_VSTART          13
+#define TARGET_VSTOP           14
+#define TARGET_VLNEXT          15
+#define TARGET_VDISCARD        16
+
+#define TARGET_IGNBRK  0000001
+#define TARGET_BRKINT  0000002
+#define TARGET_IGNPAR  0000004
+#define TARGET_PARMRK  0000010
+#define TARGET_INPCK   0000020
+#define TARGET_ISTRIP  0000040
+#define TARGET_INLCR   0000100
+#define TARGET_IGNCR   0000200
+#define TARGET_ICRNL   0000400
+#define TARGET_IXON    0001000
+#define TARGET_IXOFF   0002000
+#define TARGET_IXANY   0004000
+#define TARGET_IUCLC   0010000
+#define TARGET_IMAXBEL 0020000
+
+/* c_oflag bits */
+#define TARGET_OPOST   0000001
+#define TARGET_ONLCR   0000002
+#define TARGET_OLCUC   0000004
+
+#define TARGET_OCRNL   0000010
+#define TARGET_ONOCR   0000020
+#define TARGET_ONLRET  0000040
+
+#define TARGET_OFILL   00000100
+#define TARGET_OFDEL   00000200
+#define TARGET_NLDLY   00001400
+#define   TARGET_NL0   00000000
+#define   TARGET_NL1   00000400
+#define   TARGET_NL2   00001000
+#define   TARGET_NL3   00001400
+#define TARGET_TABDLY  00006000
+#define   TARGET_TAB0  00000000
+#define   TARGET_TAB1  00002000
+#define   TARGET_TAB2  00004000
+#define   TARGET_TAB3  00006000
+#define TARGET_CRDLY   00030000
+#define   TARGET_CR0   00000000
+#define   TARGET_CR1   00010000
+#define   TARGET_CR2   00020000
+#define   TARGET_CR3   00030000
+#define TARGET_FFDLY   00040000
+#define   TARGET_FF0   00000000
+#define   TARGET_FF1   00040000
+#define TARGET_BSDLY   00100000
+#define   TARGET_BS0   00000000
+#define   TARGET_BS1   00100000
+#define TARGET_VTDLY   00200000
+#define   TARGET_VT0   00000000
+#define   TARGET_VT1   00200000
+#define TARGET_XTABS   01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+
+/* c_cflag bit meaning */
+#define TARGET_CBAUD   0000377
+#define  TARGET_B0     0000000         /* hang up */
+#define  TARGET_B50    0000001
+#define  TARGET_B75    0000002
+#define  TARGET_B110   0000003
+#define  TARGET_B134   0000004
+#define  TARGET_B150   0000005
+#define  TARGET_B200   0000006
+#define  TARGET_B300   0000007
+#define  TARGET_B600   0000010
+#define  TARGET_B1200  0000011
+#define  TARGET_B1800  0000012
+#define  TARGET_B2400  0000013
+#define  TARGET_B4800  0000014
+#define  TARGET_B9600  0000015
+#define  TARGET_B19200 0000016
+#define  TARGET_B38400 0000017
+#define TARGET_EXTA B19200
+#define TARGET_EXTB B38400
+#define TARGET_CBAUDEX 0000000
+#define  TARGET_B57600   00020
+#define  TARGET_B115200  00021
+#define  TARGET_B230400  00022
+#define  TARGET_B460800  00023
+#define  TARGET_B500000  00024
+#define  TARGET_B576000  00025
+#define  TARGET_B921600  00026
+#define TARGET_B1000000  00027
+#define TARGET_B1152000  00030
+#define TARGET_B1500000  00031
+#define TARGET_B2000000  00032
+#define TARGET_B2500000  00033
+#define TARGET_B3000000  00034
+#define TARGET_B3500000  00035
+#define TARGET_B4000000  00036
+
+#define TARGET_CSIZE   00001400
+#define   TARGET_CS5   00000000
+#define   TARGET_CS6   00000400
+#define   TARGET_CS7   00001000
+#define   TARGET_CS8   00001400
+
+#define TARGET_CSTOPB  00002000
+#define TARGET_CREAD   00004000
+#define TARGET_PARENB  00010000
+#define TARGET_PARODD  00020000
+#define TARGET_HUPCL   00040000
+
+#define TARGET_CLOCAL  00100000
+#define TARGET_CRTSCTS   020000000000          /* flow control */
+
+/* c_lflag bits */
+#define TARGET_ISIG    0x00000080
+#define TARGET_ICANON  0x00000100
+#define TARGET_XCASE   0x00004000
+#define TARGET_ECHO    0x00000008
+#define TARGET_ECHOE   0x00000002
+#define TARGET_ECHOK   0x00000004
+#define TARGET_ECHONL  0x00000010
+#define TARGET_NOFLSH  0x80000000
+#define TARGET_TOSTOP  0x00400000
+#define TARGET_ECHOCTL 0x00000040
+#define TARGET_ECHOPRT 0x00000020
+#define TARGET_ECHOKE  0x00000001
+#define TARGET_FLUSHO  0x00800000
+#define TARGET_PENDIN  0x20000000
+#define TARGET_IEXTEN  0x00000400
+
+/* ioctls */
+
+#define TARGET_FIOCLEX         TARGET_IO('f', 1)
+#define TARGET_FIONCLEX                TARGET_IO('f', 2)
+#define TARGET_FIOASYNC                TARGET_IOW('f', 125, int)
+#define TARGET_FIONBIO         TARGET_IOW('f', 126, int)
+#define TARGET_FIONREAD                TARGET_IOR('f', 127, int)
+#define TARGET_TIOCINQ         TARGET_FIONREAD
+//#define TARGET_FIOQSIZE              TARGET_IOR('f', 128, loff_t)
+
+#define TARGET_TCGETS          TARGET_IOR('t', 19, struct target_termios)
+#define TARGET_TCSETS          TARGET_IOW('t', 20, struct target_termios)
+#define TARGET_TCSETSW         TARGET_IOW('t', 21, struct target_termios)
+#define TARGET_TCSETSF         TARGET_IOW('t', 22, struct target_termios)
+
+#define TARGET_TCGETA          TARGET_IOR('t', 23, struct target_termio)
+#define TARGET_TCSETA          TARGET_IOW('t', 24, struct target_termio)
+#define TARGET_TCSETAW         TARGET_IOW('t', 25, struct target_termio)
+#define TARGET_TCSETAF         TARGET_IOW('t', 28, struct target_termio)
+
+#define TARGET_TCSBRK          TARGET_IO('t', 29)
+#define TARGET_TCXONC          TARGET_IO('t', 30)
+#define TARGET_TCFLSH          TARGET_IO('t', 31)
+
+#define TARGET_TIOCSWINSZ      TARGET_IOW('t', 103, struct target_winsize)
+#define TARGET_TIOCGWINSZ      TARGET_IOR('t', 104, struct target_winsize)
+#define        TARGET_TIOCSTART        TARGET_IO('t', 110)             /* start output, like ^Q */
+#define        TARGET_TIOCSTOP TARGET_IO('t', 111)             /* stop output, like ^S */
+#define TARGET_TIOCOUTQ        TARGET_IOR('t', 115, int)     /* output queue size */
+
+#define TARGET_TIOCGLTC        TARGET_IOR('t', 116, struct target_ltchars)
+#define TARGET_TIOCSLTC        TARGET_IOW('t', 117, struct target_ltchars)
+#define TARGET_TIOCSPGRP       TARGET_IOW('t', 118, int)
+#define TARGET_TIOCGPGRP       TARGET_IOR('t', 119, int)
+
+#define TARGET_TIOCEXCL        0x540C
+#define TARGET_TIOCNXCL        0x540D
+#define TARGET_TIOCSCTTY       0x540E
+
+#define TARGET_TIOCSTI         0x5412
+#define TARGET_TIOCMGET        0x5415
+#define TARGET_TIOCMBIS        0x5416
+#define TARGET_TIOCMBIC        0x5417
+#define TARGET_TIOCMSET        0x5418
+
+#define TARGET_TIOCGSOFTCAR    0x5419
+#define TARGET_TIOCSSOFTCAR    0x541A
+#define TARGET_TIOCLINUX       0x541C
+#define TARGET_TIOCCONS        0x541D
+#define TARGET_TIOCGSERIAL     0x541E
+#define TARGET_TIOCSSERIAL     0x541F
+#define TARGET_TIOCPKT         0x5420
+
+#define TARGET_TIOCNOTTY       0x5422
+#define TARGET_TIOCSETD        0x5423
+#define TARGET_TIOCGETD        0x5424
+#define TARGET_TCSBRKP         0x5425  /* Needed for POSIX tcsendbreak() */
+#define TARGET_TIOCTTYGSTRUCT  0x5426  /* For debugging only */
+#define TARGET_TIOCSBRK        0x5427  /* BSD compatibility */
+#define TARGET_TIOCCBRK        0x5428  /* BSD compatibility */
+#define TARGET_TIOCGSID        0x5429  /* Return the session ID of FD */
+#define TARGET_TIOCGPTN        TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TARGET_TIOCSPTLCK      TARGET_IOW('T',0x31, int)  /* Lock/unlock Pty */
+
+#define TARGET_TIOCSERCONFIG   0x5453
+#define TARGET_TIOCSERGWILD    0x5454
+#define TARGET_TIOCSERSWILD    0x5455
+#define TARGET_TIOCGLCKTRMIOS  0x5456
+#define TARGET_TIOCSLCKTRMIOS  0x5457
+#define TARGET_TIOCSERGSTRUCT  0x5458 /* For debugging only */
+#define TARGET_TIOCSERGETLSR   0x5459 /* Get line status register */
+  /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+# define TARGET_TIOCSER_TEMT    0x01   /* Transmitter physically empty */
+#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TARGET_TIOCMIWAIT      0x545C  /* wait for a change on serial input line(s) */
+#define TARGET_TIOCGICOUNT     0x545D  /* read serial port inline interrupt counts */
+
diff --git a/linux-user/sparc/termbits.h b/linux-user/sparc/termbits.h
new file mode 100644 (file)
index 0000000..cad45b2
--- /dev/null
@@ -0,0 +1,279 @@
+/* from asm/termbits.h */
+
+#define TARGET_NCCS 19
+
+struct target_termios {
+    unsigned int c_iflag;               /* input mode flags */
+    unsigned int c_oflag;               /* output mode flags */
+    unsigned int c_cflag;               /* control mode flags */
+    unsigned int c_lflag;               /* local mode flags */
+    unsigned char c_line;                    /* line discipline */
+    unsigned char c_cc[TARGET_NCCS];                /* control characters */
+};
+
+/* c_cc characters */
+#define TARGET_VINTR    0
+#define TARGET_VQUIT    1
+#define TARGET_VERASE   2
+#define TARGET_VKILL    3
+#define TARGET_VEOF     4
+#define TARGET_VEOL     5
+#define TARGET_VEOL2    6
+#define TARGET_VSWTC    7
+#define TARGET_VSTART   8
+#define TARGET_VSTOP    9
+
+#define TARGET_VSUSP    10
+#define TARGET_VDSUSP   11  /* SunOS POSIX nicety I do believe... */
+#define TARGET_VREPRINT 12
+#define TARGET_VDISCARD 13
+#define TARGET_VWERASE  14
+#define TARGET_VLNEXT   15
+
+/* Kernel keeps vmin/vtime separated, user apps assume vmin/vtime is
+ * shared with eof/eol
+ */
+#define TARGET_VMIN     TARGET_VEOF
+#define TARGET_VTIME    TARGET_VEOL
+
+/* c_iflag bits */
+#define TARGET_IGNBRK  0x00000001
+#define TARGET_BRKINT  0x00000002
+#define TARGET_IGNPAR  0x00000004
+#define TARGET_PARMRK  0x00000008
+#define TARGET_INPCK   0x00000010
+#define TARGET_ISTRIP  0x00000020
+#define TARGET_INLCR   0x00000040
+#define TARGET_IGNCR   0x00000080
+#define TARGET_ICRNL   0x00000100
+#define TARGET_IUCLC   0x00000200
+#define TARGET_IXON    0x00000400
+#define TARGET_IXANY   0x00000800
+#define TARGET_IXOFF   0x00001000
+#define TARGET_IMAXBEL 0x00002000
+
+/* c_oflag bits */
+#define TARGET_OPOST   0x00000001
+#define TARGET_OLCUC   0x00000002
+#define TARGET_ONLCR   0x00000004
+#define TARGET_OCRNL   0x00000008
+#define TARGET_ONOCR   0x00000010
+#define TARGET_ONLRET  0x00000020
+#define TARGET_OFILL   0x00000040
+#define TARGET_OFDEL   0x00000080
+#define TARGET_NLDLY   0x00000100
+#define   TARGET_NL0   0x00000000
+#define   TARGET_NL1   0x00000100
+#define TARGET_CRDLY   0x00000600
+#define   TARGET_CR0   0x00000000
+#define   TARGET_CR1   0x00000200
+#define   TARGET_CR2   0x00000400
+#define   TARGET_CR3   0x00000600
+#define TARGET_TABDLY  0x00001800
+#define   TARGET_TAB0  0x00000000
+#define   TARGET_TAB1  0x00000800
+#define   TARGET_TAB2  0x00001000
+#define   TARGET_TAB3  0x00001800
+#define   TARGET_XTABS 0x00001800
+#define TARGET_BSDLY   0x00002000
+#define   TARGET_BS0   0x00000000
+#define   TARGET_BS1   0x00002000
+#define TARGET_VTDLY   0x00004000
+#define   TARGET_VT0   0x00000000
+#define   TARGET_VT1   0x00004000
+#define TARGET_FFDLY   0x00008000
+#define   TARGET_FF0   0x00000000
+#define   TARGET_FF1   0x00008000
+#define TARGET_PAGEOUT 0x00010000  /* SUNOS specific */
+#define TARGET_WRAP    0x00020000  /* SUNOS specific */
+
+/* c_cflag bit meaning */
+#define TARGET_CBAUD     0x0000100f
+#define  TARGET_B0       0x00000000   /* hang up */
+#define  TARGET_B50      0x00000001
+#define  TARGET_B75      0x00000002
+#define  TARGET_B110     0x00000003
+#define  TARGET_B134     0x00000004
+#define  TARGET_B150     0x00000005
+#define  TARGET_B200     0x00000006
+#define  TARGET_B300     0x00000007
+#define  TARGET_B600     0x00000008
+#define  TARGET_B1200    0x00000009
+#define  TARGET_B1800    0x0000000a
+#define  TARGET_B2400    0x0000000b
+#define  TARGET_B4800    0x0000000c
+#define  TARGET_B9600    0x0000000d
+#define  TARGET_B19200   0x0000000e
+#define  TARGET_B38400   0x0000000f
+#define TARGET_EXTA      B19200
+#define TARGET_EXTB      B38400
+#define  TARGET_CSIZE    0x00000030
+#define   TARGET_CS5     0x00000000
+#define   TARGET_CS6     0x00000010
+#define   TARGET_CS7     0x00000020
+#define   TARGET_CS8     0x00000030
+#define TARGET_CSTOPB    0x00000040
+#define TARGET_CREAD     0x00000080
+#define TARGET_PARENB    0x00000100
+#define TARGET_PARODD    0x00000200
+#define TARGET_HUPCL     0x00000400
+#define TARGET_CLOCAL    0x00000800
+#define TARGET_CBAUDEX   0x00001000
+/* We'll never see these speeds with the Zilogs, but for completeness... */
+#define  TARGET_B57600   0x00001001
+#define  TARGET_B115200  0x00001002
+#define  TARGET_B230400  0x00001003
+#define  TARGET_B460800  0x00001004
+/* This is what we can do with the Zilogs. */
+#define  TARGET_B76800   0x00001005
+/* This is what we can do with the SAB82532. */
+#define  TARGET_B153600  0x00001006
+#define  TARGET_B307200  0x00001007
+#define  TARGET_B614400  0x00001008
+#define  TARGET_B921600  0x00001009
+/* And these are the rest... */
+#define  TARGET_B500000  0x0000100a
+#define  TARGET_B576000  0x0000100b
+#define TARGET_B1000000  0x0000100c
+#define TARGET_B1152000  0x0000100d
+#define TARGET_B1500000  0x0000100e
+#define TARGET_B2000000  0x0000100f
+/* These have totally bogus values and nobody uses them
+   so far. Later on we'd have to use say 0x10000x and
+   adjust CBAUD constant and drivers accordingly.
+#define B2500000  0x00001010
+#define B3000000  0x00001011
+#define B3500000  0x00001012
+#define B4000000  0x00001013  */
+#define TARGET_CIBAUD    0x100f0000  /* input baud rate (not used) */
+#define TARGET_CMSPAR    0x40000000  /* mark or space (stick) parity */
+#define TARGET_CRTSCTS   0x80000000  /* flow control */
+
+/* c_lflag bits */
+#define TARGET_ISIG    0x00000001
+#define TARGET_ICANON  0x00000002
+#define TARGET_XCASE   0x00000004
+#define TARGET_ECHO    0x00000008
+#define TARGET_ECHOE   0x00000010
+#define TARGET_ECHOK   0x00000020
+#define TARGET_ECHONL  0x00000040
+#define TARGET_NOFLSH  0x00000080
+#define TARGET_TOSTOP  0x00000100
+#define TARGET_ECHOCTL 0x00000200
+#define TARGET_ECHOPRT 0x00000400
+#define TARGET_ECHOKE  0x00000800
+#define TARGET_DEFECHO  0x00001000  /* SUNOS thing, what is it? */
+#define TARGET_FLUSHO  0x00002000
+#define TARGET_PENDIN  0x00004000
+#define TARGET_IEXTEN  0x00008000
+
+/* ioctls */
+
+/* Big T */
+#define TARGET_TCGETA          TARGET_IOR('T', 1, struct target_termio)
+#define TARGET_TCSETA          TARGET_IOW('T', 2, struct target_termio)
+#define TARGET_TCSETAW         TARGET_IOW('T', 3, struct target_termio)
+#define TARGET_TCSETAF         TARGET_IOW('T', 4, struct target_termio)
+#define TARGET_TCSBRK          TARGET_IO('T', 5)
+#define TARGET_TCXONC          TARGET_IO('T', 6)
+#define TARGET_TCFLSH          TARGET_IO('T', 7)
+#define TARGET_TCGETS          TARGET_IOR('T', 8, struct target_termios)
+#define TARGET_TCSETS          TARGET_IOW('T', 9, struct target_termios)
+#define TARGET_TCSETSW         TARGET_IOW('T', 10, struct target_termios)
+#define TARGET_TCSETSF         TARGET_IOW('T', 11, struct target_termios)
+
+/* Note that all the ioctls that are not available in Linux have a 
+ * double underscore on the front to: a) avoid some programs to
+ * thing we support some ioctls under Linux (autoconfiguration stuff)
+ */
+/* Little t */
+#define TARGET_TIOCGETD        TARGET_IOR('t', 0, int)
+#define TARGET_TIOCSETD        TARGET_IOW('t', 1, int)
+//#define __TIOCHPCL        _IO('t', 2) /* SunOS Specific */
+//#define __TIOCMODG        _IOR('t', 3, int) /* SunOS Specific */
+//#define __TIOCMODS        _IOW('t', 4, int) /* SunOS Specific */
+//#define __TIOCGETP        _IOR('t', 8, struct sgttyb) /* SunOS Specific */
+//#define __TIOCSETP        _IOW('t', 9, struct sgttyb) /* SunOS Specific */
+//#define __TIOCSETN        _IOW('t', 10, struct sgttyb) /* SunOS Specific */
+#define TARGET_TIOCEXCL        TARGET_IO('t', 13)
+#define TARGET_TIOCNXCL        TARGET_IO('t', 14)
+//#define __TIOCFLUSH       _IOW('t', 16, int) /* SunOS Specific */
+//#define __TIOCSETC        _IOW('t', 17, struct tchars) /* SunOS Specific */
+//#define __TIOCGETC        _IOR('t', 18, struct tchars) /* SunOS Specific */
+//#define __TIOCTCNTL       _IOW('t', 32, int) /* SunOS Specific */
+//#define __TIOCSIGNAL      _IOW('t', 33, int) /* SunOS Specific */
+//#define __TIOCSETX        _IOW('t', 34, int) /* SunOS Specific */
+//#define __TIOCGETX        _IOR('t', 35, int) /* SunOS Specific */
+#define TARGET_TIOCCONS        TARGET_IO('t', 36)
+//#define __TIOCSSIZE     _IOW('t', 37, struct sunos_ttysize) /* SunOS Specific */
+//#define __TIOCGSIZE     _IOR('t', 38, struct sunos_ttysize) /* SunOS Specific */
+#define TARGET_TIOCGSOFTCAR    TARGET_IOR('t', 100, int)
+#define TARGET_TIOCSSOFTCAR    TARGET_IOW('t', 101, int)
+//#define __TIOCUCNTL       _IOW('t', 102, int) /* SunOS Specific */
+#define TARGET_TIOCSWINSZ      TARGET_IOW('t', 103, struct winsize)
+#define TARGET_TIOCGWINSZ      TARGET_IOR('t', 104, struct winsize)
+//#define __TIOCREMOTE      _IOW('t', 105, int) /* SunOS Specific */
+#define TARGET_TIOCMGET        TARGET_IOR('t', 106, int)
+#define TARGET_TIOCMBIC        TARGET_IOW('t', 107, int)
+#define TARGET_TIOCMBIS        TARGET_IOW('t', 108, int)
+#define TARGET_TIOCMSET        TARGET_IOW('t', 109, int)
+#define TARGET_TIOCSTART       TARGET_IO('t', 110)
+#define TARGET_TIOCSTOP        TARGET_IO('t', 111)
+#define TARGET_TIOCPKT         TARGET_IOW('t', 112, int)
+#define TARGET_TIOCNOTTY       TARGET_IO('t', 113)
+#define TARGET_TIOCSTI         TARGET_IOW('t', 114, char)
+#define TARGET_TIOCOUTQ        TARGET_IOR('t', 115, int)
+//#define __TIOCGLTC        _IOR('t', 116, struct ltchars) /* SunOS Specific */
+//#define __TIOCSLTC        _IOW('t', 117, struct ltchars) /* SunOS Specific */
+/* 118 is the non-posix setpgrp tty ioctl */
+/* 119 is the non-posix getpgrp tty ioctl */
+//#define __TIOCCDTR        TARGET_IO('t', 120) /* SunOS Specific */
+//#define __TIOCSDTR        TARGET_IO('t', 121) /* SunOS Specific */
+#define TARGET_TIOCCBRK        TARGET_IO('t', 122)
+#define TARGET_TIOCSBRK        TARGET_IO('t', 123)
+//#define __TIOCLGET        TARGET_IOW('t', 124, int) /* SunOS Specific */
+//#define __TIOCLSET        TARGET_IOW('t', 125, int) /* SunOS Specific */
+//#define __TIOCLBIC        TARGET_IOW('t', 126, int) /* SunOS Specific */
+//#define __TIOCLBIS        TARGET_IOW('t', 127, int) /* SunOS Specific */
+//#define __TIOCISPACE      TARGET_IOR('t', 128, int) /* SunOS Specific */
+//#define __TIOCISIZE       TARGET_IOR('t', 129, int) /* SunOS Specific */
+#define TARGET_TIOCSPGRP       TARGET_IOW('t', 130, int)
+#define TARGET_TIOCGPGRP       TARGET_IOR('t', 131, int)
+#define TARGET_TIOCSCTTY       TARGET_IO('t', 132)
+#define TARGET_TIOCGSID        TARGET_IOR('t', 133, int)
+/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */
+#define TARGET_TIOCGPTN        TARGET_IOR('t', 134, unsigned int) /* Get Pty Number */
+#define TARGET_TIOCSPTLCK      TARGET_IOW('t', 135, int) /* Lock/unlock PTY */
+
+/* Little f */
+#define TARGET_FIOCLEX         TARGET_IO('f', 1)
+#define TARGET_FIONCLEX        TARGET_IO('f', 2)
+#define TARGET_FIOASYNC        TARGET_IOW('f', 125, int)
+#define TARGET_FIONBIO         TARGET_IOW('f', 126, int)
+#define TARGET_FIONREAD        TARGET_IOR('f', 127, int)
+#define TARGET_TIOCINQ         TARGET_FIONREAD
+
+/* SCARY Rutgers local SunOS kernel hackery, perhaps I will support it
+ * someday.  This is completely bogus, I know...
+ */
+//#define __TCGETSTAT       TARGET_IO('T', 200) /* Rutgers specific */
+//#define __TCSETSTAT       TARGET_IO('T', 201) /* Rutgers specific */
+
+/* Linux specific, no SunOS equivalent. */
+#define TARGET_TIOCLINUX       0x541C
+#define TARGET_TIOCGSERIAL     0x541E
+#define TARGET_TIOCSSERIAL     0x541F
+#define TARGET_TCSBRKP         0x5425
+#define TARGET_TIOCTTYGSTRUCT  0x5426
+#define TARGET_TIOCSERCONFIG   0x5453
+#define TARGET_TIOCSERGWILD    0x5454
+#define TARGET_TIOCSERSWILD    0x5455
+#define TARGET_TIOCGLCKTRMIOS  0x5456
+#define TARGET_TIOCSLCKTRMIOS  0x5457
+#define TARGET_TIOCSERGSTRUCT  0x5458 /* For debugging only */
+#define TARGET_TIOCSERGETLSR   0x5459 /* Get line status register */
+#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
+#define TARGET_TIOCMIWAIT      0x545C /* Wait input */
+#define TARGET_TIOCGICOUNT     0x545D /* Read serial port inline interrupt counts */
+
index caa40d1..a0a04aa 100644 (file)
@@ -664,220 +664,26 @@ struct target_pollfd {
 #define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
 
 
-#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC)
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TARGET_TCGETS          0x5401
-#define TARGET_TCSETS          0x5402
-#define TARGET_TCSETSW         0x5403
-#define TARGET_TCSETSF         0x5404
-#define TARGET_TCGETA          0x5405
-#define TARGET_TCSETA          0x5406
-#define TARGET_TCSETAW         0x5407
-#define TARGET_TCSETAF         0x5408
-#define TARGET_TCSBRK          0x5409
-#define TARGET_TCXONC          0x540A
-#define TARGET_TCFLSH          0x540B
-#define TARGET_TIOCEXCL        0x540C
-#define TARGET_TIOCNXCL        0x540D
-#define TARGET_TIOCSCTTY       0x540E
-#define TARGET_TIOCGPGRP       0x540F
-#define TARGET_TIOCSPGRP       0x5410
-#define TARGET_TIOCOUTQ        0x5411
-#define TARGET_TIOCSTI         0x5412
-#define TARGET_TIOCGWINSZ      0x5413
-#define TARGET_TIOCSWINSZ      0x5414
-#define TARGET_TIOCMGET        0x5415
-#define TARGET_TIOCMBIS        0x5416
-#define TARGET_TIOCMBIC        0x5417
-#define TARGET_TIOCMSET        0x5418
-#define TARGET_TIOCGSOFTCAR    0x5419
-#define TARGET_TIOCSSOFTCAR    0x541A
-#define TARGET_FIONREAD        0x541B
-#define TARGET_TIOCINQ         FIONREAD
-#define TARGET_TIOCLINUX       0x541C
-#define TARGET_TIOCCONS        0x541D
-#define TARGET_TIOCGSERIAL     0x541E
-#define TARGET_TIOCSSERIAL     0x541F
-#define TARGET_TIOCPKT         0x5420
-#define TARGET_FIONBIO         0x5421
-#define TARGET_TIOCNOTTY       0x5422
-#define TARGET_TIOCSETD        0x5423
-#define TARGET_TIOCGETD        0x5424
-#define TARGET_TCSBRKP         0x5425  /* Needed for POSIX tcsendbreak() */
-#define TARGET_TIOCTTYGSTRUCT  0x5426  /* For debugging only */
-#define TARGET_TIOCSBRK        0x5427  /* BSD compatibility */
-#define TARGET_TIOCCBRK        0x5428  /* BSD compatibility */
-#define TARGET_TIOCGSID        0x5429  /* Return the session ID of FD */
-#define TARGET_TIOCGPTN        TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TARGET_TIOCSPTLCK      TARGET_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define TARGET_FIONCLEX        0x5450  /* these numbers need to be adjusted. */
-#define TARGET_FIOCLEX         0x5451
-#define TARGET_FIOASYNC        0x5452
-#define TARGET_TIOCSERCONFIG   0x5453
-#define TARGET_TIOCSERGWILD    0x5454
-#define TARGET_TIOCSERSWILD    0x5455
-#define TARGET_TIOCGLCKTRMIOS  0x5456
-#define TARGET_TIOCSLCKTRMIOS  0x5457
-#define TARGET_TIOCSERGSTRUCT  0x5458 /* For debugging only */
-#define TARGET_TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TARGET_TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TARGET_TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TARGET_TIOCMIWAIT      0x545C  /* wait for a change on serial input line(s) */
-#define TARGET_TIOCGICOUNT     0x545D  /* read serial port inline interrupt counts */
-#define TARGET_TIOCGHAYESESP   0x545E  /* Get Hayes ESP configuration */
-#define TARGET_TIOCSHAYESESP   0x545F  /* Set Hayes ESP configuration */
-
-/* Used for packet mode */
-#define TARGET_TIOCPKT_DATA             0
-#define TARGET_TIOCPKT_FLUSHREAD        1
-#define TARGET_TIOCPKT_FLUSHWRITE       2
-#define TARGET_TIOCPKT_STOP             4
-#define TARGET_TIOCPKT_START            8
-#define TARGET_TIOCPKT_NOSTOP          16
-#define TARGET_TIOCPKT_DOSTOP          32
-
-#define TARGET_TIOCSER_TEMT    0x01    /* Transmitter physically empty */
-
 /* from asm/termbits.h */
 
-#define TARGET_NCCS 19
+#define TARGET_NCC 8
+struct target_termio {
+       unsigned short c_iflag;         /* input mode flags */
+       unsigned short c_oflag;         /* output mode flags */
+       unsigned short c_cflag;         /* control mode flags */
+       unsigned short c_lflag;         /* local mode flags */
+       unsigned char c_line;           /* line discipline */
+       unsigned char c_cc[TARGET_NCC]; /* control characters */
+};
 
-struct target_termios {
-    unsigned int c_iflag;               /* input mode flags */
-    unsigned int c_oflag;               /* output mode flags */
-    unsigned int c_cflag;               /* control mode flags */
-    unsigned int c_lflag;               /* local mode flags */
-    unsigned char c_line;                    /* line discipline */
-    unsigned char c_cc[TARGET_NCCS];                /* control characters */
+struct target_winsize {
+       unsigned short ws_row;
+       unsigned short ws_col;
+       unsigned short ws_xpixel;
+       unsigned short ws_ypixel;
 };
 
-/* c_iflag bits */
-#define TARGET_IGNBRK  0000001
-#define TARGET_BRKINT  0000002
-#define TARGET_IGNPAR  0000004
-#define TARGET_PARMRK  0000010
-#define TARGET_INPCK   0000020
-#define TARGET_ISTRIP  0000040
-#define TARGET_INLCR   0000100
-#define TARGET_IGNCR   0000200
-#define TARGET_ICRNL   0000400
-#define TARGET_IUCLC   0001000
-#define TARGET_IXON    0002000
-#define TARGET_IXANY   0004000
-#define TARGET_IXOFF   0010000
-#define TARGET_IMAXBEL 0020000
-
-/* c_oflag bits */
-#define TARGET_OPOST   0000001
-#define TARGET_OLCUC   0000002
-#define TARGET_ONLCR   0000004
-#define TARGET_OCRNL   0000010
-#define TARGET_ONOCR   0000020
-#define TARGET_ONLRET  0000040
-#define TARGET_OFILL   0000100
-#define TARGET_OFDEL   0000200
-#define TARGET_NLDLY   0000400
-#define   TARGET_NL0   0000000
-#define   TARGET_NL1   0000400
-#define TARGET_CRDLY   0003000
-#define   TARGET_CR0   0000000
-#define   TARGET_CR1   0001000
-#define   TARGET_CR2   0002000
-#define   TARGET_CR3   0003000
-#define TARGET_TABDLY  0014000
-#define   TARGET_TAB0  0000000
-#define   TARGET_TAB1  0004000
-#define   TARGET_TAB2  0010000
-#define   TARGET_TAB3  0014000
-#define   TARGET_XTABS 0014000
-#define TARGET_BSDLY   0020000
-#define   TARGET_BS0   0000000
-#define   TARGET_BS1   0020000
-#define TARGET_VTDLY   0040000
-#define   TARGET_VT0   0000000
-#define   TARGET_VT1   0040000
-#define TARGET_FFDLY   0100000
-#define   TARGET_FF0   0000000
-#define   TARGET_FF1   0100000
-
-/* c_cflag bit meaning */
-#define TARGET_CBAUD   0010017
-#define  TARGET_B0     0000000         /* hang up */
-#define  TARGET_B50    0000001
-#define  TARGET_B75    0000002
-#define  TARGET_B110   0000003
-#define  TARGET_B134   0000004
-#define  TARGET_B150   0000005
-#define  TARGET_B200   0000006
-#define  TARGET_B300   0000007
-#define  TARGET_B600   0000010
-#define  TARGET_B1200  0000011
-#define  TARGET_B1800  0000012
-#define  TARGET_B2400  0000013
-#define  TARGET_B4800  0000014
-#define  TARGET_B9600  0000015
-#define  TARGET_B19200 0000016
-#define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
-#define TARGET_CSIZE   0000060
-#define   TARGET_CS5   0000000
-#define   TARGET_CS6   0000020
-#define   TARGET_CS7   0000040
-#define   TARGET_CS8   0000060
-#define TARGET_CSTOPB  0000100
-#define TARGET_CREAD   0000200
-#define TARGET_PARENB  0000400
-#define TARGET_PARODD  0001000
-#define TARGET_HUPCL   0002000
-#define TARGET_CLOCAL  0004000
-#define TARGET_CBAUDEX 0010000
-#define  TARGET_B57600  0010001
-#define  TARGET_B115200 0010002
-#define  TARGET_B230400 0010003
-#define  TARGET_B460800 0010004
-#define TARGET_CIBAUD    002003600000  /* input baud rate (not used) */
-#define TARGET_CRTSCTS   020000000000          /* flow control */
-
-/* c_lflag bits */
-#define TARGET_ISIG    0000001
-#define TARGET_ICANON  0000002
-#define TARGET_XCASE   0000004
-#define TARGET_ECHO    0000010
-#define TARGET_ECHOE   0000020
-#define TARGET_ECHOK   0000040
-#define TARGET_ECHONL  0000100
-#define TARGET_NOFLSH  0000200
-#define TARGET_TOSTOP  0000400
-#define TARGET_ECHOCTL 0001000
-#define TARGET_ECHOPRT 0002000
-#define TARGET_ECHOKE  0004000
-#define TARGET_FLUSHO  0010000
-#define TARGET_PENDIN  0040000
-#define TARGET_IEXTEN  0100000
-
-/* c_cc character offsets */
-#define TARGET_VINTR   0
-#define TARGET_VQUIT   1
-#define TARGET_VERASE  2
-#define TARGET_VKILL   3
-#define TARGET_VEOF    4
-#define TARGET_VTIME   5
-#define TARGET_VMIN    6
-#define TARGET_VSWTC   7
-#define TARGET_VSTART  8
-#define TARGET_VSTOP   9
-#define TARGET_VSUSP   10
-#define TARGET_VEOL    11
-#define TARGET_VREPRINT        12
-#define TARGET_VDISCARD        13
-#define TARGET_VWERASE 14
-#define TARGET_VLNEXT  15
-#define TARGET_VEOL2   16
+#include "termbits.h"
 
 #define TARGET_MAP_SHARED      0x01            /* Share changes */
 #define TARGET_MAP_PRIVATE     0x02            /* Changes are private */
@@ -891,9 +697,7 @@ struct target_termios {
 #define TARGET_MAP_LOCKED      0x2000          /* pages are locked */
 #define TARGET_MAP_NORESERVE   0x4000          /* don't check for reservations */
 
-#endif /* defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) || defined(TARGET_PPC) */
-
-#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC)
+#if defined(TARGET_I386) || defined(TARGET_ARM)
 struct target_stat {
        unsigned short st_dev;
        unsigned short __pad1;
@@ -954,6 +758,64 @@ struct target_stat64 {
        unsigned long long      st_ino;
 } __attribute__((packed));
 
+#elif defined(TARGET_SPARC)
+
+struct target_stat {
+       unsigned short  st_dev;
+       target_ulong    st_ino;
+       unsigned short  st_mode;
+       short           st_nlink;
+       unsigned short  st_uid;
+       unsigned short  st_gid;
+       unsigned short  st_rdev;
+       target_long     st_size;
+       target_long     target_st_atime;
+       target_ulong    __unused1;
+       target_long     target_st_mtime;
+       target_ulong    __unused2;
+       target_long     target_st_ctime;
+       target_ulong    __unused3;
+       target_long     st_blksize;
+       target_long     st_blocks;
+       target_ulong    __unused4[2];
+};
+
+struct target_stat64 {
+       unsigned char   __pad0[6];
+       unsigned short  st_dev;
+
+       uint64_t st_ino;
+
+       unsigned int    st_mode;
+       unsigned int    st_nlink;
+
+       unsigned int    st_uid;
+       unsigned int    st_gid;
+
+       unsigned char   __pad2[6];
+       unsigned short  st_rdev;
+
+       unsigned char   __pad3[8];
+
+        int64_t        st_size;
+       unsigned int    st_blksize;
+
+       unsigned char   __pad4[8];
+       unsigned int    st_blocks;
+
+       unsigned int    target_st_atime;
+       unsigned int    __unused1;
+
+       unsigned int    target_st_mtime;
+       unsigned int    __unused2;
+
+       unsigned int    target_st_ctime;
+       unsigned int    __unused3;
+
+       unsigned int    __unused4;
+       unsigned int    __unused5;
+};
+
 #elif defined(TARGET_PPC)
 
 struct target_stat {
@@ -979,32 +841,23 @@ struct target_stat {
 
 struct target_stat64 {
        unsigned long long st_dev;
-
         unsigned long long st_ino;
-
-       unsigned int    st_mode;
-       unsigned int    st_nlink;
-
+       unsigned int st_mode;
+       unsigned int st_nlink;
        unsigned int st_uid;
        unsigned int st_gid;
-
-       unsigned long long      st_rdev;
-       unsigned short int __pad2;
-
-       long long       st_size;
+       unsigned long long st_rdev;
+       long long pad0;
+       long long st_size;
        target_ulong    st_blksize;
-
+       target_ulong    pad1;
        long long       st_blocks;      /* Number 512-byte blocks allocated. */
-
        target_ulong    target_st_atime;
         target_ulong    target_st_atime_nsec;
-
        target_ulong    target_st_mtime;
         target_ulong    target_st_mtime_nsec;
-
        target_ulong    target_st_ctime;
         target_ulong    target_st_ctime_nsec;
-
         target_ulong    __unused4;
         target_ulong    __unused5;
 };