summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* target-mips: don't hardcode softfloat exception bitsAurelien Jarno2011-04-171-15/+20
| | | | | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-mips: simplify FP comparisonsAurelien Jarno2011-04-171-36/+36
| | | | | | | | As the softfloat comparison functions already test for NaN, there is no need to always call the float*_unordered*() functions. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-ppc: fix SPE comparison functionsAurelien Jarno2011-04-171-13/+13
| | | | | | | | | | | | | | | | efstst*() functions are fast SPE funtions which do not take into account special values (infinites, NaN, etc.), while efscmp*() functions are IEEE754 compliant. Given that float32_*() functions are IEEE754 compliant, the efscmp*() functions are correctly implemented, while efstst*() are not. This patch reverse the implementation of this two groups of functions and fix the comments. It also use float32_eq() instead of float32_eq_quiet() as qNaNs should not be ignored. Cc: Alexander Graf <agraf@suse.de> Cc: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat: improve description of comparison functionsAurelien Jarno2011-04-171-37/+48
| | | | | | | | Make clear for all comparison functions which ones trigger an exception for all NaNs, and which one only for sNaNs. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat: move float*_eq and float*_eq_quietAurelien Jarno2011-04-172-59/+58
| | | | | | | | | | | | I am not a big fan of code moving, but having the signaling version in the middle of quiet versions and vice versa doesn't make the code easy to read. This patch is a simple code move, basically swapping locations of float*_eq and float*_eq_quiet. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat: rename float*_eq_signaling() into float*_eq()Aurelien Jarno2011-04-173-11/+11
| | | | | | | | | | | float*_eq_signaling functions have a different semantics than other comparison functions. Fix that by renaming float*_quiet_signaling() into float*_eq(). Note that it is purely mechanical, and the behaviour should be unchanged. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat: rename float*_eq() into float*_eq_quiet()Aurelien Jarno2011-04-179-38/+38
| | | | | | | | | | | | | | 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>
* target-i386: fix CMPUNORDPS/D and CMPORDPS/D instructionsAurelien Jarno2011-04-171-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>
* target-mips: use new float*_unordered*() functionsAurelien Jarno2011-04-171-98/+70
| | | | | | | | Use the new float*_unordered*() functions from softfloat instead of redefining a private version. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-alpha: use new float64_unordered_quiet() functionAurelien Jarno2011-04-171-2/+3
| | | | | | | | | | | | | | | Use float64_unordered_quiet() in helper_cmptun() instead of doing the the comparison manually. According to the "Alpha Compiler Writer's Guide", we should use the _quiet version here, as CMPTUN and CMPTEQ should generate InvalidOp for SNaNs but not for QNaNs. Thanks to Peter Maydell <peter.maydell@linaro.org> and Richard Henderson <rth@twiddle.net> for digging into the manuals. Acked-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat-native: add float*_unordered_quiet() functionsAurelien Jarno2011-04-171-3/+12
| | | | | | | | | Add float*_unordered_quiet() functions to march the softfloat versions. As FPU status is not tracked with softfloat-native, they don't differ from the signaling version. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat: add float*_unordered_{,quiet}() functionsAurelien Jarno2011-04-172-0/+175
| | | | | | | | | | | Add float*_unordered() functions to softfloat, matching the softfloat-native ones. Also add float*_unordered_quiet() functions to match the others comparison functions. This allow target-i386/ops_sse.h to be compiled with softfloat. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* target-i386: add floatx_{add,mul,sub} and use themAurelien Jarno2011-04-172-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>
* target-i386: use float unions from cpu-all.hAurelien Jarno2011-04-171-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>
* target-i386: use CPU_LDoubleU instead of a private unionAurelien Jarno2011-04-171-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>
* cpu-all.h: define CPU_LDoubleUAurelien Jarno2011-04-171-0/+10
| | | | | | | | | | | Add a CPU_LDoubleU type, matching the floatx80 definition and the long double type on x86 hosts. 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>
* softfloat: use GCC builtins to count the leading zerosAurelien Jarno2011-04-171-2/+27
| | | | | | | | | | | | | | Softfloat has its own implementation to count the leading zeros. However a lot of architectures have either a dedicated instruction or an optimized to do that. When using GCC >= 3.4, this patch uses GCC builtins instead of the handcoded implementation. Note that I amware that QEMU_GNUC_PREREQ is defined in osdep.h and that clz32() and clz64() are defined in host-utils.h, but I think it is better to keep the softfloat implementation self contained. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* usb: fix spelling errors in usb-linux.cBrad Hards2011-04-161-2/+2
| | | | | Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* usb: initialise data element in Linux USB_DISCONNECT ioctlBrad Hards2011-04-161-0/+1
| | | | | | | This isn't used, but leaving it empty causes valgrind noise. Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* usb: trivial spelling fixesBrad Hards2011-04-161-2/+2
| | | | | Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Makefile: Clean up after "make pdf"Brad Hards2011-04-162-1/+7
| | | | | Signed-off-by: Brad Hards <bradh@frogmouth.net> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Fix some typos in comments and documentationStefan Weil2011-04-163-4/+4
| | | | | | | | | | | helpfull -> helpful usefull -> useful cotrol -> control and a grammar fix. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* migration: move some declarations to migration.hBlue Swirl2011-04-153-7/+9
| | | | | | Move a few migration related declarations to migration.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move CPU related functions to cpus.hBlue Swirl2011-04-153-4/+5
| | | | | | Move declarations of CPU related functions to cpus.h. Adjust the only user. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move clock related functions to qemu-timer.hBlue Swirl2011-04-152-4/+4
| | | | | | Move declarations for clock related functions from sysemu.h to qemu-timer.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move generic or OS function declarations to qemu-common.hBlue Swirl2011-04-153-21/+22
| | | | | | | | | | | Move generic or OS related function declarations and macro TFR to qemu-common.h. Move win32 include directives to qemu-os-win32.h. While moving, also add #include <winsock2.h> to fix a recent mingw32 build breakage. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Use qemu-common.h or qemu-timer.h in place of sysemu.hBlue Swirl2011-04-153-4/+3
| | | | | | | In some cases qemu-common.h or qemu-timer.h can be used in place of sysemu.h. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove unused sysemu.h include directivesBlue Swirl2011-04-1556-56/+0
| | | | | | | Remove unused sysemu.h include directives to speed up build with the following patches. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* json-lexer: fix conflict with mingw32 ERROR definitionBlue Swirl2011-04-151-3/+3
| | | | | | | | The name ERROR is too generic, it conflicts with mingw32 ERROR definition. Replace ERROR with IN_ERROR. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* sparc: Fix assertion caused by empty memory slot with 0 byteStefan Weil2011-04-151-9/+12
| | | | | | | | | | | | | | | | | | | If the memory size given on the command line is equal to the maximum size of memory defined by the hardware, there is no "empty slot" after physical memory. The following command qemu-system-sparc -m 256 raised an assertion: exec.c:2614: cpu_register_physical_memory_offset: Assertion `size' failed This can be fixed either at the caller side (don't call empty_slot_init) or in empty_slot_init (do nothing) when size == 0. The second solution was choosen here because it is more robust. Signed-off-by: Stefan Weil <weil@mail.berlios.de>
* qemu_next_deadline should not consider host-time timersPaolo Bonzini2011-04-153-12/+7
| | | | | | | | | It is purely for icount-based virtual timers. And now that we got the code right, rename the function to clarify the intended scope. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* Revert wrong fixes for -icount in the iothread casePaolo Bonzini2011-04-151-30/+36
| | | | | | | | | This reverts commits 225d02cd and c9f7383c. While some parts of the latter could be saved, I preferred a smooth, complete revert. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* enable vm_clock to "warp" in the iothread+icount casePaolo Bonzini2011-04-154-2/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous patch however is not enough, because if the virtual CPU goes to sleep waiting for a future timer interrupt to wake it up, qemu deadlocks. The timer interrupt never comes because time is driven by icount, but the vCPU doesn't run any insns. You could say that VCPUs should never go to sleep in icount mode if there is a pending vm_clock timer; rather time should just warp to the next vm_clock event with no sleep ever taking place. Even better, you can sleep for some time related to the time left until the next event, to avoid that the warps are too visible externally; for example, you could be sending network packets continously instead of every 100ms. This is what this patch implements. qemu_clock_warp is called: 1) whenever a vm_clock timer is adjusted, to ensure the warp_timer is synchronized; 2) at strategic points in the CPU thread, to make sure the insn counter is synchronized before the CPU starts running. In any case, the warp_timer is disabled while the CPU is running, because the insn counter will then be making progress on its own. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* really fix -icount in the iothread casePaolo Bonzini2011-04-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | The correct fix for -icount is to consider the biggest difference between iothread and non-iothread modes. In the traditional model, CPUs run _before_ the iothread calls select (or WaitForMultipleObjects for Win32). In the iothread model, CPUs run while the iothread isn't holding the mutex, i.e. _during_ those same calls. So, the iothread should always block as long as possible to let the CPUs run smoothly---the timeout might as well be infinite---and either the OS or the CPU thread itself will let the iothread know when something happens. At this point, the iothread wakes up and interrupts the CPU. This is exactly the approach that this patch takes: when cpu_exec_all returns in -icount mode, and it is because a vm_clock deadline has been met, it wakes up the iothread to process the timers. This is really the "bulk" of fixing icount. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* tests/test-mmap.c: Check mmap() return value before using itPeter Maydell2011-04-141-1/+1
| | | | | | | | | Correct the position of a "stop if MAP_FAILED" check in the mmap() tests, so that if mmap() does fail we print a failure message rather than segfaulting inside memcpy(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* target-arm: Don't overflow when calculating value for signed VABALPeter Maydell2011-04-131-17/+21
| | | | | | | | | | In the VABAL instruction we take the absolute difference of two values of size x and store it in a result of size 2x. This means we have to be careful to calculate the absolute difference using a wide enough type that we don't accidentally overflow. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Revert SeaBIOS change due to overzealous commit -aAnthony Liguori2011-04-131-0/+0
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* lm32: fix build breakage due to uninitialized variable 'r'Anthony Liguori2011-04-132-1/+1
| | | | | | | gcc 4.5.2 correctly complains that r is potentially uninitialized in this function. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* vpc.c: Use get_option_parameter() does the searchMitnick Lyu2011-04-131-6/+2
| | | | | | | | Use get_option_parameter() to instead of duplicating the loop, and use BDRV_SECTOR_SIZE to instead of 512 Signed-off-by: Mitnick Lyu <mitnick.lyu@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: GESN: implement 'media' subcommandAmit Shah2011-04-132-4/+115
| | | | | | | | | | | | | | | | | | | | Implement the 'media' sub-command of the GET_EVENT_STATUS_NOTIFICATION command. This helps us report tray open, tray closed, no media, media present states to the guest. Newer Linux kernels (2.6.38+) rely on this command to revalidate discs after media change. This patch also sends out tray open/closed status to the guest driver when requested e.g. via the CDROM_DRIVE_STATUS ioctl (thanks Markus). Without such notification, the guest and qemu's tray open/close status was frequently out of sync, causing installers like Anaconda detecting no disc instead of tray open, confusing them terribly. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: GESN: Standardise event response handling for future additionsAmit Shah2011-04-131-6/+19
| | | | | | | | | | | Handle GET_EVENT_STATUS_NOTIFICATION's No Event Available response in a generic way so that future additions to the code to handle other response types is easier. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: GESN: Use structs for commonly-used field typesAmit Shah2011-04-131-2/+14
| | | | | | | | | | Instead of using magic numbers, use structs that are more descriptive of the fields being used. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: Move GET_EVENT_STATUS_NOTIFICATION command handling to its own functionAmit Shah2011-04-131-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | This makes the code more readable. Also, there's a block like: if () { ... } else { ... } Split that into if () { ... return; } ... Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media changeAmit Shah2011-04-131-6/+14
| | | | | | | | | | | | After a media change, the only commands allowed from the guest were REQUEST_SENSE and INQUIRY. The guest may also issue GET_EVENT_STATUS_NOTIFICATION commands to get media changed notification. Signed-off-by: Amit Shah <amit.shah@redhat.com> Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: Report correct errors on guest eject requestAmit Shah2011-04-131-2/+6
| | | | | | | | | | | | Table 629 of the MMC-5 spec mentions two different error conditions when a CDROM eject is requested: a) while a disc is inserted and b) while a disc is not inserted. Ensure we return the appropriate error for the present condition of the drive and disc status. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* atapi: Drives can be locked without media presentAmit Shah2011-04-131-7/+2
| | | | | | | | | | Drivers are free to lock drives without any media present. Such a condition should not result in an error condition. See Table 341 in MMC-5 spec for details. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* qed: Add support for zero clustersAnthony Liguori2011-04-134-17/+66
| | | | | | | | | | | | | Zero clusters are similar to unallocated clusters except instead of reading their value from a backing file when one is available, the cluster is always read as zero. This implements read support only. At this stage, QED will never write a zero cluster. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* docs: Describe zero data clusters in QED specificationStefan Hajnoczi2011-04-131-0/+8
| | | | | | | | Zero data clusters are a space-efficient way of storing zeroed regions of the image. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* target-arm: Detect tininess before rounding for FP operationsPeter Maydell2011-04-121-0/+4
| | | | | | | | The ARM architecture mandates that we detect tininess before rounding, so set the softfloat fp_status up appropriately. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* softfloat: Add setter function for tininess detection modePeter Maydell2011-04-121-0/+4
| | | | | | | | | Add a setter function for the underflow tininess detection mode, in line with the similar functions for other parts of the float status structure. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
OpenPOWER on IntegriCloud