summaryrefslogtreecommitdiff
path: root/target-i386
AgeCommit message (Collapse)AuthorFilesLines
2011-09-03Use new macro QEMU_PACKED for packed structuresStefan Weil2-5/+5
Most changes were made using these commands: git grep -la '__attribute__((packed))'|xargs perl -pi -e 's/__attribute__\(\(packed\)\)/QEMU_PACKED/' git grep -la '__attribute__ ((packed))'|xargs perl -pi -e 's/__attribute__ \(\(packed\)\)/QEMU_PACKED/' git grep -la '__attribute__((__packed__))'|xargs perl -pi -e 's/__attribute__\(\(__packed__\)\)/QEMU_PACKED/' git grep -la '__attribute__ ((__packed__))'|xargs perl -pi -e 's/__attribute__ \(\(__packed__\)\)/QEMU_PACKED/' git grep -la '__attribute((packed))'|xargs perl -pi -e 's/__attribute\(\(packed\)\)/QEMU_PACKED/' Whitespace in linux-user/syscall_defs.h was fixed manually to avoid warnings from scripts/checkpatch.pl. Manual changes were also applied to hw/pc.c. I did not fix indentation with tabs in block/vvfat.c. The patch will show 4 errors with scripts/checkpatch.pl. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-25Fix up some style nits of last uq/master mergeJan Kiszka1-2/+3
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori3-13/+13
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-08Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori3-1/+29
2011-08-07Remove unused is_softmmu parameter from cpu_handle_mmu_faultBlue Swirl3-4/+4
Parameter is_softmmu (and its evil mutant twin brother is_softmuu) is not used in cpu_*_handle_mmu_fault() functions, remove them and adjust callers. Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-08-05Avoid allocating TCG resources in non-TCG modeJan Kiszka1-2/+2
Do not allocate TCG-only resources like the translation buffer when running over KVM or XEN. Saves a "few" bytes in the qemu address space and is also conceptually cleaner. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-05Remove #ifdef KVM_CAP_TSC_CONTROLMarcelo Tosatti1-2/+0
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-08-05qemu-x86: Set tsc_khz in kvm when supportedJoerg Roedel1-1/+17
Make use of the KVM_TSC_CONTROL feature if available. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-08-05qemu-x86: Add tsc_freq option to -cpuJoerg Roedel2-0/+14
To let the user configure the desired tsc frequency for the guest if running in KVM. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-07-30exec.h cleanupBlue Swirl4-148/+164
Move softmmu_exec.h include directives from target-*/exec.h to target-*/op_helper.c. Move also various other stuff only used in op_helper.c there. Define global env in dyngen-exec.h. For i386, move wrappers for segment and FPU helpers from user-exec.c to op_helper.c. Implement raise_exception_err_env() to handle dynamic CPUState. Move the function declarations to cpu.h since they can be used outside of op_helper.c context. LM32, s390x, UniCore32: remove unused cpu_halted(), regs_to_env() and env_to_regs(). ARM: make raise_exception() static. Convert #include "exec.h" to #include "cpu.h" #include "dyngen-exec.h" and remove now unused target-*/exec.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-26Remove exec-all.h include directivesBlue Swirl5-5/+1
Most exec-all.h include directives are now useless, remove them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-26Move cpu_has_work and cpu_pc_from_tb to cpu.hBlue Swirl2-46/+47
Move functions cpu_has_work() and cpu_pc_from_tb() from exec.h to cpu.h. This is needed by later patches. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-26exec.h: fix coding style and change cpu_has_work to return boolBlue Swirl1-1/+1
Before the next patch, fix coding style of the areas affected. Change the type of the return value from cpu_has_work() and qemu_cpu_has_work() to bool. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-26x86: use caller supplied CPUState for interrupt related stuffBlue Swirl3-18/+91
Several x86 specific functions are called from cpu-exec.c with the assumption that global env register is valid. This will be changed later, so make the functions use caller supplied CPUState parameter. It would be cleaner to move the functions to helper.c, but there are quite a lot of dependencies between do_interrupt() and other functions. Add helpers for svm_check_intercept() and cpu_cc_compute_all() instead of calling the helper (which uses global env, AREG0) directly. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-26cpu_loop_exit: avoid using AREG0Blue Swirl1-8/+8
Make cpu_loop_exit() take a parameter for CPUState instead of relying on global env. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-21kvm: fix FPU state subsectionMarcelo Tosatti1-3/+3
There is no need to specify version on the subsection fields. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-20KVM: Fix XSAVE feature bit enumerationAndre Przywara1-1/+4
When iterating through the XSAVE feature enumeration CPUID leaf (0xD) we should not stop at the first zero EAX, but instead keep scanning since there are gaps in the enumeration (ECX=1 for instance). This fixes the proper usage of AVX in KVM guests. Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-20kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuidJan Kiszka2-23/+27
kvm_arch_get_supported_cpuid checks for global cpuid restrictions, it does not require any CPUState reference. Changing its interface allows to call it before any VCPU is initialized. CC: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-20kvm: x86: Drop KVM_CAP build dependenciesJan Kiszka1-64/+3
No longer needed with accompanied kernel headers. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-20kvm: Drop CONFIG_KVM_PARAJan Kiszka1-25/+1
The kvm_para.h header is now always available. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-19kvm: x86: Save/restore FPU OP, IP and DPJan Kiszka3-5/+42
These FPU states are properly maintained by KVM but not yet by TCG. So far we unconditionally set them to 0 in the guest which may cause state corruptions, though not with modern guests. To avoid breaking backward migration, use a conditional subsection that is only written if any of the three fields is non-zero. The guest's FNINIT clears them frequently, and cleared IA32_MISC_ENABLE MSR[2] reduces the probability of non-zero values further so that this subsection is not expected to restrict migration in any common scenario. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-06-14kvm: Enable CPU SMEP featureYang, Wei Y1-0/+13
This patchset enables a new CPU feature SMEP (Supervisor Mode Execution Protection) in QEMU-KVM. SMEP prevents kernel from executing code in application. Updated Intel SDM describes this CPU feature. The document will be published soon. SMEP is identified by CPUID leaf 7 EBX[7], which is 0 before. Get the right value by query KVM kernel module, so that guest can get SMEP through CPUID. Signed-off-by: Yang, Wei <wei.y.yang@intel.com> Singed-off-by: Shan, Haitao <haitao.shan@intel.com> Singed-off-by: Li, Xin <xin.li@intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-14kvm: Add CPUID support for VIA CPUbrillywu@viatech.com.cn3-3/+74
When KVM is running on VIA CPU with host cpu's model, the feautures of VIA CPU will be passed into kvm guest by calling the CPUID instruction for Centaur. Signed-off-by: BrillyWu<brillywu@viatech.com.cn> Signed-off-by: KaryJin<karyjin@viatech.com.cn> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-06-08target-i386: Make x86 mfence and lfence illegal without SSE2Martin Simmons1-1/+1
While trying to use qemu -cpu pentium3 to test for incorrect uses of certain SSE2 instructions, I found that QEMU allowed the mfence and lfence instructions to be executed even though Pentium 3 doesn't support them. According to the processor specs (and experience on a real Pentium 3), these instructions are only available with SSE2, but QEMU is checking for SSE. The check for the related sfence instruction is correct (it works with SSE). This trival patch fixes the test. Signed-off-by: Martin Simmons <martin@lispworks.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-08Fix compilation warning due to missing header for sigaction (followup)Alexandre Raymond1-1/+0
This patch removes all references to signal.h when qemu-common.h is included as they become redundant. Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-03target-i386: use floatx80 constants in helper_fld*_ST0()Aurelien Jarno1-19/+8
Instead of using a table which doesn't correspond to anything from physical in the CPU, use directly the constants in helper_fld*_ST0(). Cc: Andreas Färber <andreas.faerber@web.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-06-03target-i386: remove old code handling float64Aurelien Jarno5-411/+115
Now that target-i386 uses softfloat, floatx80 is always available and there is no need anymore to have code handling both float64 and floax80. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-05-08irq: Privatize CPU_INTERRUPT_NMI.Richard Henderson1-0/+1
This interrupt name is used by i386, CRIS, and MicroBlaze. Copy the name into each target. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-05-08target-i386: Privatize some i386-specific interrupt names.Richard Henderson1-0/+8
SMI, VIRQ, INIT, SIPI, and MCE are all only used by the i386 port. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-05-02kvm: use qemu_free consistentlyPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-05-02kvm: add kvmclock to its second bitGlauber Costa1-1/+1
We have two bits that can represent kvmclock in cpuid. They signal the guest which msr set to use. When we tweak flags involving this value - specially when we use "-", we have to act on both. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-05-02x86: Allow multiple cpu feature matches of lookup_featureJan Kiszka1-6/+8
kvmclock is represented by two feature bits. Therefore, lookup_feature needs to continue its search even after the first match. Enhance it accordingly and switch to a bool return type at this chance. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2011-05-02kvm: use kernel-provided para_features instead of statically coming up with ↵Glauber Costa1-29/+49
new capabilities Use the features provided by KVM_GET_SUPPORTED_CPUID directly to mask out features from guest-visible cpuid. The old get_para_features() mechanism is kept for older kernels that do not implement it. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
2011-04-25target-i386: fix constants wrt softfloatAurelien Jarno2-7/+25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix helper_fprem() and helper_fprem1() wrt softfloatAurelien Jarno1-20/+28
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix logarithmic and trigonometric helpers wrt softfloatAurelien Jarno1-26/+26
Use the new CPU86_LDouble <-> double conversion functions to make logarithmic and trigonometric helpers working with softfloat. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: add CPU86_LDouble <-> double conversion functionsAurelien Jarno1-0/+22
Add functions to convert CPU86_LDouble to double and vice versa. They are going to be used to implement logarithmic and trigonometric function until softfloat implement them. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: replace approx_rsqrt and approx_rcp by softfloat opsAurelien Jarno2-22/+24
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix helper_fsqrt() wrt softfloatAurelien Jarno2-5/+6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix helper_fdiv() wrt softfloatAurelien Jarno2-2/+7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix helper_fxtract() wrt softfloatAurelien Jarno1-7/+16
With softfloat it's not possible to play with the overflow of an unsigned value to get the 0 case partially correct. Use a special case for that. Using a division to generate an infinity is the easiest way that works for both softfloat and softfloat-native. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix helper_fbld_ST0() wrt softfloatAurelien Jarno1-3/+4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-25target-i386: fix helper_fscale() wrt softfloatAurelien Jarno2-1/+10
Use the scalbn softfloat function to implement helper_fscale(). This fixes corner cases (e.g. NaN) and makes a few more GNU libc math tests to pass. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-20Remove unused function parameter from cpu_restore_stateStefan Weil1-1/+1
The previous patch removed the need for parameter puc. Is is now unused, so remove it. Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-20Remove unused function parameters from gen_pc_load and rename the functionStefan Weil1-4/+3
Function gen_pc_load was introduced in commit d2856f1ad4c259e5766847c49acbb4e390731bd4. The only reason for parameter searched_pc was a debug statement in target-i386/translate.c. Parameter puc was needed by target-sparc until commit d7da2a10402f1644128b66414ca8f86bdea9ae7c. Remove searched_pc from the debug statement and remove both parameters from the parameter list of gen_pc_load. As the function name gen_pc_load was also misleading, it is now called restore_state_to_opc. This new name was suggested by Peter Maydell, thanks. v2: Remove last parameter, too, and rename the function. v3: Fix [] typo in target-arm/translate.c. Fix wrong SHA1 object name in commit message (copy+paste error). Cc: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-17softfloat: rename float*_eq() into float*_eq_quiet()Aurelien Jarno1-4/+4
float*_eq functions have a different semantics than other comparison functions. Fix that by first renaming float*_quiet() into float*_eq_quiet(). Note that it is purely mechanical, and the behaviour should be unchanged. That said it clearly highlight problems due to this different semantics, they are fixed later in this patch series. Cc: Alexander Graf <agraf@suse.de> Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17target-i386: fix CMPUNORDPS/D and CMPORDPS/D instructionsAurelien Jarno1-2/+2
SSE instructions CMPUNORDPS/D and CMPORDPS/D do not trigger an invalid exception if operands are qNANs. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17target-i386: add floatx_{add,mul,sub} and use themAurelien Jarno2-10/+14
Add floatx_{add,mul,sub} defines, and use them instead of using direct C operations. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17target-i386: use float unions from cpu-all.hAurelien Jarno1-25/+2
Use float unions from cpu-all.h instead of redefining new (wrong for arm) ones in target-i386. This also allows building cpu-exec.o with softfloat. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17target-i386: use CPU_LDoubleU instead of a private unionAurelien Jarno1-9/+3
Use CPU_LDoubleU in cpu_dump_state() instead of redefining a union for doing the conversion. Based on a patch from Laurent Vivier <laurent@vivier.eu>. Cc: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>