aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-05-12 10:26:09 +0200
committerDavid 'Digit' Turner <digit@android.com>2011-06-01 17:08:19 +0200
commit406a59bd0a2e7a38cd840a5c08602e3a36bd2df8 (patch)
treee9dbb51e71a14aa9118f8e9c980d4722abb04fd8
parent288208c386810fef725aa448a9f46bd2772bec8c (diff)
downloadexternal_qemu-406a59bd0a2e7a38cd840a5c08602e3a36bd2df8.zip
external_qemu-406a59bd0a2e7a38cd840a5c08602e3a36bd2df8.tar.gz
external_qemu-406a59bd0a2e7a38cd840a5c08602e3a36bd2df8.tar.bz2
trace.h: rename to trace-android.h
This is done to allow for future integration of the upstream auto-generated "trace.h" header file. Change-Id: I9d1bba3320d9e8acfd7359540d3ed6695773061e
-rw-r--r--android-trace.h64
-rw-r--r--android-trace_common.h142
-rw-r--r--android/protocol/core-commands-impl.c2
-rw-r--r--android/protocol/core-commands-qemu.c2
-rw-r--r--hw/goldfish_trace.c2
-rw-r--r--target-arm/helper-android.c2
-rw-r--r--target-arm/helper.c2
-rw-r--r--target-arm/translate-android.h2
-rw-r--r--trace.c2
-rw-r--r--trace.h64
-rw-r--r--trace_common.h144
-rw-r--r--vl-android.c2
12 files changed, 217 insertions, 213 deletions
diff --git a/android-trace.h b/android-trace.h
new file mode 100644
index 0000000..2d0100d
--- /dev/null
+++ b/android-trace.h
@@ -0,0 +1,64 @@
+/* Copyright (C) 2006-2007 The Android Open Source Project
+**
+** This software is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, and
+** may be copied, distributed, and modified under those terms.
+**
+** 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.
+*/
+
+#ifndef TRACE_H
+#define TRACE_H
+
+#include <inttypes.h>
+#include "android-trace_common.h"
+
+extern uint64_t start_time, end_time;
+extern uint64_t elapsed_usecs;
+extern uint64_t Now();
+
+struct TranslationBlock;
+
+// The simulated time, in clock ticks, starting with one.
+extern uint64_t sim_time;
+extern uint64_t trace_static_bb_num(void);;
+
+// This variable == 1 if we are currently tracing, otherwise == 0.
+extern int tracing;
+extern int trace_all_addr;
+extern int trace_cache_miss;
+
+extern void start_tracing();
+extern void stop_tracing();
+extern void trace_init(const char *filename);
+extern void trace_bb_start(uint32_t bb_addr);
+extern void trace_add_insn(uint32_t insn, int is_thumb);
+extern void trace_bb_end();
+
+extern int get_insn_ticks_arm(uint32_t insn);
+extern int get_insn_ticks_thumb(uint32_t insn);
+
+extern void trace_exception(uint32_t pc);
+extern void trace_bb_helper(uint64_t bb_num, struct TranslationBlock *tb);
+extern void trace_insn_helper();
+extern void sim_dcache_load(uint32_t addr);
+extern void sim_dcache_store(uint32_t addr, uint32_t val);
+extern void sim_dcache_swp(uint32_t addr);
+extern void trace_interpreted_method(uint32_t addr, int call_type);
+
+extern const char *trace_filename;
+extern int tracing;
+extern int trace_cache_miss;
+extern int trace_all_addr;
+
+// Trace process/thread operations
+extern void trace_switch(int pid);
+extern void trace_fork(int tgid, int pid);
+extern void trace_clone(int tgid, int pid);
+extern void trace_exit(int exitcode);
+extern void trace_name(char *name);
+
+#endif /* TRACE_H */
diff --git a/android-trace_common.h b/android-trace_common.h
new file mode 100644
index 0000000..fe84c1a
--- /dev/null
+++ b/android-trace_common.h
@@ -0,0 +1,142 @@
+/* Copyright (C) 2006-2007 The Android Open Source Project
+**
+** This software is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, and
+** may be copied, distributed, and modified under those terms.
+**
+** 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.
+*/
+
+#ifndef TRACE_COMMON_H
+#define TRACE_COMMON_H
+
+#include <inttypes.h>
+
+// This should be the same as OPC_BUF_SIZE
+#define kMaxInsnPerBB 512
+
+#define kMaxNumBasicBlocks 1024
+
+#define kMaxNumAddrs 1024
+
+#define kInsnBufferSize 1024
+
+#define kCompressedSize 8192
+
+#define kMethodEnter 0
+#define kMethodExit 1
+#define kMethodException 2
+#define kNativeEnter 4
+#define kNativeExit 5
+#define kNativeException 6
+
+// The trace identifier string must be less than 16 characters.
+#define TRACE_IDENT "qemu_trace_file"
+#define TRACE_VERSION 2
+
+typedef struct TraceHeader {
+ char ident[16];
+ int version;
+ uint32_t start_sec;
+ uint32_t start_usec;
+ uint32_t pdate;
+ uint32_t ptime;
+ uint32_t num_used_pids; // number of distinct process ids used
+ int first_unused_pid; // -1 if all 32,768 pids are used (unlikely)
+ uint8_t padding[4]; // next field is 8-byte aligned
+ uint64_t num_static_bb;
+ uint64_t num_static_insn;
+ uint64_t num_dynamic_bb;
+ uint64_t num_dynamic_insn;
+ uint64_t elapsed_usecs;
+} TraceHeader;
+
+typedef struct BBRec {
+ uint64_t start_time; // time of first occurrence
+ uint64_t bb_num; // basic block number
+ uint32_t repeat; // repeat count (= 0 if just one occurrence)
+ uint64_t time_diff; // diff from previous time (if repeat > 0)
+} BBRec;
+
+// Define a trace record for addresses that miss in the cache
+typedef struct AddrRec {
+ uint64_t time;
+ uint32_t addr;
+} AddrRec;
+
+// Define a trace record for the start time of each instruction
+typedef struct InsnRec {
+ uint64_t time_diff; // time difference from last instruction
+ uint32_t repeat; // repeat count
+} InsnRec;
+
+// Define record types for process id changes.
+#define kPidEndOfFile 0
+#define kPidFork 1
+#define kPidClone 2
+#define kPidSwitch 3
+#define kPidExec 4
+#define kPidMmap 5
+#define kPidExit 6
+#define kPidKthreadName 7
+#define kPidSymbolAdd 8
+#define kPidSymbolRemove 9
+#define kPidMunmap 10
+#define kPidNoAction 11
+#define kPidName 12
+
+#define bswap16(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
+
+#define bswap32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
+ | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff))
+
+#define bswap64(x) (((x) << 56) | (((x) & 0xff00) << 40) \
+ | (((x) & 0xff0000) << 24) | (((x) & 0xff000000ull) << 8) \
+ | (((x) >> 8) & 0xff000000ull) | (((x) >> 24) & 0xff0000) \
+ | (((x) >> 40) & 0xff00) | ((x) >> 56))
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define hostToLE16(x) (x)
+#define hostToLE32(x) (x)
+#define hostToLE64(x) (x)
+#define LE16ToHost(x) (x)
+#define LE32ToHost(x) (x)
+#define LE64ToHost(x) (x)
+#define convert16(x)
+#define convert32(x)
+#define convert64(x)
+#else
+#define hostToLE16(x) bswap16(x)
+#define hostToLE32(x) bswap32(x)
+#define hostToLE64(x) bswap64(x)
+#define LE16ToHost(x) bswap16(x)
+#define LE32ToHost(x) bswap32(x)
+#define LE64ToHost(x) bswap64(x)
+#define convert16(x) (x = bswap16(x))
+#define convert32(x) (x = bswap32(x))
+#define convert64(x) (x = bswap64(x))
+#endif
+
+/* XXX: we wrap 16-bit thumb instructions into 32-bit undefined ARM instructions
+ * for simplicity reasons. See section 3.13.1 section of the ARM ARM for details
+ * on the undefined instruction space we're using
+ */
+static __inline__ int insn_is_thumb(uint32_t insn)
+{
+ return ((insn & 0xfff000f0) == 0xf7f000f0);
+}
+
+static __inline__ uint32_t insn_wrap_thumb(uint32_t insn)
+{
+ return 0xf7f000f0 | ((insn & 0xfff0) << 4) | (insn & 0x000f);
+}
+
+static __inline__ uint32_t insn_unwrap_thumb(uint32_t insn)
+{
+ return ((insn >> 4) & 0xfff0) | (insn & 0x000f);
+}
+
+#endif /* TRACE_COMMON_H */
diff --git a/android/protocol/core-commands-impl.c b/android/protocol/core-commands-impl.c
index 4366529..bf6da15 100644
--- a/android/protocol/core-commands-impl.c
+++ b/android/protocol/core-commands-impl.c
@@ -19,7 +19,7 @@
#include "android/android.h"
#include "android/globals.h"
#include "telephony/modem_driver.h"
-#include "trace.h"
+#include "android-trace.h"
#include "android/looper.h"
#include "android/async-utils.h"
#include "android/sync-utils.h"
diff --git a/android/protocol/core-commands-qemu.c b/android/protocol/core-commands-qemu.c
index 03fef64..76b3abb 100644
--- a/android/protocol/core-commands-qemu.c
+++ b/android/protocol/core-commands-qemu.c
@@ -19,7 +19,7 @@
#include "android/globals.h"
#include "android/hw-sensors.h"
#include "telephony/modem_driver.h"
-#include "trace.h"
+#include "android-trace.h"
#include "audio/audio.h"
#include "android/protocol/core-commands-api.h"
diff --git a/hw/goldfish_trace.c b/hw/goldfish_trace.c
index 02f9b8d..9eeb2a4 100644
--- a/hw/goldfish_trace.c
+++ b/hw/goldfish_trace.c
@@ -16,7 +16,7 @@
#include "qemu_file.h"
#include "goldfish_trace.h"
#include "sysemu.h"
-#include "trace.h"
+#include "android-trace.h"
#ifdef CONFIG_MEMCHECK
#include "memcheck/memcheck.h"
#include "memcheck/memcheck_util.h"
diff --git a/target-arm/helper-android.c b/target-arm/helper-android.c
index af9d14b..8c203d4 100644
--- a/target-arm/helper-android.c
+++ b/target-arm/helper-android.c
@@ -10,7 +10,7 @@
#include "qemu-common.h"
#ifdef CONFIG_TRACE
-#include "trace.h"
+#include "android-trace.h"
void HELPER(traceTicks)(uint32_t ticks)
{
diff --git a/target-arm/helper.c b/target-arm/helper.c
index c69751f..154aa46 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -8,7 +8,7 @@
#include "helpers.h"
#include "qemu-common.h"
#ifdef CONFIG_TRACE
-#include "trace.h"
+#include "android-trace.h"
#endif
static uint32_t cortexa8_cp15_c0_c1[8] =
diff --git a/target-arm/translate-android.h b/target-arm/translate-android.h
index a09931f..274c876 100644
--- a/target-arm/translate-android.h
+++ b/target-arm/translate-android.h
@@ -277,7 +277,7 @@ set_on_ret(target_ulong ret)
#ifdef CONFIG_TRACE
-#include "trace.h"
+#include "android-trace.h"
#define gen_traceInsn() gen_helper_traceInsn()
static void
diff --git a/trace.c b/trace.c
index 74c94d5..caf5878 100644
--- a/trace.c
+++ b/trace.c
@@ -22,7 +22,7 @@
#include <time.h>
#include "cpu.h"
#include "exec-all.h"
-#include "trace.h"
+#include "android-trace.h"
#include "varint.h"
#include "android/utils/path.h"
diff --git a/trace.h b/trace.h
index 81b622f..e69de29 100644
--- a/trace.h
+++ b/trace.h
@@ -1,64 +0,0 @@
-/* Copyright (C) 2006-2007 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** 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.
-*/
-
-#ifndef TRACE_H
-#define TRACE_H
-
-#include <inttypes.h>
-#include "trace_common.h"
-
-extern uint64_t start_time, end_time;
-extern uint64_t elapsed_usecs;
-extern uint64_t Now();
-
-struct TranslationBlock;
-
-// The simulated time, in clock ticks, starting with one.
-extern uint64_t sim_time;
-extern uint64_t trace_static_bb_num(void);;
-
-// This variable == 1 if we are currently tracing, otherwise == 0.
-extern int tracing;
-extern int trace_all_addr;
-extern int trace_cache_miss;
-
-extern void start_tracing();
-extern void stop_tracing();
-extern void trace_init(const char *filename);
-extern void trace_bb_start(uint32_t bb_addr);
-extern void trace_add_insn(uint32_t insn, int is_thumb);
-extern void trace_bb_end();
-
-extern int get_insn_ticks_arm(uint32_t insn);
-extern int get_insn_ticks_thumb(uint32_t insn);
-
-extern void trace_exception(uint32_t pc);
-extern void trace_bb_helper(uint64_t bb_num, struct TranslationBlock *tb);
-extern void trace_insn_helper();
-extern void sim_dcache_load(uint32_t addr);
-extern void sim_dcache_store(uint32_t addr, uint32_t val);
-extern void sim_dcache_swp(uint32_t addr);
-extern void trace_interpreted_method(uint32_t addr, int call_type);
-
-extern const char *trace_filename;
-extern int tracing;
-extern int trace_cache_miss;
-extern int trace_all_addr;
-
-// Trace process/thread operations
-extern void trace_switch(int pid);
-extern void trace_fork(int tgid, int pid);
-extern void trace_clone(int tgid, int pid);
-extern void trace_exit(int exitcode);
-extern void trace_name(char *name);
-
-#endif /* TRACE_H */
diff --git a/trace_common.h b/trace_common.h
index fe84c1a..b2a2188 100644
--- a/trace_common.h
+++ b/trace_common.h
@@ -1,142 +1,4 @@
-/* Copyright (C) 2006-2007 The Android Open Source Project
-**
-** This software is licensed under the terms of the GNU General Public
-** License version 2, as published by the Free Software Foundation, and
-** may be copied, distributed, and modified under those terms.
-**
-** 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.
-*/
-
-#ifndef TRACE_COMMON_H
-#define TRACE_COMMON_H
-
-#include <inttypes.h>
-
-// This should be the same as OPC_BUF_SIZE
-#define kMaxInsnPerBB 512
-
-#define kMaxNumBasicBlocks 1024
-
-#define kMaxNumAddrs 1024
-
-#define kInsnBufferSize 1024
-
-#define kCompressedSize 8192
-
-#define kMethodEnter 0
-#define kMethodExit 1
-#define kMethodException 2
-#define kNativeEnter 4
-#define kNativeExit 5
-#define kNativeException 6
-
-// The trace identifier string must be less than 16 characters.
-#define TRACE_IDENT "qemu_trace_file"
-#define TRACE_VERSION 2
-
-typedef struct TraceHeader {
- char ident[16];
- int version;
- uint32_t start_sec;
- uint32_t start_usec;
- uint32_t pdate;
- uint32_t ptime;
- uint32_t num_used_pids; // number of distinct process ids used
- int first_unused_pid; // -1 if all 32,768 pids are used (unlikely)
- uint8_t padding[4]; // next field is 8-byte aligned
- uint64_t num_static_bb;
- uint64_t num_static_insn;
- uint64_t num_dynamic_bb;
- uint64_t num_dynamic_insn;
- uint64_t elapsed_usecs;
-} TraceHeader;
-
-typedef struct BBRec {
- uint64_t start_time; // time of first occurrence
- uint64_t bb_num; // basic block number
- uint32_t repeat; // repeat count (= 0 if just one occurrence)
- uint64_t time_diff; // diff from previous time (if repeat > 0)
-} BBRec;
-
-// Define a trace record for addresses that miss in the cache
-typedef struct AddrRec {
- uint64_t time;
- uint32_t addr;
-} AddrRec;
-
-// Define a trace record for the start time of each instruction
-typedef struct InsnRec {
- uint64_t time_diff; // time difference from last instruction
- uint32_t repeat; // repeat count
-} InsnRec;
-
-// Define record types for process id changes.
-#define kPidEndOfFile 0
-#define kPidFork 1
-#define kPidClone 2
-#define kPidSwitch 3
-#define kPidExec 4
-#define kPidMmap 5
-#define kPidExit 6
-#define kPidKthreadName 7
-#define kPidSymbolAdd 8
-#define kPidSymbolRemove 9
-#define kPidMunmap 10
-#define kPidNoAction 11
-#define kPidName 12
-
-#define bswap16(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
-
-#define bswap32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
- | (((x) >> 8) & 0xff00) | (((x) >> 24) & 0xff))
-
-#define bswap64(x) (((x) << 56) | (((x) & 0xff00) << 40) \
- | (((x) & 0xff0000) << 24) | (((x) & 0xff000000ull) << 8) \
- | (((x) >> 8) & 0xff000000ull) | (((x) >> 24) & 0xff0000) \
- | (((x) >> 40) & 0xff00) | ((x) >> 56))
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define hostToLE16(x) (x)
-#define hostToLE32(x) (x)
-#define hostToLE64(x) (x)
-#define LE16ToHost(x) (x)
-#define LE32ToHost(x) (x)
-#define LE64ToHost(x) (x)
-#define convert16(x)
-#define convert32(x)
-#define convert64(x)
-#else
-#define hostToLE16(x) bswap16(x)
-#define hostToLE32(x) bswap32(x)
-#define hostToLE64(x) bswap64(x)
-#define LE16ToHost(x) bswap16(x)
-#define LE32ToHost(x) bswap32(x)
-#define LE64ToHost(x) bswap64(x)
-#define convert16(x) (x = bswap16(x))
-#define convert32(x) (x = bswap32(x))
-#define convert64(x) (x = bswap64(x))
-#endif
-
-/* XXX: we wrap 16-bit thumb instructions into 32-bit undefined ARM instructions
- * for simplicity reasons. See section 3.13.1 section of the ARM ARM for details
- * on the undefined instruction space we're using
+/* This file should be removed once we update the Android qtools to
+ * include 'android-trace_common.h' directly.
*/
-static __inline__ int insn_is_thumb(uint32_t insn)
-{
- return ((insn & 0xfff000f0) == 0xf7f000f0);
-}
-
-static __inline__ uint32_t insn_wrap_thumb(uint32_t insn)
-{
- return 0xf7f000f0 | ((insn & 0xfff0) << 4) | (insn & 0x000f);
-}
-
-static __inline__ uint32_t insn_unwrap_thumb(uint32_t insn)
-{
- return ((insn >> 4) & 0xfff0) | (insn & 0x000f);
-}
-
-#endif /* TRACE_COMMON_H */
+#include "android-trace_common.h"
diff --git a/vl-android.c b/vl-android.c
index 374488a..8436d68 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -224,7 +224,7 @@ extern void android_emulator_set_base_port(int port);
#include "disas.h"
#ifdef CONFIG_TRACE
-#include "trace.h"
+#include "android-trace.h"
#endif
#include "qemu_socket.h"