From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, Riku Voipio <riku.voipio@linaro.org>
Subject: [Qemu-devel] [PATCH 1/4] linux-user: rename cpu-uname -> uname
Date: Tue, 4 Mar 2014 05:21:58 +0200 [thread overview]
Message-ID: <1393903321-6352-2-git-send-email-riku.voipio@linaro.org> (raw)
From: Riku Voipio <riku.voipio@linaro.org>
To move more uname related functions out of syscall.c,
rename cpu-uname.{c,h} to uname.{c.h}
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
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 <http://www.gnu.org/licenses/>.
- */
-
-#include <stdio.h>
-
-#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 e2c10cc..234c3ea 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -109,7 +109,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#include <linux/filter.h>
#include <linux/blkpg.h>
#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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+
+#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);
--
1.8.1.2
reply other threads:[~2014-03-04 3:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393903321-6352-2-git-send-email-riku.voipio@linaro.org \
--to=riku.voipio@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).