* [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches
@ 2018-02-19 17:10 Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 1/8] linux-user: Implement ioctl cmd TIOCGPTPEER Laurent Vivier
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
The following changes since commit f0fa81767555fe2c4b5f8c9e0725a80eac1d7f56:
cuda.h: Fix multiple typedef (2018-02-16 18:38:21 +0000)
are available in the Git repository at:
git://github.com/vivier/qemu.git tags/linux-user-for-2.12-pull-request
for you to fetch changes up to f352a021329f73d0219018cdfb39369687e8cadd:
linux-user: MIPS set cpu to r6 CPU if binary is R6 (2018-02-18 18:52:32 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Andreas Schwab (1):
linux-user: Implement ioctl cmd TIOCGPTPEER
Guido Günther (1):
linux-user: Fix register used for 6th and 7th syscall argument on
aarch64
Laurent Vivier (2):
linux-user: Move CPU type name selection to a function
linux-user, m68k: select CPU according to ELF header values
Peter Maydell (1):
linux-user: Remove THREAD macro
Samuel Thibault (1):
linux-user: Fix sched_getaffinity mask size
YunQiang Su (2):
linux-user: introduce functions to detect CPU type
linux-user: MIPS set cpu to r6 CPU if binary is R6
include/elf.h | 32 ++++++++++++++++
linux-user/aarch64/target_elf.h | 14 +++++++
linux-user/aarch64/termbits.h | 2 +
linux-user/alpha/target_elf.h | 14 +++++++
linux-user/alpha/termbits.h | 1 +
linux-user/arm/target_elf.h | 14 +++++++
linux-user/arm/termbits.h | 1 +
linux-user/cris/target_elf.h | 14 +++++++
linux-user/cris/termbits.h | 1 +
linux-user/elfload.c | 35 +++++++++++++++++
linux-user/host/aarch64/safe-syscall.inc.S | 6 +--
linux-user/hppa/target_elf.h | 14 +++++++
linux-user/hppa/termbits.h | 2 +
linux-user/i386/target_elf.h | 14 +++++++
linux-user/i386/termbits.h | 1 +
linux-user/ioctls.h | 3 ++
linux-user/m68k/target_elf.h | 20 ++++++++++
linux-user/m68k/termbits.h | 1 +
linux-user/main.c | 61 ++++++------------------------
linux-user/microblaze/target_elf.h | 14 +++++++
linux-user/microblaze/termbits.h | 1 +
linux-user/mips/target_elf.h | 17 +++++++++
linux-user/mips/termbits.h | 1 +
linux-user/mips64/target_elf.h | 17 +++++++++
linux-user/nios2/target_elf.h | 14 +++++++
linux-user/nios2/termbits.h | 2 +
linux-user/openrisc/target_elf.h | 14 +++++++
linux-user/openrisc/termbits.h | 2 +
linux-user/ppc/target_elf.h | 18 +++++++++
linux-user/ppc/termbits.h | 1 +
linux-user/qemu.h | 5 +--
linux-user/s390x/target_elf.h | 14 +++++++
linux-user/s390x/termbits.h | 1 +
linux-user/sh4/target_elf.h | 14 +++++++
linux-user/sh4/termbits.h | 1 +
linux-user/sparc/target_elf.h | 14 +++++++
linux-user/sparc/termbits.h | 1 +
linux-user/sparc64/target_elf.h | 14 +++++++
linux-user/sparc64/termbits.h | 1 +
linux-user/syscall.c | 13 ++++++-
linux-user/tilegx/target_elf.h | 14 +++++++
linux-user/tilegx/termbits.h | 1 +
linux-user/unicore32/target_elf.h | 14 +++++++
linux-user/x86_64/target_elf.h | 14 +++++++
linux-user/x86_64/termbits.h | 1 +
45 files changed, 417 insertions(+), 56 deletions(-)
create mode 100644 linux-user/aarch64/target_elf.h
create mode 100644 linux-user/alpha/target_elf.h
create mode 100644 linux-user/arm/target_elf.h
create mode 100644 linux-user/cris/target_elf.h
create mode 100644 linux-user/hppa/target_elf.h
create mode 100644 linux-user/i386/target_elf.h
create mode 100644 linux-user/m68k/target_elf.h
create mode 100644 linux-user/microblaze/target_elf.h
create mode 100644 linux-user/mips/target_elf.h
create mode 100644 linux-user/mips64/target_elf.h
create mode 100644 linux-user/nios2/target_elf.h
create mode 100644 linux-user/openrisc/target_elf.h
create mode 100644 linux-user/ppc/target_elf.h
create mode 100644 linux-user/s390x/target_elf.h
create mode 100644 linux-user/sh4/target_elf.h
create mode 100644 linux-user/sparc/target_elf.h
create mode 100644 linux-user/sparc64/target_elf.h
create mode 100644 linux-user/tilegx/target_elf.h
create mode 100644 linux-user/unicore32/target_elf.h
create mode 100644 linux-user/x86_64/target_elf.h
--
2.14.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 1/8] linux-user: Implement ioctl cmd TIOCGPTPEER
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 2/8] linux-user: Fix register used for 6th and 7th syscall argument on aarch64 Laurent Vivier
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Andreas Schwab, Laurent Vivier
From: Andreas Schwab <schwab@suse.de>
With glibc 2.27 the openpty function prefers the TIOCGPTPEER ioctl.
Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <mvmbmhdosb9.fsf_-_@suse.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/aarch64/termbits.h | 2 ++
linux-user/alpha/termbits.h | 1 +
linux-user/arm/termbits.h | 1 +
linux-user/cris/termbits.h | 1 +
linux-user/hppa/termbits.h | 2 ++
linux-user/i386/termbits.h | 1 +
linux-user/ioctls.h | 3 +++
linux-user/m68k/termbits.h | 1 +
linux-user/microblaze/termbits.h | 1 +
linux-user/mips/termbits.h | 1 +
linux-user/nios2/termbits.h | 2 ++
linux-user/openrisc/termbits.h | 2 ++
linux-user/ppc/termbits.h | 1 +
linux-user/s390x/termbits.h | 1 +
linux-user/sh4/termbits.h | 1 +
linux-user/sparc/termbits.h | 1 +
linux-user/sparc64/termbits.h | 1 +
linux-user/syscall.c | 9 +++++++++
linux-user/tilegx/termbits.h | 1 +
linux-user/x86_64/termbits.h | 1 +
20 files changed, 34 insertions(+)
diff --git a/linux-user/aarch64/termbits.h b/linux-user/aarch64/termbits.h
index b64ba974cf..f9f80f0f37 100644
--- a/linux-user/aarch64/termbits.h
+++ b/linux-user/aarch64/termbits.h
@@ -187,6 +187,8 @@ struct target_termios {
/* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
/* Lock/unlock Pty */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
+ /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/alpha/termbits.h b/linux-user/alpha/termbits.h
index 6406b6a799..139bc87fa6 100644
--- a/linux-user/alpha/termbits.h
+++ b/linux-user/alpha/termbits.h
@@ -245,6 +245,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_TIOCSERCONFIG 0x5453
#define TARGET_TIOCSERGWILD 0x5454
diff --git a/linux-user/arm/termbits.h b/linux-user/arm/termbits.h
index 7772df175c..a61e138ec4 100644
--- a/linux-user/arm/termbits.h
+++ b/linux-user/arm/termbits.h
@@ -185,6 +185,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/cris/termbits.h b/linux-user/cris/termbits.h
index fc82ca084e..c825cd2f5e 100644
--- a/linux-user/cris/termbits.h
+++ b/linux-user/cris/termbits.h
@@ -182,6 +182,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/hppa/termbits.h b/linux-user/hppa/termbits.h
index e9633ef119..ad51c9c911 100644
--- a/linux-user/hppa/termbits.h
+++ b/linux-user/hppa/termbits.h
@@ -186,6 +186,8 @@ struct target_termios {
/* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
/* Lock/unlock Pty */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
+ /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/i386/termbits.h b/linux-user/i386/termbits.h
index e051a3af74..32dd0dde5d 100644
--- a/linux-user/i386/termbits.h
+++ b/linux-user/i386/termbits.h
@@ -195,6 +195,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 35cad6f944..586c794639 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -40,6 +40,9 @@
IOCTL(TIOCSETD, IOC_W, MK_PTR(TYPE_INT))
IOCTL(TIOCGPTN, IOC_R, MK_PTR(TYPE_INT))
IOCTL(TIOCSPTLCK, IOC_W, MK_PTR(TYPE_INT))
+#ifdef TIOCGPTPEER
+ IOCTL_SPECIAL(TIOCGPTPEER, 0, do_ioctl_tiocgptpeer, TYPE_INT)
+#endif
IOCTL(FIOCLEX, 0, TYPE_NULL)
IOCTL(FIONCLEX, 0, TYPE_NULL)
IOCTL(FIOASYNC, IOC_W, MK_PTR(TYPE_INT))
diff --git a/linux-user/m68k/termbits.h b/linux-user/m68k/termbits.h
index f7982fb6c2..9df58dc5cb 100644
--- a/linux-user/m68k/termbits.h
+++ b/linux-user/m68k/termbits.h
@@ -196,6 +196,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/microblaze/termbits.h b/linux-user/microblaze/termbits.h
index fc82ca084e..c825cd2f5e 100644
--- a/linux-user/microblaze/termbits.h
+++ b/linux-user/microblaze/termbits.h
@@ -182,6 +182,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/mips/termbits.h b/linux-user/mips/termbits.h
index a0bcad0946..49a72c5539 100644
--- a/linux-user/mips/termbits.h
+++ b/linux-user/mips/termbits.h
@@ -233,6 +233,7 @@ struct target_termios {
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
/* I hope the range from 0x5480 on is free ... */
#define TARGET_TIOCSCTTY 0x5480 /* become controlling tty */
diff --git a/linux-user/nios2/termbits.h b/linux-user/nios2/termbits.h
index b64ba974cf..f9f80f0f37 100644
--- a/linux-user/nios2/termbits.h
+++ b/linux-user/nios2/termbits.h
@@ -187,6 +187,8 @@ struct target_termios {
/* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
/* Lock/unlock Pty */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
+ /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/openrisc/termbits.h b/linux-user/openrisc/termbits.h
index 373af77215..231a49806b 100644
--- a/linux-user/openrisc/termbits.h
+++ b/linux-user/openrisc/termbits.h
@@ -245,6 +245,8 @@ struct target_termios3 {
#define TARGET_TIOCGPTN TARGET_IOR('T', 0x30, unsigned int)
/* Lock/unlock Pty */
#define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
+/* Safely open the slave */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
/* Get primary device node of /dev/console */
#define TARGET_TIOCGDEV TARGET_IOR('T', 0x32, unsigned int)
#define TARGET_TCGETX 0x5432 /* SYS5 TCGETX compatibility */
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
index 73e7151756..a5b1bb783b 100644
--- a/linux-user/ppc/termbits.h
+++ b/linux-user/ppc/termbits.h
@@ -219,6 +219,7 @@ struct target_termios {
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_TIOCSERCONFIG 0x5453
#define TARGET_TIOCSERGWILD 0x5454
diff --git a/linux-user/s390x/termbits.h b/linux-user/s390x/termbits.h
index 2a78a05594..8bcca89cd7 100644
--- a/linux-user/s390x/termbits.h
+++ b/linux-user/s390x/termbits.h
@@ -252,6 +252,7 @@ struct target_ktermios {
#define TARGET_TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TARGET_TIOCGDEV _IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/sh4/termbits.h b/linux-user/sh4/termbits.h
index 2ff774f6ba..5723ed7752 100644
--- a/linux-user/sh4/termbits.h
+++ b/linux-user/sh4/termbits.h
@@ -250,6 +250,7 @@ ID of FD */
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-m
ux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_TIOCSERCONFIG TARGET_IO('T', 83) /* 0x5453 */
diff --git a/linux-user/sparc/termbits.h b/linux-user/sparc/termbits.h
index 691600d27a..113d6dfbdb 100644
--- a/linux-user/sparc/termbits.h
+++ b/linux-user/sparc/termbits.h
@@ -245,6 +245,7 @@ struct target_termios {
/* 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 */
+#define TARGET_TIOCGPTPEER TARGET_IO('t', 137) /* Safely open the slave */
/* Little f */
#define TARGET_FIOCLEX TARGET_IO('f', 1)
diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h
index 691600d27a..113d6dfbdb 100644
--- a/linux-user/sparc64/termbits.h
+++ b/linux-user/sparc64/termbits.h
@@ -245,6 +245,7 @@ struct target_termios {
/* 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 */
+#define TARGET_TIOCGPTPEER TARGET_IO('t', 137) /* Safely open the slave */
/* Little f */
#define TARGET_FIOCLEX TARGET_IO('f', 1)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 82b35a6bdf..effc3a0881 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5636,6 +5636,15 @@ static abi_long do_ioctl_kdsigaccept(const IOCTLEntry *ie, uint8_t *buf_temp,
return get_errno(safe_ioctl(fd, ie->host_cmd, sig));
}
+#ifdef TIOCGPTPEER
+static abi_long do_ioctl_tiocgptpeer(const IOCTLEntry *ie, uint8_t *buf_temp,
+ int fd, int cmd, abi_long arg)
+{
+ int flags = target_to_host_bitmask(arg, fcntl_flags_tbl);
+ return get_errno(safe_ioctl(fd, ie->host_cmd, flags));
+}
+#endif
+
static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, ...) \
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
diff --git a/linux-user/tilegx/termbits.h b/linux-user/tilegx/termbits.h
index 91ec23654e..966daec088 100644
--- a/linux-user/tilegx/termbits.h
+++ b/linux-user/tilegx/termbits.h
@@ -242,6 +242,7 @@ struct target_termios2 {
#define TARGET_TIOCGPKT TARGET_IOR('T', 0x38, int)
#define TARGET_TIOCGPTLCK TARGET_IOR('T', 0x39, int)
#define TARGET_TIOCGEXCL TARGET_IOR('T', 0x40, int)
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
#define TARGET_FIONCLEX 0x5450
#define TARGET_FIOCLEX 0x5451
diff --git a/linux-user/x86_64/termbits.h b/linux-user/x86_64/termbits.h
index 387e742592..f5776a8aa6 100644
--- a/linux-user/x86_64/termbits.h
+++ b/linux-user/x86_64/termbits.h
@@ -215,6 +215,7 @@ struct target_termios {
#define TARGET_TCSETSF2 TARGET_IOW('T',0x2D, struct termios2)
#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_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
#define TARGET_FIONCLEX 0x5450 /* these numbers need to be adjusted. */
#define TARGET_FIOCLEX 0x5451
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 2/8] linux-user: Fix register used for 6th and 7th syscall argument on aarch64
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 1/8] linux-user: Implement ioctl cmd TIOCGPTPEER Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 3/8] linux-user: Fix sched_getaffinity mask size Laurent Vivier
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Guido Günther, Laurent Vivier
From: Guido Günther <agx@sigxcpu.org>
This unbreaks the testcase from
http://lists.nongnu.org/archive/html/qemu-arm/2018-01/msg00514.html
Thanks to Laurent Vivier for spotting the 7th one.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Suggested-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <671eaa99f4e0bf3a58f76f9151f7cfa24662227f.1517565566.git.agx@sigxcpu.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/host/aarch64/safe-syscall.inc.S | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/linux-user/host/aarch64/safe-syscall.inc.S b/linux-user/host/aarch64/safe-syscall.inc.S
index 58a2329b37..bc1f5a9792 100644
--- a/linux-user/host/aarch64/safe-syscall.inc.S
+++ b/linux-user/host/aarch64/safe-syscall.inc.S
@@ -36,7 +36,7 @@ safe_syscall_base:
* and return the result in x0
* and the syscall instruction needs
* x8 == syscall number
- * x0 ... x7 == syscall arguments
+ * x0 ... x6 == syscall arguments
* and returns the result in x0
* Shuffle everything around appropriately.
*/
@@ -47,8 +47,8 @@ safe_syscall_base:
mov x2, x4
mov x3, x5
mov x4, x6
- mov x6, x7
- ldr x7, [sp]
+ mov x5, x7
+ ldr x6, [sp]
/* This next sequence of code works in conjunction with the
* rewind_if_safe_syscall_function(). If a signal is taken
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 3/8] linux-user: Fix sched_getaffinity mask size
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 1/8] linux-user: Implement ioctl cmd TIOCGPTPEER Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 2/8] linux-user: Fix register used for 6th and 7th syscall argument on aarch64 Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 4/8] linux-user: Remove THREAD macro Laurent Vivier
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Samuel Thibault, Laurent Vivier
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
We properly computed the capped mask size to be put to the application
buffer, but didn't actually used it. Also, we need to return the capped mask
size instead of 0 on success.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20180211174704.27441-1-samuel.thibault@ens-lyon.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index effc3a0881..e24f43c4a2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -10502,7 +10502,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = arg2;
}
- ret = host_to_target_cpu_mask(mask, mask_size, arg3, arg2);
+ if (host_to_target_cpu_mask(mask, mask_size, arg3, ret)) {
+ goto efault;
+ }
}
}
break;
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 4/8] linux-user: Remove THREAD macro
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
` (2 preceding siblings ...)
2018-02-19 17:10 ` [Qemu-devel] [PULL 3/8] linux-user: Fix sched_getaffinity mask size Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 5/8] linux-user: Move CPU type name selection to a function Laurent Vivier
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Peter Maydell, Laurent Vivier
From: Peter Maydell <peter.maydell@linaro.org>
Back when we used to support compiling either with or without
NPTL threading library support, we used a macro THREAD which would
expand either to nothing (no thread support) or to __thread (threads
supported). For a long time now we have required thread support,
so remove the macro and just use __thread directly as other parts
of QEMU do.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180213132246.26844-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/main.c | 2 +-
linux-user/qemu.h | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 7de0e02487..fd7900628b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3835,7 +3835,7 @@ void cpu_loop(CPUHPPAState *env)
#endif /* TARGET_HPPA */
-THREAD CPUState *thread_cpu;
+__thread CPUState *thread_cpu;
bool qemu_cpu_is_self(CPUState *cpu)
{
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 4edd7d0c08..bc4bf35036 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -18,8 +18,6 @@
#include "exec/gdbstub.h"
#include "qemu/queue.h"
-#define THREAD __thread
-
/* This is the size of the host kernel's sigset_t, needed where we make
* direct system calls that take a sigset_t pointer and a size.
*/
@@ -201,7 +199,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg5, abi_long arg6, abi_long arg7,
abi_long arg8);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
-extern THREAD CPUState *thread_cpu;
+extern __thread CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
const char *target_strerror(int err);
int get_osversion(void);
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 5/8] linux-user: Move CPU type name selection to a function
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
` (3 preceding siblings ...)
2018-02-19 17:10 ` [Qemu-devel] [PULL 4/8] linux-user: Remove THREAD macro Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 6/8] linux-user: introduce functions to detect CPU type Laurent Vivier
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
Instead of a sequence of "#if ... #endif" move the
selection to a function in linux-user/*/target_elf.h
We can't add them in linux-user/*/target_cpu.h
because we will need to include "elf.h" to
use ELF flags with eflags, and including
"elf.h" in "target_cpu.h" introduces some
conflicts in elfload.c
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180124211301.10095-2-laurent@vivier.eu>
---
linux-user/aarch64/target_elf.h | 14 +++++++++++++
linux-user/alpha/target_elf.h | 14 +++++++++++++
linux-user/arm/target_elf.h | 14 +++++++++++++
linux-user/cris/target_elf.h | 14 +++++++++++++
linux-user/hppa/target_elf.h | 14 +++++++++++++
linux-user/i386/target_elf.h | 14 +++++++++++++
linux-user/m68k/target_elf.h | 14 +++++++++++++
linux-user/main.c | 41 ++------------------------------------
linux-user/microblaze/target_elf.h | 14 +++++++++++++
linux-user/mips/target_elf.h | 14 +++++++++++++
linux-user/mips64/target_elf.h | 14 +++++++++++++
linux-user/nios2/target_elf.h | 14 +++++++++++++
linux-user/openrisc/target_elf.h | 14 +++++++++++++
linux-user/ppc/target_elf.h | 18 +++++++++++++++++
linux-user/s390x/target_elf.h | 14 +++++++++++++
linux-user/sh4/target_elf.h | 14 +++++++++++++
linux-user/sparc/target_elf.h | 14 +++++++++++++
linux-user/sparc64/target_elf.h | 14 +++++++++++++
linux-user/tilegx/target_elf.h | 14 +++++++++++++
linux-user/unicore32/target_elf.h | 14 +++++++++++++
linux-user/x86_64/target_elf.h | 14 +++++++++++++
21 files changed, 286 insertions(+), 39 deletions(-)
create mode 100644 linux-user/aarch64/target_elf.h
create mode 100644 linux-user/alpha/target_elf.h
create mode 100644 linux-user/arm/target_elf.h
create mode 100644 linux-user/cris/target_elf.h
create mode 100644 linux-user/hppa/target_elf.h
create mode 100644 linux-user/i386/target_elf.h
create mode 100644 linux-user/m68k/target_elf.h
create mode 100644 linux-user/microblaze/target_elf.h
create mode 100644 linux-user/mips/target_elf.h
create mode 100644 linux-user/mips64/target_elf.h
create mode 100644 linux-user/nios2/target_elf.h
create mode 100644 linux-user/openrisc/target_elf.h
create mode 100644 linux-user/ppc/target_elf.h
create mode 100644 linux-user/s390x/target_elf.h
create mode 100644 linux-user/sh4/target_elf.h
create mode 100644 linux-user/sparc/target_elf.h
create mode 100644 linux-user/sparc64/target_elf.h
create mode 100644 linux-user/tilegx/target_elf.h
create mode 100644 linux-user/unicore32/target_elf.h
create mode 100644 linux-user/x86_64/target_elf.h
diff --git a/linux-user/aarch64/target_elf.h b/linux-user/aarch64/target_elf.h
new file mode 100644
index 0000000000..a7eb962fba
--- /dev/null
+++ b/linux-user/aarch64/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef AARCH64_TARGET_ELF_H
+#define AARCH64_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/alpha/target_elf.h b/linux-user/alpha/target_elf.h
new file mode 100644
index 0000000000..344e9f4d39
--- /dev/null
+++ b/linux-user/alpha/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef ALPHA_TARGET_ELF_H
+#define ALPHA_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/arm/target_elf.h b/linux-user/arm/target_elf.h
new file mode 100644
index 0000000000..58ff6a0986
--- /dev/null
+++ b/linux-user/arm/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef ARM_TARGET_ELF_H
+#define ARM_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/cris/target_elf.h b/linux-user/cris/target_elf.h
new file mode 100644
index 0000000000..99eb4ec704
--- /dev/null
+++ b/linux-user/cris/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef CRIS_TARGET_ELF_H
+#define CRIS_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/hppa/target_elf.h b/linux-user/hppa/target_elf.h
new file mode 100644
index 0000000000..82b4e9535e
--- /dev/null
+++ b/linux-user/hppa/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef HPPA_TARGET_ELF_H
+#define HPPA_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/i386/target_elf.h b/linux-user/i386/target_elf.h
new file mode 100644
index 0000000000..1c6142e7da
--- /dev/null
+++ b/linux-user/i386/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef I386_TARGET_ELF_H
+#define I386_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "qemu32";
+}
+#endif
diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h
new file mode 100644
index 0000000000..df375ad5d3
--- /dev/null
+++ b/linux-user/m68k/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef M68K_TARGET_ELF_H
+#define M68K_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/main.c b/linux-user/main.c
index fd7900628b..079b98235b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -35,6 +35,7 @@
#include "elf.h"
#include "exec/log.h"
#include "trace/control.h"
+#include "target_elf.h"
char *exec_path;
@@ -4344,45 +4345,7 @@ int main(int argc, char **argv, char **envp)
init_qemu_uname_release();
if (cpu_model == NULL) {
-#if defined(TARGET_I386)
-#ifdef TARGET_X86_64
- cpu_model = "qemu64";
-#else
- cpu_model = "qemu32";
-#endif
-#elif defined(TARGET_ARM)
- cpu_model = "any";
-#elif defined(TARGET_UNICORE32)
- cpu_model = "any";
-#elif defined(TARGET_M68K)
- cpu_model = "any";
-#elif defined(TARGET_SPARC)
-#ifdef TARGET_SPARC64
- cpu_model = "TI UltraSparc II";
-#else
- cpu_model = "Fujitsu MB86904";
-#endif
-#elif defined(TARGET_MIPS)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
- cpu_model = "5KEf";
-#else
- cpu_model = "24Kf";
-#endif
-#elif defined TARGET_OPENRISC
- cpu_model = "or1200";
-#elif defined(TARGET_PPC)
-# ifdef TARGET_PPC64
- cpu_model = "POWER8";
-# else
- cpu_model = "750";
-# endif
-#elif defined TARGET_SH4
- cpu_model = "sh7785";
-#elif defined TARGET_S390X
- cpu_model = "qemu";
-#else
- cpu_model = "any";
-#endif
+ cpu_model = cpu_get_model(0);
}
tcg_exec_init(0);
/* NOTE: we need to init the CPU at this stage to get
diff --git a/linux-user/microblaze/target_elf.h b/linux-user/microblaze/target_elf.h
new file mode 100644
index 0000000000..8a8f1debff
--- /dev/null
+++ b/linux-user/microblaze/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef MICROBLAZE_TARGET_ELF_H
+#define MICROBLAZE_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h
new file mode 100644
index 0000000000..bed0b43259
--- /dev/null
+++ b/linux-user/mips/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef MIPS_TARGET_ELF_H
+#define MIPS_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "24Kf";
+}
+#endif
diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h
new file mode 100644
index 0000000000..5b6f4692e0
--- /dev/null
+++ b/linux-user/mips64/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef MIPS64_TARGET_ELF_H
+#define MIPS64_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "5KEf";
+}
+#endif
diff --git a/linux-user/nios2/target_elf.h b/linux-user/nios2/target_elf.h
new file mode 100644
index 0000000000..801e20afaf
--- /dev/null
+++ b/linux-user/nios2/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef NIOS2_TARGET_ELF_H
+#define NIOS2_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/openrisc/target_elf.h b/linux-user/openrisc/target_elf.h
new file mode 100644
index 0000000000..40ceb025c9
--- /dev/null
+++ b/linux-user/openrisc/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef OPENRISC_TARGET_ELF_H
+#define OPENRISC_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "or1200";
+}
+#endif
diff --git a/linux-user/ppc/target_elf.h b/linux-user/ppc/target_elf.h
new file mode 100644
index 0000000000..576a5b9959
--- /dev/null
+++ b/linux-user/ppc/target_elf.h
@@ -0,0 +1,18 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef PPC_TARGET_ELF_H
+#define PPC_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+#ifdef TARGET_PPC64
+ return "POWER8";
+#else
+ return "750";
+#endif
+}
+#endif
diff --git a/linux-user/s390x/target_elf.h b/linux-user/s390x/target_elf.h
new file mode 100644
index 0000000000..8114b59c1d
--- /dev/null
+++ b/linux-user/s390x/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef S390X_TARGET_ELF_H
+#define S390X_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "qemu";
+}
+#endif
diff --git a/linux-user/sh4/target_elf.h b/linux-user/sh4/target_elf.h
new file mode 100644
index 0000000000..f485e0cef2
--- /dev/null
+++ b/linux-user/sh4/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef SH4_TARGET_ELF_H
+#define SH4_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "sh7785";
+}
+#endif
diff --git a/linux-user/sparc/target_elf.h b/linux-user/sparc/target_elf.h
new file mode 100644
index 0000000000..31d508c0df
--- /dev/null
+++ b/linux-user/sparc/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef SPARC_TARGET_ELF_H
+#define SPARC_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "Fujitsu MB86904";
+}
+#endif
diff --git a/linux-user/sparc64/target_elf.h b/linux-user/sparc64/target_elf.h
new file mode 100644
index 0000000000..d6e388f1cf
--- /dev/null
+++ b/linux-user/sparc64/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef SPARC64_TARGET_ELF_H
+#define SPARC64_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "TI UltraSparc II";
+}
+#endif
diff --git a/linux-user/tilegx/target_elf.h b/linux-user/tilegx/target_elf.h
new file mode 100644
index 0000000000..7197bb0005
--- /dev/null
+++ b/linux-user/tilegx/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef TILEGX_TARGET_ELF_H
+#define TILEGX_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/unicore32/target_elf.h b/linux-user/unicore32/target_elf.h
new file mode 100644
index 0000000000..e2bfcb2ca3
--- /dev/null
+++ b/linux-user/unicore32/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef UNICORE32_TARGET_ELF_H
+#define UNICORE32_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "any";
+}
+#endif
diff --git a/linux-user/x86_64/target_elf.h b/linux-user/x86_64/target_elf.h
new file mode 100644
index 0000000000..7b76a90de8
--- /dev/null
+++ b/linux-user/x86_64/target_elf.h
@@ -0,0 +1,14 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation, or (at your option) any
+ * later version. See the COPYING file in the top-level directory.
+ */
+
+#ifndef X86_64_TARGET_ELF_H
+#define X86_64_TARGET_ELF_H
+static inline const char *cpu_get_model(uint32_t eflags)
+{
+ return "qemu64";
+}
+#endif
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 6/8] linux-user: introduce functions to detect CPU type
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
` (4 preceding siblings ...)
2018-02-19 17:10 ` [Qemu-devel] [PULL 5/8] linux-user: Move CPU type name selection to a function Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 7/8] linux-user, m68k: select CPU according to ELF header values Laurent Vivier
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, YunQiang Su, Laurent Vivier
From: YunQiang Su <syq@debian.org>
Add a function to return ELF e_flags and use it
to select the CPU model.
Signed-off-by: YunQiang Su <syq@debian.org>
[lv: split the patch and some cleanup in get_elf_eflags()]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180124211301.10095-3-laurent@vivier.eu>
---
linux-user/elfload.c | 35 +++++++++++++++++++++++++++++++++++
linux-user/main.c | 20 ++++++++++----------
linux-user/qemu.h | 1 +
3 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 8bb9a2c3e8..0208022445 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2396,6 +2396,41 @@ give_up:
g_free(syms);
}
+uint32_t get_elf_eflags(int fd)
+{
+ struct elfhdr ehdr;
+ off_t offset;
+ int ret;
+
+ /* Read ELF header */
+ offset = lseek(fd, 0, SEEK_SET);
+ if (offset == (off_t) -1) {
+ return 0;
+ }
+ ret = read(fd, &ehdr, sizeof(ehdr));
+ if (ret < sizeof(ehdr)) {
+ return 0;
+ }
+ offset = lseek(fd, offset, SEEK_SET);
+ if (offset == (off_t) -1) {
+ return 0;
+ }
+
+ /* Check ELF signature */
+ if (!elf_check_ident(&ehdr)) {
+ return 0;
+ }
+
+ /* check header */
+ bswap_ehdr(&ehdr);
+ if (!elf_check_ehdr(&ehdr)) {
+ return 0;
+ }
+
+ /* return architecture id */
+ return ehdr.e_flags;
+}
+
int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
{
struct image_info interp_info;
diff --git a/linux-user/main.c b/linux-user/main.c
index 079b98235b..bbeb78fb89 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4344,8 +4344,17 @@ int main(int argc, char **argv, char **envp)
init_qemu_uname_release();
+ execfd = qemu_getauxval(AT_EXECFD);
+ if (execfd == 0) {
+ execfd = open(filename, O_RDONLY);
+ if (execfd < 0) {
+ printf("Error while loading %s: %s\n", filename, strerror(errno));
+ _exit(EXIT_FAILURE);
+ }
+ }
+
if (cpu_model == NULL) {
- cpu_model = cpu_get_model(0);
+ cpu_model = cpu_get_model(get_elf_eflags(execfd));
}
tcg_exec_init(0);
/* NOTE: we need to init the CPU at this stage to get
@@ -4438,15 +4447,6 @@ int main(int argc, char **argv, char **envp)
cpu->opaque = ts;
task_settid(ts);
- execfd = qemu_getauxval(AT_EXECFD);
- if (execfd == 0) {
- execfd = open(filename, O_RDONLY);
- if (execfd < 0) {
- printf("Error while loading %s: %s\n", filename, strerror(errno));
- _exit(EXIT_FAILURE);
- }
- }
-
ret = loader_exec(execfd, filename, target_argv, target_environ, regs,
info, &bprm);
if (ret != 0) {
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index bc4bf35036..f4b4ca72ad 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -186,6 +186,7 @@ int loader_exec(int fdexec, const char *filename, char **argv, char **envp,
struct target_pt_regs * regs, struct image_info *infop,
struct linux_binprm *);
+uint32_t get_elf_eflags(int fd);
int load_elf_binary(struct linux_binprm *bprm, struct image_info *info);
int load_flt_binary(struct linux_binprm *bprm, struct image_info *info);
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 7/8] linux-user, m68k: select CPU according to ELF header values
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
` (5 preceding siblings ...)
2018-02-19 17:10 ` [Qemu-devel] [PULL 6/8] linux-user: introduce functions to detect CPU type Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 8/8] linux-user: MIPS set cpu to r6 CPU if binary is R6 Laurent Vivier
2018-02-19 19:50 ` [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Peter Maydell
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Laurent Vivier
M680x0 doesn't support the same set of instructions
as ColdFire, so we can't use "any" CPU type to execute
m68020 instructions.
We select CPU type ("m68040" or "any" for ColdFire)
according to the ELF header. If we can't, we
use by default the value used until now: "any".
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180124211301.10095-4-laurent@vivier.eu>
---
include/elf.h | 28 ++++++++++++++++++++++++++++
linux-user/m68k/target_elf.h | 6 ++++++
2 files changed, 34 insertions(+)
diff --git a/include/elf.h b/include/elf.h
index e8a515ce3d..ca9a419043 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -537,6 +537,34 @@ typedef struct {
#define HWCAP_S390_HIGH_GPRS 512
#define HWCAP_S390_TE 1024
+/* M68K specific definitions. */
+/* We use the top 24 bits to encode information about the
+ architecture variant. */
+#define EF_M68K_CPU32 0x00810000
+#define EF_M68K_M68000 0x01000000
+#define EF_M68K_CFV4E 0x00008000
+#define EF_M68K_FIDO 0x02000000
+#define EF_M68K_ARCH_MASK \
+ (EF_M68K_M68000 | EF_M68K_CPU32 | EF_M68K_CFV4E | EF_M68K_FIDO)
+
+/* We use the bottom 8 bits to encode information about the
+ coldfire variant. If we use any of these bits, the top 24 bits are
+ either 0 or EF_M68K_CFV4E. */
+#define EF_M68K_CF_ISA_MASK 0x0F /* Which ISA */
+#define EF_M68K_CF_ISA_A_NODIV 0x01 /* ISA A except for div */
+#define EF_M68K_CF_ISA_A 0x02
+#define EF_M68K_CF_ISA_A_PLUS 0x03
+#define EF_M68K_CF_ISA_B_NOUSP 0x04 /* ISA_B except for USP */
+#define EF_M68K_CF_ISA_B 0x05
+#define EF_M68K_CF_ISA_C 0x06
+#define EF_M68K_CF_ISA_C_NODIV 0x07 /* ISA C except for div */
+#define EF_M68K_CF_MAC_MASK 0x30
+#define EF_M68K_CF_MAC 0x10 /* MAC */
+#define EF_M68K_CF_EMAC 0x20 /* EMAC */
+#define EF_M68K_CF_EMAC_B 0x30 /* EMAC_B */
+#define EF_M68K_CF_FLOAT 0x40 /* Has float insns */
+#define EF_M68K_CF_MASK 0xFF
+
/*
* 68k ELF relocation types
*/
diff --git a/linux-user/m68k/target_elf.h b/linux-user/m68k/target_elf.h
index df375ad5d3..998fe0fe2f 100644
--- a/linux-user/m68k/target_elf.h
+++ b/linux-user/m68k/target_elf.h
@@ -9,6 +9,12 @@
#define M68K_TARGET_ELF_H
static inline const char *cpu_get_model(uint32_t eflags)
{
+ if (eflags == 0 || (eflags & EF_M68K_M68000)) {
+ /* 680x0 */
+ return "m68040";
+ }
+
+ /* Coldfire */
return "any";
}
#endif
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PULL 8/8] linux-user: MIPS set cpu to r6 CPU if binary is R6
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
` (6 preceding siblings ...)
2018-02-19 17:10 ` [Qemu-devel] [PULL 7/8] linux-user, m68k: select CPU according to ELF header values Laurent Vivier
@ 2018-02-19 17:10 ` Laurent Vivier
2018-02-19 19:50 ` [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Peter Maydell
8 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-19 17:10 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, YunQiang Su, Laurent Vivier
From: YunQiang Su <syq@debian.org>
So here we need to detect the version of binaries and set
cpu_model for it.
Signed-off-by: YunQiang Su <syq@debian.org>
[lv: original patch modified to move code into cpu_get_model()]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20180124211301.10095-5-laurent@vivier.eu>
---
include/elf.h | 4 ++++
linux-user/mips/target_elf.h | 3 +++
linux-user/mips64/target_elf.h | 3 +++
3 files changed, 10 insertions(+)
diff --git a/include/elf.h b/include/elf.h
index ca9a419043..746b6d393b 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -40,6 +40,10 @@ typedef int64_t Elf64_Sxword;
#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
#define EF_MIPS_ARCH_32 0x50000000 /* MIPS32 code. */
#define EF_MIPS_ARCH_64 0x60000000 /* MIPS64 code. */
+#define EF_MIPS_ARCH_32R2 0x70000000 /* MIPS32r2 code. */
+#define EF_MIPS_ARCH_64R2 0x80000000 /* MIPS64r2 code. */
+#define EF_MIPS_ARCH_32R6 0x90000000 /* MIPS32r6 code. */
+#define EF_MIPS_ARCH_64R6 0xa0000000 /* MIPS64r6 code. */
/* The ABI of a file. */
#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */
diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h
index bed0b43259..14b53d7469 100644
--- a/linux-user/mips/target_elf.h
+++ b/linux-user/mips/target_elf.h
@@ -9,6 +9,9 @@
#define MIPS_TARGET_ELF_H
static inline const char *cpu_get_model(uint32_t eflags)
{
+ if (eflags & EF_MIPS_ARCH_32R6) {
+ return "mips32r6-generic";
+ }
return "24Kf";
}
#endif
diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h
index 5b6f4692e0..ae14b38bfa 100644
--- a/linux-user/mips64/target_elf.h
+++ b/linux-user/mips64/target_elf.h
@@ -9,6 +9,9 @@
#define MIPS64_TARGET_ELF_H
static inline const char *cpu_get_model(uint32_t eflags)
{
+ if (eflags & EF_MIPS_ARCH_64R6) {
+ return "I6400";
+ }
return "5KEf";
}
#endif
--
2.14.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
` (7 preceding siblings ...)
2018-02-19 17:10 ` [Qemu-devel] [PULL 8/8] linux-user: MIPS set cpu to r6 CPU if binary is R6 Laurent Vivier
@ 2018-02-19 19:50 ` Peter Maydell
2018-02-20 9:13 ` Laurent Vivier
8 siblings, 1 reply; 11+ messages in thread
From: Peter Maydell @ 2018-02-19 19:50 UTC (permalink / raw)
To: Laurent Vivier; +Cc: QEMU Developers, Riku Voipio
On 19 February 2018 at 17:10, Laurent Vivier <laurent@vivier.eu> wrote:
> The following changes since commit f0fa81767555fe2c4b5f8c9e0725a80eac1d7f56:
>
> cuda.h: Fix multiple typedef (2018-02-16 18:38:21 +0000)
>
> are available in the Git repository at:
>
> git://github.com/vivier/qemu.git tags/linux-user-for-2.12-pull-request
>
> for you to fetch changes up to f352a021329f73d0219018cdfb39369687e8cadd:
>
> linux-user: MIPS set cpu to r6 CPU if binary is R6 (2018-02-18 18:52:32 +0100)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------
Hi. This breaks one of my linux-user smoke tests:
/home/petmay01/linaro/qemu-for-merges/build/all-linux-static/sparc32plus-linux-user/qemu-sparc32plus
-L ./gnemul/qemu-sparc sparc/ls -l dummyfile
unable to find CPU model 'Fujitsu MB86904'
This is because the include path for linux-user picks the
guest-architecture subdirectory for the TARGET_ABI_DIR,
which for sparc32plus is "sparc", but the set of CPUs compiled
in depends on the TARGET_ARCH, which is "sparc64", and
sparc64 doesn't include that 32-bit Fujitsu CPU.
The linux-user/sparc/target_elf.h needs to have code to handle
both the pure-32-bit and 32-bit-ABI-on-64-bit-CPU cases,
the same way that linux-user/ppc/target_elf.h does.
thanks
-- PMM
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches
2018-02-19 19:50 ` [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Peter Maydell
@ 2018-02-20 9:13 ` Laurent Vivier
0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2018-02-20 9:13 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Riku Voipio
Le 19/02/2018 à 20:50, Peter Maydell a écrit :
> On 19 February 2018 at 17:10, Laurent Vivier <laurent@vivier.eu> wrote:
>> The following changes since commit f0fa81767555fe2c4b5f8c9e0725a80eac1d7f56:
>>
>> cuda.h: Fix multiple typedef (2018-02-16 18:38:21 +0000)
>>
>> are available in the Git repository at:
>>
>> git://github.com/vivier/qemu.git tags/linux-user-for-2.12-pull-request
>>
>> for you to fetch changes up to f352a021329f73d0219018cdfb39369687e8cadd:
>>
>> linux-user: MIPS set cpu to r6 CPU if binary is R6 (2018-02-18 18:52:32 +0100)
>>
>> ----------------------------------------------------------------
>>
>> ----------------------------------------------------------------
>
> Hi. This breaks one of my linux-user smoke tests:
>
> /home/petmay01/linaro/qemu-for-merges/build/all-linux-static/sparc32plus-linux-user/qemu-sparc32plus
> -L ./gnemul/qemu-sparc sparc/ls -l dummyfile
> unable to find CPU model 'Fujitsu MB86904'
>
> This is because the include path for linux-user picks the
> guest-architecture subdirectory for the TARGET_ABI_DIR,
> which for sparc32plus is "sparc", but the set of CPUs compiled
> in depends on the TARGET_ARCH, which is "sparc64", and
> sparc64 doesn't include that 32-bit Fujitsu CPU.
> The linux-user/sparc/target_elf.h needs to have code to handle
> both the pure-32-bit and 32-bit-ABI-on-64-bit-CPU cases,
> the same way that linux-user/ppc/target_elf.h does.
Thank you Peter,
I'm going to remove the 4 last patches from the pull request and resend it.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-02-20 9:13 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-19 17:10 [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 1/8] linux-user: Implement ioctl cmd TIOCGPTPEER Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 2/8] linux-user: Fix register used for 6th and 7th syscall argument on aarch64 Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 3/8] linux-user: Fix sched_getaffinity mask size Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 4/8] linux-user: Remove THREAD macro Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 5/8] linux-user: Move CPU type name selection to a function Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 6/8] linux-user: introduce functions to detect CPU type Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 7/8] linux-user, m68k: select CPU according to ELF header values Laurent Vivier
2018-02-19 17:10 ` [Qemu-devel] [PULL 8/8] linux-user: MIPS set cpu to r6 CPU if binary is R6 Laurent Vivier
2018-02-19 19:50 ` [Qemu-devel] [PULL 0/8] Linux user for 2.12 patches Peter Maydell
2018-02-20 9:13 ` Laurent Vivier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).