From patchwork Fri May 2 19:15:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 29576 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EAE63203F3 for ; Fri, 2 May 2014 19:19:42 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id m1sf14840955oag.2 for ; Fri, 02 May 2014 12:19:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=KbMET6djVcGjeJ4QrTui5QeEqW6JprNwxPUKiYB3I+A=; b=YCNvMW82QDCewNSumHlW72PayNDhDPJYjp4ZZDBjkCvb6m+FidmZGR5rKQ21lrHSgQ 8pI6AwDFBW90X7QqSbXJGtLILivvF0r2hMo0OpaqlxF52d5gxgOSHI19MMB6Is0EwcOZ TgVVsC2UeUGEQ88n4v7pg/Lo0ubywXHlPaq5+WC0IWfe/EIUrItpGWQYQAl76C6OLK4H kapzh2b5oGw6xWgAWnzS7B6cRl3LGVdMYr3VgDG+KK5EvNTrPO/ZWBMsxR7pczP+sS0s VCHJyjBdA7+cXQlo9vuudt4hLfYYJGuSW5RdMgq+GPbPATwa2QOhQK5FUgp2WUe9VjCN 9sKg== X-Gm-Message-State: ALoCoQm+0SIOZH7lOPn1FdRCj7IZyMPm1mOZ9qfTc85mUyJbWy0AuQeotPdNh/OYAp+Hy4wqJXN6 X-Received: by 10.42.62.11 with SMTP id w11mr8597933ich.29.1399058382505; Fri, 02 May 2014 12:19:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls1715258qgf.48.gmail; Fri, 02 May 2014 12:19:42 -0700 (PDT) X-Received: by 10.58.74.201 with SMTP id w9mr997073vev.56.1399058382312; Fri, 02 May 2014 12:19:42 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id f17si6933339vco.27.2014.05.02.12.19.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 May 2014 12:19:42 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ib6so5785125vcb.5 for ; Fri, 02 May 2014 12:19:42 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr12339139vdb.20.1399058382233; Fri, 02 May 2014 12:19:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp125947vcb; Fri, 2 May 2014 12:19:41 -0700 (PDT) X-Received: by 10.140.39.227 with SMTP id v90mr23716305qgv.35.1399058381240; Fri, 02 May 2014 12:19:41 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g32si8424475qge.54.2014.05.02.12.19.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 02 May 2014 12:19:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:45973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIzk-0004g7-Lb for patch@linaro.org; Fri, 02 May 2014 15:19:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIwD-000827-M4 for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgIw5-0000Bv-Ft for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:01 -0400 Received: from afflict.kos.to ([92.243.29.197]:48077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIw5-00009h-4H for qemu-devel@nongnu.org; Fri, 02 May 2014 15:15:53 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id EA848264D0; Fri, 2 May 2014 21:15:50 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 2 May 2014 22:15:43 +0300 Message-Id: <18cb008865d078c30f8efcd28c774788ae13d6a3.1399057853.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Riku Voipio Subject: [Qemu-devel] =?utf-8?q?=5BPULL_08/14=5D_linux-user=3A_rename_cpu-?= =?utf-8?q?uname_-=3E_uname?= X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Riku Voipio To move more uname related functions out of syscall.c, rename cpu-uname.{c,h} to uname.{c.h} Signed-off-by: Riku Voipio --- linux-user/Makefile.objs | 2 +- linux-user/cpu-uname.c | 72 ------------------------------------------------ linux-user/cpu-uname.h | 1 - linux-user/syscall.c | 2 +- linux-user/uname.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ linux-user/uname.h | 1 + 6 files changed, 75 insertions(+), 75 deletions(-) delete mode 100644 linux-user/cpu-uname.c delete mode 100644 linux-user/cpu-uname.h create mode 100644 linux-user/uname.c create mode 100644 linux-user/uname.h diff --git a/linux-user/Makefile.objs b/linux-user/Makefile.objs index 5899d72..fd50217 100644 --- a/linux-user/Makefile.objs +++ b/linux-user/Makefile.objs @@ -1,5 +1,5 @@ obj-y = main.o syscall.o strace.o mmap.o signal.o \ - elfload.o linuxload.o uaccess.o cpu-uname.o + elfload.o linuxload.o uaccess.o uname.o obj-$(TARGET_HAS_BFLT) += flatload.o obj-$(TARGET_I386) += vm86.o diff --git a/linux-user/cpu-uname.c b/linux-user/cpu-uname.c deleted file mode 100644 index 5db6e89..0000000 --- a/linux-user/cpu-uname.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * cpu to uname machine name map - * - * Copyright (c) 2009 Loïc Minier - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include - -#include "qemu.h" -//#include "qemu-common.h" -#include "cpu-uname.h" - -/* return highest utsname machine name for emulated instruction set - * - * NB: the default emulated CPU ("any") might not match any existing CPU, e.g. - * on ARM it has all features turned on, so there is no perfect arch string to - * return here */ -const char *cpu_to_uname_machine(void *cpu_env) -{ -#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) - - /* utsname machine name on linux arm is CPU arch name + endianness, e.g. - * armv7l; to get a list of CPU arch names from the linux source, use: - * grep arch_name: -A1 linux/arch/arm/mm/proc-*.S - * see arch/arm/kernel/setup.c: setup_processor() - */ - - /* in theory, endianness is configurable on some ARM CPUs, but this isn't - * used in user mode emulation */ -#ifdef TARGET_WORDS_BIGENDIAN -#define utsname_suffix "b" -#else -#define utsname_suffix "l" -#endif - if (arm_feature(cpu_env, ARM_FEATURE_V7)) - return "armv7" utsname_suffix; - if (arm_feature(cpu_env, ARM_FEATURE_V6)) - return "armv6" utsname_suffix; - /* earliest emulated CPU is ARMv5TE; qemu can emulate the 1026, but not its - * Jazelle support */ - return "armv5te" utsname_suffix; -#elif defined(TARGET_X86_64) - return "x86-64"; -#elif defined(TARGET_I386) - /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */ - CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env); - int family = object_property_get_int(OBJECT(cpu), "family", NULL); - if (family == 4) { - return "i486"; - } - if (family == 5) { - return "i586"; - } - return "i686"; -#else - /* default is #define-d in each arch/ subdir */ - return UNAME_MACHINE; -#endif -} diff --git a/linux-user/cpu-uname.h b/linux-user/cpu-uname.h deleted file mode 100644 index 32492de..0000000 --- a/linux-user/cpu-uname.h +++ /dev/null @@ -1 +0,0 @@ -const char *cpu_to_uname_machine(void *cpu_env); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index af0bb35..0f4a092 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -110,7 +110,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, #include #include #include "linux_loop.h" -#include "cpu-uname.h" +#include "uname.h" #include "qemu.h" diff --git a/linux-user/uname.c b/linux-user/uname.c new file mode 100644 index 0000000..26e90e5 --- /dev/null +++ b/linux-user/uname.c @@ -0,0 +1,72 @@ +/* + * cpu to uname machine name map + * + * Copyright (c) 2009 Loïc Minier + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include + +#include "qemu.h" +//#include "qemu-common.h" +#include "uname.h" + +/* return highest utsname machine name for emulated instruction set + * + * NB: the default emulated CPU ("any") might not match any existing CPU, e.g. + * on ARM it has all features turned on, so there is no perfect arch string to + * return here */ +const char *cpu_to_uname_machine(void *cpu_env) +{ +#if defined(TARGET_ARM) && !defined(TARGET_AARCH64) + + /* utsname machine name on linux arm is CPU arch name + endianness, e.g. + * armv7l; to get a list of CPU arch names from the linux source, use: + * grep arch_name: -A1 linux/arch/arm/mm/proc-*.S + * see arch/arm/kernel/setup.c: setup_processor() + */ + + /* in theory, endianness is configurable on some ARM CPUs, but this isn't + * used in user mode emulation */ +#ifdef TARGET_WORDS_BIGENDIAN +#define utsname_suffix "b" +#else +#define utsname_suffix "l" +#endif + if (arm_feature(cpu_env, ARM_FEATURE_V7)) + return "armv7" utsname_suffix; + if (arm_feature(cpu_env, ARM_FEATURE_V6)) + return "armv6" utsname_suffix; + /* earliest emulated CPU is ARMv5TE; qemu can emulate the 1026, but not its + * Jazelle support */ + return "armv5te" utsname_suffix; +#elif defined(TARGET_X86_64) + return "x86-64"; +#elif defined(TARGET_I386) + /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */ + CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env); + int family = object_property_get_int(OBJECT(cpu), "family", NULL); + if (family == 4) { + return "i486"; + } + if (family == 5) { + return "i586"; + } + return "i686"; +#else + /* default is #define-d in each arch/ subdir */ + return UNAME_MACHINE; +#endif +} diff --git a/linux-user/uname.h b/linux-user/uname.h new file mode 100644 index 0000000..32492de --- /dev/null +++ b/linux-user/uname.h @@ -0,0 +1 @@ +const char *cpu_to_uname_machine(void *cpu_env);