aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-09-20 13:10:19 -0700
committerDavid 'Digit' Turner <digit@google.com>2009-09-20 13:10:19 -0700
commit238b4b0ef1a01afa66ef267dae4a96401ad386db (patch)
treed6cab191674a2141c5adc12d5becb488f89b7e7e
parent060749410208cd5a0e25faacdd6a5ef1ae8cf6d5 (diff)
downloadexternal_qemu-238b4b0ef1a01afa66ef267dae4a96401ad386db.zip
external_qemu-238b4b0ef1a01afa66ef267dae4a96401ad386db.tar.gz
external_qemu-238b4b0ef1a01afa66ef267dae4a96401ad386db.tar.bz2
Fix ARMv7 emulation by disabling CPU alignment exceptions
Disable alignment CPU exceptions to be able to boot an ARMv7 system image. This is because 4.4.0 emits a machine code sequence that stores an 8-bytes double on a 4-byte aligned address on the stack in the implementation of cvt() in the C library (see the disassembly for bionic/libc/stdio/vfprintf.c). It is uncertain that this is a compiler bug at this point, but the upstream QEMU sources don't have alignment exceptions enabled for any ARM target anyway. Also, add a check to force CPU emulation to "cortex-a8" if the kernel file name ends in "-armv7". This is a poor man's approach to hardware configuration that will be replaced by a more sophisticated solution in the future. Right now, we just want to be able to build -user system images with the dex preopt pass running in the emulator with the minimum amount of fuss.
-rw-r--r--android/main.c27
-rw-r--r--target-arm/op_helper.c2
2 files changed, 26 insertions, 3 deletions
diff --git a/android/main.c b/android/main.c
index 35f236f..1024ec2 100644
--- a/android/main.c
+++ b/android/main.c
@@ -2321,8 +2321,31 @@ int main(int argc, char **argv)
n = 1;
/* generate arguments for the underlying qemu main() */
- args[n++] = "-kernel";
- args[n++] = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_KERNEL);
+ {
+ const char* kernelFile = avdInfo_getImageFile(avd, AVD_IMAGE_KERNEL);
+ int kernelFileLen = strlen(kernelFile);
+
+ args[n++] = "-kernel";
+ args[n++] = (char*)kernelFile;
+
+ /* If the kernel image name ends in "-armv7", then change the cpu
+ * type automatically. This is a poor man's approach to configuration
+ * management, but should allow us to get past building ARMv7
+ * system images with dex preopt pass without introducing too many
+ * changes to the emulator sources.
+ *
+ * XXX:
+ * A 'proper' change would require adding some sort of hardware-property
+ * to each AVD config file, then automatically determine its value for
+ * full Android builds (depending on some environment variable), plus
+ * some build system changes. I prefer not to do that for now for reasons
+ * of simplicity.
+ */
+ if (kernelFileLen > 6 && !memcmp(kernelFile + kernelFileLen - 6, "-armv7", 6)) {
+ args[n++] = "-cpu";
+ args[n++] = "cortex-a8";
+ }
+ }
args[n++] = "-initrd";
args[n++] = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_RAMDISK);
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
index 64bab2b..05eb558 100644
--- a/target-arm/op_helper.c
+++ b/target-arm/op_helper.c
@@ -70,7 +70,7 @@ uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def,
static void do_unaligned_access (target_ulong addr, int is_write, int is_user, void *retaddr);
#define MMUSUFFIX _mmu
-#define ALIGNED_ONLY 1
+//#define ALIGNED_ONLY 1
#define SHIFT 0
#include "softmmu_template.h"