From patchwork Tue Aug 14 19:45:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 957716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41qjlp23xLz9sBq for ; Wed, 15 Aug 2018 05:46:44 +1000 (AEST) Received: from localhost ([::1]:46091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpfH7-00029o-Jd for incoming@patchwork.ozlabs.org; Tue, 14 Aug 2018 15:46:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpfGR-00028K-Kk for qemu-devel@nongnu.org; Tue, 14 Aug 2018 15:46:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpfGC-0007L0-2R for qemu-devel@nongnu.org; Tue, 14 Aug 2018 15:45:59 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:43433) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fpfGB-0007JQ-Li for qemu-devel@nongnu.org; Tue, 14 Aug 2018 15:45:43 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MYekE-1fKKro0O4Q-00VSe6; Tue, 14 Aug 2018 21:45:30 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 14 Aug 2018 21:45:19 +0200 Message-Id: <20180814194520.22458-1-laurent@vivier.eu> X-Mailer: git-send-email 2.17.1 X-Provags-ID: V03:K1:XIogc7fqhEula/O9ON51XArDIgRUWFoIvIivqdSJaMQkuXqXLtk ycjzjWs2MbysPZKX/MY1ksGM6Ptj1c7Eje6z5WsrXY3XiQoyRKTs3qIO0jRC9x7KbHxWqbG pha2+P8MQO3P3KBvqXRmZ6kvNBI7AqU/rEbBuzECa/CBgDXmlE3mlXrbRgWzXP0gEnI9TKD iVxKSZ3wmZuMyQO1QdFtA== X-UI-Out-Filterresults: notjunk:1; V01:K0:UUt1swWRnPA=:jsEQiRPy/2qmKTmg13m9k9 lAuhuCuwr4pw5tSA9iuNICdk4IOAktVKUSiqoZSmu6Y4EhtBwgivO0zGtLlrzfKgK6bz0Nf50 44IxEris9btiPVvFsIEIM7ED/p9JAZx01IjQ82FZC476br6QP7rIU7mNx60CI3+oCerkYeLAR tOI6Rc55pcdxQ/Zbyw+8/KGohkECoA8ZSlbyi69vhnTtOPRxtgcOZy+lyT6KhphqMqqQZlqVH +q8UYAsW7I3CMS9AqIBtVJF/2twyuA7W1udlfSVnf6NsdgCHCB67clW/9HhU2p8We2hWYdyzM G2kQkDbAGn50e2RU5WCV0IGycltuKAsZfAFR/p2NcFpvLlPIUfIsNAVZoyj3irUzm827KgAH2 U6lvMRU1FKM5bAzEG5+UiXDydUR34hcEH0cl6bqgi1LBRd59RiI4vHj93GJ5bez8kh6SdCl80 uxS6+DZn1csb2FmWrs16Z/ScINjmCHhZC+uIXnTFADCS+Kj2VbxuMiNu5HtgssUycpcKw3ebm TNjgrMpTJNdk6C+fe4wEtPwcUZro4McG5H/2LMYFXFoGHNp6ku8d/PQrQoNTKBllO2ZuM89/3 SZveCoYMa81iTY7Y7HzlpaArOhJ/fwAYwHNFzdOKUJm2EJrx8f2747MKI43oc/wex+lzVWrU8 OHvMAsqx0gsaPTJ4FCFADsIV2jpwG61xpKa4l2mgTRI5FMbMGkyrUjD2fft2xa+vjbUo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.10 Subject: [Qemu-devel] [PATCH 1/2] linux-user: add pseudo /proc/cpuinfo for sparc X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , Laurent Vivier Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" SPARC libc6 debian package wants to check the cpu level to be installed or not: WARNING: This machine has a SPARC V8 or earlier class processor. Debian lenny and later does not support such old hardware any longer. To avoid this, it only needs to know if the machine type is sun4u or sun4v, for that it reads the information from /proc/cpuinfo. Fixes: 9a93c152fcdb4ab2cd85094487b33578fd693915 ("linux-user: fix UNAME_MACHINE for sparc/sparc64") Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index dfc851cc35..5850aba5be 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7745,12 +7745,15 @@ static int is_proc_myself(const char *filename, const char *entry) return 0; } -#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) +#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) || \ + defined(TARGET_SPARC) static int is_proc(const char *filename, const char *entry) { return strcmp(filename, entry) == 0; } +#endif +#if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) static int open_net_route(void *cpu_env, int fd) { FILE *fp; @@ -7789,6 +7792,14 @@ static int open_net_route(void *cpu_env, int fd) } #endif +#if defined(TARGET_SPARC) +static int open_cpuinfo(void *cpu_env, int fd) +{ + dprintf(fd, "type\t\t: sun4u\n"); + return 0; +} +#endif + static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, mode_t mode) { struct fake_open { @@ -7804,6 +7815,9 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags, { "cmdline", open_self_cmdline, is_proc_myself }, #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN) { "/proc/net/route", open_net_route, is_proc }, +#endif +#if defined(TARGET_SPARC) + { "/proc/cpuinfo", open_cpuinfo, is_proc }, #endif { NULL, NULL, NULL } };