From efe6efeb8474c03a9ea6686155cc5dbce135c99d Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Tue, 27 Dec 2016 20:38:30 +0800 Subject: [PATCH 1/4] Capitalize --- windows_export.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/windows_export.bat b/windows_export.bat index 4ff67fba..ebed5106 100644 --- a/windows_export.bat +++ b/windows_export.bat @@ -1,16 +1,16 @@ @echo on -:: This script invokes the visual studio linker to construct a static library file that can be used outside of mingw. -:: The unicorn.def file that it references below is produced by the mingw compiler via a linker flag. +:: This script invokes the Visual Studio linker to construct a static library file that can be used outside of Mingw. +:: The unicorn.def file that it references below is produced by the Mingw compiler via a linker flag. :: The arch (x86 or x64) we are working on should be passed via the first argument to this script. :: Look up the Visual Studio install path via the registry :: http://stackoverflow.com/questions/445167/how-can-i-get-the-value-of-a-registry-key-from-within-a-batch-script -:: If anyone ever tells you that windows is a reasonable operating system, they are wrong +:: If anyone ever tells you that Windows is a reasonable operating system, they are wrong FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\12.0" /v InstallDir`) DO ( set appdir=%%A %%B ) -:: Add the visual studio binaries to our path and run the linker +:: Add the Visual Studio binaries to our path and run the linker call "%appdir%..\..\VC\vcvarsall.bat" %1 call lib /machine:%1 /def:unicorn.def From 428cb83060203747048fd4d6e195d6ddbc127f04 Mon Sep 17 00:00:00 2001 From: cojocar Date: Tue, 27 Dec 2016 15:49:06 +0100 Subject: [PATCH 2/4] Support for MCLASS ARM cpu (Cortex-M3) (#700) Support for Cortex-M ARM CPU already exists in Qemu. This patch just exposes a "cortex-m3" CPU. "uc_open(UC_ARCH_ARM, UC_MODE_THUMB | UC_MODE_MCLASS, &uc);" Instantiates a CPU with this feature on. Signed-off-by: Lucian Cojocar --- include/uc_priv.h | 2 +- qemu/hw/arm/tosa.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/uc_priv.h b/include/uc_priv.h index df22a50c..ccb72d56 100644 --- a/include/uc_priv.h +++ b/include/uc_priv.h @@ -13,7 +13,7 @@ // These are masks of supported modes for each cpu/arch. // They should be updated when changes are made to the uc_mode enum typedef. -#define UC_MODE_ARM_MASK (UC_MODE_ARM|UC_MODE_THUMB|UC_MODE_LITTLE_ENDIAN) +#define UC_MODE_ARM_MASK (UC_MODE_ARM|UC_MODE_THUMB|UC_MODE_LITTLE_ENDIAN|UC_MODE_MCLASS) #define UC_MODE_MIPS_MASK (UC_MODE_MIPS32|UC_MODE_MIPS64|UC_MODE_LITTLE_ENDIAN|UC_MODE_BIG_ENDIAN) #define UC_MODE_X86_MASK (UC_MODE_16|UC_MODE_32|UC_MODE_64|UC_MODE_LITTLE_ENDIAN) #define UC_MODE_PPC_MASK (UC_MODE_PPC64|UC_MODE_BIG_ENDIAN) diff --git a/qemu/hw/arm/tosa.c b/qemu/hw/arm/tosa.c index 607878ac..f6649f45 100644 --- a/qemu/hw/arm/tosa.c +++ b/qemu/hw/arm/tosa.c @@ -19,8 +19,11 @@ static int tosa_init(struct uc_struct *uc, MachineState *machine) { - //cpu_arm_init(uc, "pxa255"); - uc->cpu = (CPUState *)cpu_arm_init(uc, "cortex-a15"); // FIXME + if (uc->mode & UC_MODE_MCLASS) { + uc->cpu = (CPUState *)cpu_arm_init(uc, "cortex-m3"); + } else { + uc->cpu = (CPUState *)cpu_arm_init(uc, "cortex-a15"); + } return 0; } From 1a222e8904d8b7737479a96e754a33b45a348d68 Mon Sep 17 00:00:00 2001 From: danghvu Date: Tue, 27 Dec 2016 22:23:06 -0600 Subject: [PATCH 3/4] translate-all.c: make code_bitmap 64-bit, fix issue #646 --- qemu/translate-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/translate-all.c b/qemu/translate-all.c index 4f10c633..90fcc89b 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -81,7 +81,7 @@ typedef struct PageDesc { /* in order to optimize self modifying code, we count the number of lookups we do to a given page to use a bitmap */ unsigned int code_write_count; - uint8_t *code_bitmap; + unsigned long *code_bitmap; #if defined(CONFIG_USER_ONLY) unsigned long flags; #endif @@ -1033,7 +1033,7 @@ void tb_phys_invalidate(struct uc_struct *uc, tcg_ctx->tb_ctx.tb_phys_invalidate_count++; } -static inline void set_bits(uint8_t *tab, int start, int len) +static inline void set_bits(unsigned long *tab, int start, int len) { int end, mask, end1; From a97f9082810636fd9a511a0955b73d97afee10f8 Mon Sep 17 00:00:00 2001 From: danghvu Date: Tue, 27 Dec 2016 23:28:47 -0600 Subject: [PATCH 4/4] Revert "translate-all.c: make code_bitmap 64-bit, fix issue #646" This reverts commit 1a222e8904d8b7737479a96e754a33b45a348d68. This issue shall be fixed when sync with upstream. --- qemu/translate-all.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qemu/translate-all.c b/qemu/translate-all.c index 90fcc89b..4f10c633 100644 --- a/qemu/translate-all.c +++ b/qemu/translate-all.c @@ -81,7 +81,7 @@ typedef struct PageDesc { /* in order to optimize self modifying code, we count the number of lookups we do to a given page to use a bitmap */ unsigned int code_write_count; - unsigned long *code_bitmap; + uint8_t *code_bitmap; #if defined(CONFIG_USER_ONLY) unsigned long flags; #endif @@ -1033,7 +1033,7 @@ void tb_phys_invalidate(struct uc_struct *uc, tcg_ctx->tb_ctx.tb_phys_invalidate_count++; } -static inline void set_bits(unsigned long *tab, int start, int len) +static inline void set_bits(uint8_t *tab, int start, int len) { int end, mask, end1;