diff options
author | David 'Digit' Turner <digit@google.com> | 2009-09-20 13:10:19 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2009-09-20 13:10:19 -0700 |
commit | 238b4b0ef1a01afa66ef267dae4a96401ad386db (patch) | |
tree | d6cab191674a2141c5adc12d5becb488f89b7e7e /android | |
parent | 060749410208cd5a0e25faacdd6a5ef1ae8cf6d5 (diff) | |
download | external_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.
Diffstat (limited to 'android')
-rw-r--r-- | android/main.c | 27 |
1 files changed, 25 insertions, 2 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); |