Commit 31fca6ab60f8ee8062bf59d54ba4d88832064ff1
1 parent
b172c56a
Resynchronize darwin-user target with linux-user:
add CPU selection feature, choose the correct default CPU and set the 32/64 bits computation mode properly. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3657 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
31 additions
and
4 deletions
darwin-user/main.c
@@ -834,6 +834,15 @@ int main(int argc, char **argv) | @@ -834,6 +834,15 @@ int main(int argc, char **argv) | ||
834 | } else | 834 | } else |
835 | if (!strcmp(r, "g")) { | 835 | if (!strcmp(r, "g")) { |
836 | use_gdbstub = 1; | 836 | use_gdbstub = 1; |
837 | + } else if (!strcmp(r, "cpu")) { | ||
838 | + cpu_model = argv[optind++]; | ||
839 | + if (strcmp(cpu_model, "?") == 0) { | ||
840 | +/* XXX: implement xxx_cpu_list for targets that still miss it */ | ||
841 | +#if defined(cpu_list) | ||
842 | + cpu_list(stdout, &fprintf); | ||
843 | +#endif | ||
844 | + _exit(1); | ||
845 | + } | ||
837 | } else | 846 | } else |
838 | { | 847 | { |
839 | usage(); | 848 | usage(); |
@@ -846,16 +855,26 @@ int main(int argc, char **argv) | @@ -846,16 +855,26 @@ int main(int argc, char **argv) | ||
846 | /* Zero out regs */ | 855 | /* Zero out regs */ |
847 | memset(regs, 0, sizeof(struct target_pt_regs)); | 856 | memset(regs, 0, sizeof(struct target_pt_regs)); |
848 | 857 | ||
849 | - /* NOTE: we need to init the CPU at this stage to get | ||
850 | - qemu_host_page_size */ | 858 | + if (cpu_model == NULL) { |
851 | #if defined(TARGET_I386) | 859 | #if defined(TARGET_I386) |
852 | - cpu_model = "qemu32"; | 860 | +#ifdef TARGET_X86_64 |
861 | + cpu_model = "qemu64"; | ||
862 | +#else | ||
863 | + cpu_model = "qemu32"; | ||
864 | +#endif | ||
853 | #elif defined(TARGET_PPC) | 865 | #elif defined(TARGET_PPC) |
854 | - cpu_model = "750"; | 866 | +#ifdef TARGET_PPC64 |
867 | + cpu_model = "970"; | ||
868 | +#else | ||
869 | + cpu_model = "750"; | ||
870 | +#endif | ||
855 | #else | 871 | #else |
856 | #error unsupported CPU | 872 | #error unsupported CPU |
857 | #endif | 873 | #endif |
874 | + } | ||
858 | 875 | ||
876 | + /* NOTE: we need to init the CPU at this stage to get | ||
877 | + qemu_host_page_size */ | ||
859 | env = cpu_init(cpu_model); | 878 | env = cpu_init(cpu_model); |
860 | 879 | ||
861 | printf("Starting %s with qemu\n----------------\n", filename); | 880 | printf("Starting %s with qemu\n----------------\n", filename); |
@@ -997,6 +1016,14 @@ int main(int argc, char **argv) | @@ -997,6 +1016,14 @@ int main(int argc, char **argv) | ||
997 | #elif defined(TARGET_PPC) | 1016 | #elif defined(TARGET_PPC) |
998 | { | 1017 | { |
999 | int i; | 1018 | int i; |
1019 | + | ||
1020 | +#if defined(TARGET_PPC64) | ||
1021 | +#if defined(TARGET_ABI32) | ||
1022 | + env->msr &= ~((target_ulong)1 << MSR_SF); | ||
1023 | +#else | ||
1024 | + env->msr |= (target_ulong)1 << MSR_SF; | ||
1025 | +#endif | ||
1026 | +#endif | ||
1000 | env->nip = regs->nip; | 1027 | env->nip = regs->nip; |
1001 | for(i = 0; i < 32; i++) { | 1028 | for(i = 0; i < 32; i++) { |
1002 | env->gpr[i] = regs->gpr[i]; | 1029 | env->gpr[i] = regs->gpr[i]; |