summaryrefslogtreecommitdiffstats
path: root/target-i386/op_helper.c
Commit message (Collapse)AuthorAgeFilesLines
* x86: rename op_helper.c to seg_helper.cBlue Swirl2012-06-281-2475/+0
| | | | | | Rename what is remaining of op_helper.c to seg_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off memory access helpersBlue Swirl2012-06-281-136/+2
| | | | | | Move memory access helpers to mem_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off misc helpersBlue Swirl2012-06-281-578/+0
| | | | | | Move various functions to misc_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off SMM helpersBlue Swirl2012-06-281-285/+0
| | | | | | Move SMM helpers to smm_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off SVM helpersBlue Swirl2012-06-281-705/+11
| | | | | | Move SVM helpers to svm_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off integer helpersBlue Swirl2012-06-281-478/+0
| | | | | | Move integer and bit field helpers to int_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off condition code helpersBlue Swirl2012-06-281-404/+0
| | | | | | | | | Move condition code helpers to cc_helper.c. Move the shared inline functions lshift(), cpu_load_eflags() and cpu_cc_compute_all() to cpu.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: prepare eflags helpers for general useBlue Swirl2012-06-281-31/+37
| | | | | | | Adjust function names and add an explicit CPUX86State parameter instead of relying on AREG0. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split condition code and shift templatesBlue Swirl2012-06-281-4/+22
| | | | | | | | Move shift templates from helper_template.h to shift_helper_template.h and the condition code helpers to cc_helper_template.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off FPU helpersBlue Swirl2012-06-281-1277/+0
| | | | | | Move FPU and MMX/SSE helpers to fpu_helpers.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: split off exception handlersBlue Swirl2012-06-281-113/+0
| | | | | | Move exception handlers from op_helper.c to excp_helper.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: avoid AREG0 for exceptionsBlue Swirl2012-06-281-205/+213
| | | | | | | | | | | | Add an explicit CPUX86State parameter instead of relying on AREG0. Merge raise_exception_env() to raise_exception(), likewise with raise_exception_err_env() and raise_exception_err(). Introduce cpu_svm_check_intercept_param() and cpu_vmexit() as wrappers. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: prepare op_helper.c for splittingBlue Swirl2012-06-281-796/+1279
| | | | | | Fix coding style and a few typos. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-log: use LOG_UNIMP for some target CPU casesBlue Swirl2012-06-211-0/+1
| | | | | | | Use LOG_UNIMP for some target CPU cases. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Acked-by: Alexander Graf <agraf@suse.de>
* Use uintptr_t for various op related functionsBlue Swirl2012-04-141-5/+3
| | | | | | | | | Use uintptr_t instead of void * or unsigned long in several op related functions, env->mem_io_pc and GETPC() macro. Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* target-i386: Don't overuse CPUStateAndreas Färber2012-03-141-17/+17
| | | | | | | | | Scripted conversion: sed -i "s/CPUState/CPUX86State/g" target-i386/*.[hc] sed -i "s/#define CPUX86State/#define CPUState/" target-i386/cpu.h Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Anthony Liguori <aliguori@us.ibm.com>
* target-i386: Clean includesStefan Weil2012-02-281-1/+0
| | | | | | Remove some include statements which are not needed. Signed-off-by: Stefan Weil <sw@weilnetz.de>
* target-i386: fix SSE rounding and flush to zeroAurelien Jarno2012-01-111-10/+54
| | | | | | | | | | | | SSE rounding and flush to zero control has never been implemented. However given that softfloat-native was using a single state for FPU and SSE and given that glibc is setting both FPU and SSE state in fesetround(), this was working correctly up to the switch to softfloat. Fix that by adding an update_sse_status() function similar to update_fpu_status(), and callin git on write to mxcsr. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* i386: wire up MSR_IA32_MISC_ENABLEAvi Kivity2011-10-241-0/+6
| | | | | | | | | It's needed for its default value - bit 0 specifies that "rep movs" is good enough for memcpy, and Linux may use a slower memcpu if it is not set, depending on cpu family/model. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* softmmu_header: pass CPUState to tlb_fillBlue Swirl2011-10-011-4/+3
| | | | | | | Pass CPUState pointer to tlb_fill() instead of architecture local cpu_single_env hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: fix daa opcode for al register values higher than 0xf9Boris Figovsky2011-09-021-3/+3
| | | | | | | | | The second if statement should consider the original al register value, and not the new one. Signed-off-by: Boris Figovsky <boris.figovksy@ravellosystems.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Remove unused is_softmmu parameter from cpu_handle_mmu_faultBlue Swirl2011-08-071-1/+1
| | | | | | | | | 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>
* exec.h cleanupBlue Swirl2011-07-301-4/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove exec-all.h include directivesBlue Swirl2011-06-261-1/+0
| | | | | | Most exec-all.h include directives are now useless, remove them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: use caller supplied CPUState for interrupt related stuffBlue Swirl2011-06-261-8/+81
| | | | | | | | | | | | | | 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>
* cpu_loop_exit: avoid using AREG0Blue Swirl2011-06-261-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>
* target-i386: use floatx80 constants in helper_fld*_ST0()Aurelien Jarno2011-06-031-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>
* target-i386: remove old code handling float64Aurelien Jarno2011-06-031-159/+107
| | | | | | | | 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>
* target-i386: fix constants wrt softfloatAurelien Jarno2011-04-251-7/+17
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: fix helper_fprem() and helper_fprem1() wrt softfloatAurelien Jarno2011-04-251-20/+28
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: fix logarithmic and trigonometric helpers wrt softfloatAurelien Jarno2011-04-251-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>
* target-i386: add CPU86_LDouble <-> double conversion functionsAurelien Jarno2011-04-251-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>
* target-i386: replace approx_rsqrt and approx_rcp by softfloat opsAurelien Jarno2011-04-251-10/+0
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: fix helper_fsqrt() wrt softfloatAurelien Jarno2011-04-251-5/+2
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: fix helper_fdiv() wrt softfloatAurelien Jarno2011-04-251-2/+3
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: fix helper_fxtract() wrt softfloatAurelien Jarno2011-04-251-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>
* target-i386: fix helper_fbld_ST0() wrt softfloatAurelien Jarno2011-04-251-3/+4
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: fix helper_fscale() wrt softfloatAurelien Jarno2011-04-251-1/+6
| | | | | | | | | 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>
* Remove unused function parameter from cpu_restore_stateStefan Weil2011-04-201-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>
* target-i386: add floatx_{add,mul,sub} and use themAurelien Jarno2011-04-171-10/+8
| | | | | | | | 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>
* i386: avoid a write only variableBlue Swirl2010-10-131-0/+4
| | | | | | | | | | | Compiling with GCC 4.6.0 20100925 produced warnings: /src/qemu/target-i386/op_helper.c: In function 'switch_tss': /src/qemu/target-i386/op_helper.c:283:53: error: variable 'new_trap' set but not used [-Werror=unused-but-set-variable] Fix by adding a dummy cast so that the variable is not unused. Add also pointer to docs. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* target-i386: svm: Fix MSRPM checkAdam Lackorzynski2010-08-221-1/+1
| | | | | | | | Correct the calculation of the offset in the msrpm for the MSR range 0 - 0x1fff. Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* remove unused stuff from */exec.hPaolo Bonzini2010-07-031-1/+1
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* x86: svm: Always clear event_inj on vmexitJan Kiszka2010-06-301-0/+1
| | | | | | | | | | | We currently only clear SVM_EVTINJ_VALID after successful interrupt delivery. This apparently does not match real hardware which clears the whole event_inj field on every vmexit, including unsuccessful interrupt delivery. Reported-by: Erik van der Kouwe <vdkouwe@cs.vu.nl> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* apic: avoid passing CPUState from CPU codeBlue Swirl2010-06-191-4/+4
| | | | | | Pass only APICState when accessing APIC from CPU code. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* target-i386: Fix variable in (disabled) debugging codeAdam Lackorzynski2010-04-081-1/+1
| | | | | Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Move ioport.h out of cpu-all.hPaul Brook2010-03-011-0/+1
| | | | | | Only include ioport.h where it is actually needed. Signed-off-by: Paul Brook <paul@codesourcery.com>
* target-i386: fix crash on x86 32bit linux host with hw breakpoint exceptionsJason Wessel2010-02-281-0/+5
| | | | | | | | | | | | | | | | If you make use of hw breakpoints on a 32bit x86 linux host, qemu will segmentation fault when processing the exception. The problem is that the value of env is stored in $ebp in the op_helper raise_exception() function, and it can have the wrong value when calling it from non generated code. It is possible to work around the problem by restoring the value of env before calling raise_exception() using a new helper function that takes (CPUState *) as one of the arguments. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: implement lzcnt emulationAndre Przywara2009-10-231-2/+12
| | | | | | | | | | | | | lzcnt is a AMD Phenom/Barcelona added instruction returning the number of leading zero bits in a word. As this is similar to the "bsr" instruction, reuse the existing code. There need to be some more changes, though, as lzcnt always returns a valid value (in opposite to bsr, which has a special case when the operand is 0). lzcnt is guarded by the ABM CPUID bit (Fn8000_0001:ECX_5). Signed-off-by: Andre Przywara <andre.przywara@amd.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: Fix exceptions for fxsave/fxrstorKevin Wolf2009-10-041-0/+10
| | | | | | | | | | | | This patch corrects the following aspects of exception generation in fxsave/fxrstor: * Generate #GP if the operand is not aligned to a 16 byte boundary * Generate #UD if the LOCK prefix is used * For CR0.EM = 1 #NM is generated, not #UD Signed-off-by: Kevin Wolf <mail@kevin-wolf.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
OpenPOWER on IntegriCloud