sdk/emulator/qemu.git
13 years agosoftfloat: add floatx80_compare*() functions
Aurelien Jarno [Wed, 20 Apr 2011 11:04:22 +0000 (13:04 +0200)]
softfloat: add floatx80_compare*() functions

Add floatx80_compare() and floatx80_compare_quiet() functions to match
the softfloat-native ones.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat-native: add a few constant values
Aurelien Jarno [Wed, 20 Apr 2011 11:04:22 +0000 (13:04 +0200)]
softfloat-native: add a few constant values

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: add pi constants
Aurelien Jarno [Wed, 20 Apr 2011 11:04:22 +0000 (13:04 +0200)]
softfloat: add pi constants

Add a pi constant for float32, float64, floatx80. It will be used by
target-i386 and later by the trigonometric functions.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: add floatx80 constants
Aurelien Jarno [Wed, 20 Apr 2011 11:04:22 +0000 (13:04 +0200)]
softfloat: add floatx80 constants

Add floatx80 constants similarly to float32 or float64.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: fix floatx80_is_infinity()
Aurelien Jarno [Wed, 20 Apr 2011 11:04:22 +0000 (13:04 +0200)]
softfloat: fix floatx80_is_infinity()

With floatx80, the explicit bit is set for infinity.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: fix floatx80 handling of NaN
Aurelien Jarno [Wed, 20 Apr 2011 11:04:22 +0000 (13:04 +0200)]
softfloat: fix floatx80 handling of NaN

The floatx80 format uses an explicit bit that should be taken into account
when converting to and from commonNaN format.

When converting to commonNaN, the explicit bit should be removed if it is
a 1, and a default NaN should be used if it is 0.

When converting from commonNan, the explicit bit should be added.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovmstate: port mac_dbdma
Juan Quintela [Thu, 2 Dec 2010 23:07:26 +0000 (00:07 +0100)]
vmstate: port mac_dbdma

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomac_dbdma: create DBDMAState instead of passing one array around
Juan Quintela [Thu, 2 Dec 2010 23:04:02 +0000 (00:04 +0100)]
mac_dbdma: create DBDMAState instead of passing one array around

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port piix4
Juan Quintela [Thu, 2 Dec 2010 15:59:33 +0000 (16:59 +0100)]
vmstate: port piix4

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agopiix4: create PIIX4State
Juan Quintela [Thu, 2 Dec 2010 15:26:56 +0000 (16:26 +0100)]
piix4: create PIIX4State

It only contains a PCIDevice by know, but it makes easy to use migration code

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port mac_nvram
Juan Quintela [Fri, 3 Dec 2010 00:59:09 +0000 (01:59 +0100)]
vmstate: port mac_nvram

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomac_nvram: size is a size, no need to be a target dependent type
Juan Quintela [Fri, 3 Dec 2010 00:54:21 +0000 (01:54 +0100)]
mac_nvram: size is a size, no need to be a target dependent type

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port nand
Juan Quintela [Fri, 3 Dec 2010 00:50:10 +0000 (01:50 +0100)]
vmstate: port nand

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agonand: pin values are uint8_t
Juan Quintela [Fri, 3 Dec 2010 00:39:22 +0000 (01:39 +0100)]
nand: pin values are uint8_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port max111x
Juan Quintela [Fri, 3 Dec 2010 00:03:59 +0000 (01:03 +0100)]
vmstate: port max111x

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agomax111x: input field is only used as uint8_t
Juan Quintela [Fri, 3 Dec 2010 00:03:10 +0000 (01:03 +0100)]
max111x: input field is only used as uint8_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pxa2xx_lcd
Juan Quintela [Thu, 2 Dec 2010 15:11:24 +0000 (16:11 +0100)]
vmstate: port pxa2xx_lcd

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agopxa2xx_lcd: up field is used as a bool and migrated as an uint8_t
Juan Quintela [Thu, 2 Dec 2010 15:01:57 +0000 (16:01 +0100)]
pxa2xx_lcd: up field is used as a bool and migrated as an uint8_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agopxa2xx_lcd: name anonymous struct
Juan Quintela [Thu, 2 Dec 2010 14:56:04 +0000 (15:56 +0100)]
pxa2xx_lcd: name anonymous struct

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: stellaris use unused for placeholder entries
Juan Quintela [Thu, 2 Dec 2010 13:07:44 +0000 (14:07 +0100)]
vmstate: stellaris use unused for placeholder entries

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port stellaris gamepad
Juan Quintela [Thu, 2 Dec 2010 01:36:38 +0000 (02:36 +0100)]
vmstate: port stellaris gamepad

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port syborg_keyboard
Juan Quintela [Wed, 1 Dec 2010 21:51:07 +0000 (22:51 +0100)]
vmstate: port syborg_keyboard

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port syborg_serial
Juan Quintela [Fri, 3 Dec 2010 01:10:53 +0000 (02:10 +0100)]
vmstate: port syborg_serial

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port stellaris_adc
Juan Quintela [Fri, 3 Dec 2010 00:27:58 +0000 (01:27 +0100)]
vmstate: port stellaris_adc

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port syborg_pointer
Juan Quintela [Thu, 2 Dec 2010 23:37:35 +0000 (00:37 +0100)]
vmstate: port syborg_pointer

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port ppc4xx_pci
Juan Quintela [Thu, 2 Dec 2010 16:27:49 +0000 (17:27 +0100)]
vmstate: port ppc4xx_pci

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port ppce500_pci
Juan Quintela [Thu, 2 Dec 2010 14:29:42 +0000 (15:29 +0100)]
vmstate: port ppce500_pci

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pxa2xx_pm
Juan Quintela [Thu, 2 Dec 2010 13:54:38 +0000 (14:54 +0100)]
vmstate: port pxa2xx_pm

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pxa2xx_mm
Juan Quintela [Thu, 2 Dec 2010 13:36:57 +0000 (14:36 +0100)]
vmstate: port pxa2xx_mm

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pxa2xx_cm
Juan Quintela [Thu, 2 Dec 2010 13:31:14 +0000 (14:31 +0100)]
vmstate: port pxa2xx_cm

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pxa2xx_i2s
Juan Quintela [Thu, 2 Dec 2010 13:14:56 +0000 (14:14 +0100)]
vmstate: port pxa2xx_i2s

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port stellaris gptm
Juan Quintela [Thu, 2 Dec 2010 13:07:01 +0000 (14:07 +0100)]
vmstate: port stellaris gptm

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port cuda
Juan Quintela [Thu, 2 Dec 2010 12:53:24 +0000 (13:53 +0100)]
vmstate: port cuda

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port heathrow_pic
Juan Quintela [Thu, 2 Dec 2010 12:17:23 +0000 (13:17 +0100)]
vmstate: port heathrow_pic

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pl022 ssp
Juan Quintela [Thu, 2 Dec 2010 11:43:50 +0000 (12:43 +0100)]
vmstate: port pl022 ssp

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port stellaris sys
Juan Quintela [Thu, 2 Dec 2010 02:03:11 +0000 (03:03 +0100)]
vmstate: port stellaris sys

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port stellaris ssi bus
Juan Quintela [Thu, 2 Dec 2010 01:51:29 +0000 (02:51 +0100)]
vmstate: port stellaris ssi bus

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port stellaris i2c
Juan Quintela [Thu, 2 Dec 2010 01:48:43 +0000 (02:48 +0100)]
vmstate: port stellaris i2c

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port armv7m nvic
Juan Quintela [Thu, 2 Dec 2010 01:17:33 +0000 (02:17 +0100)]
vmstate: port armv7m nvic

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pl011
Juan Quintela [Thu, 2 Dec 2010 00:50:33 +0000 (01:50 +0100)]
vmstate: port pl011

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pxa2xx_keypad
Juan Quintela [Thu, 2 Dec 2010 00:06:08 +0000 (01:06 +0100)]
vmstate: port pxa2xx_keypad

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port syborg_rtc
Juan Quintela [Wed, 1 Dec 2010 23:44:28 +0000 (00:44 +0100)]
vmstate: port syborg_rtc

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port pmtimer
Juan Quintela [Wed, 1 Dec 2010 22:51:14 +0000 (23:51 +0100)]
vmstate: port pmtimer

It was a half conversion.  Finish it.
enabled can only get values of 0, 1 or 2, was declared as an int but
sent as an unint8_t, change its type.

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port sysborg_timer
Juan Quintela [Wed, 1 Dec 2010 22:18:59 +0000 (23:18 +0100)]
vmstate: port sysborg_timer

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port arm_timer
Juan Quintela [Wed, 1 Dec 2010 22:15:41 +0000 (23:15 +0100)]
vmstate: port arm_timer

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port arm sp804
Juan Quintela [Wed, 1 Dec 2010 22:12:32 +0000 (23:12 +0100)]
vmstate: port arm sp804

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port mipsnet
Juan Quintela [Wed, 1 Dec 2010 22:02:56 +0000 (23:02 +0100)]
vmstate: port mipsnet

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port m48t59
Juan Quintela [Wed, 1 Dec 2010 23:16:33 +0000 (00:16 +0100)]
vmstate: port m48t59

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port ads7846
Juan Quintela [Wed, 1 Dec 2010 21:03:06 +0000 (22:03 +0100)]
vmstate: port ads7846

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port adb_mouse
Juan Quintela [Wed, 1 Dec 2010 20:56:35 +0000 (21:56 +0100)]
vmstate: port adb_mouse

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agovmstate: port adb_kbd
Juan Quintela [Wed, 1 Dec 2010 20:54:04 +0000 (21:54 +0100)]
vmstate: port adb_kbd

Signed-off-by: Juan Quintela <quintela@redhat.com>
13 years agotarget-arm: Set Invalid flag for NaN in float-to-int conversions
Peter Maydell [Tue, 19 Apr 2011 16:30:55 +0000 (17:30 +0100)]
target-arm: Set Invalid flag for NaN in float-to-int conversions

When we catch the special case of an input NaN in ARM float to int
helper functions, set the Invalid flag as well as returning the
correct result.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agohw/arm_boot.c: move initrd load address up to accommodate large kernels
Peter Maydell [Tue, 19 Apr 2011 15:32:34 +0000 (16:32 +0100)]
hw/arm_boot.c: move initrd load address up to accommodate large kernels

Newer kernels are large enough that they can overlap the address
where qemu places the initrd. Move the initrd up so that there is
enough space for the kernel again.

Unfortunately it's not possible to automatically determine the
size of the kernel if it is compressed, so this is the best we
can do.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoBasic implementation of Sharp Zaurus SL-5500 collie PDA
Dmitry Eremin-Solenikov [Tue, 19 Apr 2011 14:56:46 +0000 (18:56 +0400)]
Basic implementation of Sharp Zaurus SL-5500 collie PDA

Add very basic implementation of collie PDA emulation. The system lacks
LoCoMo and graphics/sound emulation. Linux kernel boots up to mounting
rootfs (theoretically it can be provided in pflash images).

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoImplement basic part of SA-1110/SA-1100
Dmitry Eremin-Solenikov [Tue, 19 Apr 2011 14:56:45 +0000 (18:56 +0400)]
Implement basic part of SA-1110/SA-1100

Basic implementation of DEC/Intel SA-1100/SA-1110 chips emulation.
Implemented:
 - IRQs
 - GPIO
 - PPC
 - RTC
 - UARTs (no IrDA/etc.)
 - OST reused from pxa25x

Everything else is TODO (esp. PM/idle/sleep!) - see the todo in the
hw/strongarm.c

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoRemove unused function parameter from cpu_restore_state
Stefan Weil [Mon, 18 Apr 2011 06:39:53 +0000 (06:39 +0000)]
Remove unused function parameter from cpu_restore_state

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>
13 years agoRemove unused function parameters from gen_pc_load and rename the function
Stefan Weil [Mon, 18 Apr 2011 06:39:52 +0000 (06:39 +0000)]
Remove unused function parameters from gen_pc_load and rename the function

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>
13 years agos390x: virtio machine storage keys
Alexander Graf [Fri, 15 Apr 2011 15:32:50 +0000 (17:32 +0200)]
s390x: virtio machine storage keys

For emulation (and migration) we need to know about the guest's storage keys.
These are separate from actual RAM contents, so we need to allocate them in
parallel to RAM.

While touching the file, this patch also adjusts the hypercall function
to a new syntax that aligns better with tcg emulated code.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: Dispatch interrupts to KVM or the real CPU
Alexander Graf [Fri, 15 Apr 2011 15:32:49 +0000 (17:32 +0200)]
s390x: Dispatch interrupts to KVM or the real CPU

The KVM interrupt injection path is non-generic for now. So we need to push
knowledge of how to inject a device interrupt using KVM into the actual device
code.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: Enable s390x-softmmu target
Alexander Graf [Fri, 15 Apr 2011 15:32:48 +0000 (17:32 +0200)]
s390x: Enable s390x-softmmu target

This patch adds some code paths for running s390x guest OSs without the
need for KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: Prepare cpu.h for emulation
Alexander Graf [Fri, 15 Apr 2011 15:32:47 +0000 (17:32 +0200)]
s390x: Prepare cpu.h for emulation

We need to add some more logic to the CPU description to leverage emulation
of an s390x CPU. This patch adds all the required helpers, fields in CPUState
and constant definitions required for user and system emulation.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomove helpers.h to helper.h
Lluís [Wed, 13 Apr 2011 16:38:24 +0000 (18:38 +0200)]
move helpers.h to helper.h

This provides a consistent naming scheme across all targets.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agolibcacard: fix opposite usage of isspace
Alon Levy [Wed, 13 Apr 2011 11:42:00 +0000 (14:42 +0300)]
libcacard: fix opposite usage of isspace

Signed-off-by: Alon Levy <alevy@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-mips: clear softfpu exception state for comparison instructions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:30 +0000 (00:49 +0200)]
target-mips: clear softfpu exception state for comparison instructions

MIPS FPU instructions should start with a clean softfpu status. This
is done for the most instructions, but not for comparison ones.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-mips: fix c.ps.* instructions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:30 +0000 (00:49 +0200)]
target-mips: fix c.ps.* instructions

Contrary to cabs.ps.* instructions, c.ps.* should not compare the absolute
value of the operand, but directly the operands.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-mips: don't hardcode softfloat exception bits
Aurelien Jarno [Wed, 13 Apr 2011 22:49:30 +0000 (00:49 +0200)]
target-mips: don't hardcode softfloat exception bits

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-mips: simplify FP comparisons
Aurelien Jarno [Wed, 13 Apr 2011 22:49:30 +0000 (00:49 +0200)]
target-mips: simplify FP comparisons

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>
13 years agotarget-ppc: fix SPE comparison functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:30 +0000 (00:49 +0200)]
target-ppc: fix SPE comparison functions

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>
13 years agosoftfloat: improve description of comparison functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:30 +0000 (00:49 +0200)]
softfloat: improve description of comparison functions

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>
13 years agosoftfloat: move float*_eq and float*_eq_quiet
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: move float*_eq and float*_eq_quiet

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>
13 years agosoftfloat: rename float*_eq_signaling() into float*_eq()
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: rename float*_eq_signaling() into float*_eq()

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>
13 years agosoftfloat: rename float*_eq() into float*_eq_quiet()
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: rename float*_eq() into float*_eq_quiet()

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>
13 years agotarget-i386: fix CMPUNORDPS/D and CMPORDPS/D instructions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: fix CMPUNORDPS/D and CMPORDPS/D instructions

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>
13 years agotarget-mips: use new float*_unordered*() functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-mips: use new float*_unordered*() functions

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>
13 years agotarget-alpha: use new float64_unordered_quiet() function
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-alpha: use new float64_unordered_quiet() function

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>
13 years agosoftfloat-native: add float*_unordered_quiet() functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat-native: add float*_unordered_quiet() functions

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>
13 years agosoftfloat: add float*_unordered_{,quiet}() functions
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: add float*_unordered_{,quiet}() functions

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>
13 years agotarget-i386: add floatx_{add,mul,sub} and use them
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: add floatx_{add,mul,sub} and use them

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>
13 years agotarget-i386: use float unions from cpu-all.h
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: use float unions from cpu-all.h

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>
13 years agotarget-i386: use CPU_LDoubleU instead of a private union
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
target-i386: use CPU_LDoubleU instead of a private union

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>
13 years agocpu-all.h: define CPU_LDoubleU
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
cpu-all.h: define CPU_LDoubleU

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>
13 years agosoftfloat: use GCC builtins to count the leading zeros
Aurelien Jarno [Wed, 13 Apr 2011 22:49:29 +0000 (00:49 +0200)]
softfloat: use GCC builtins to count the leading zeros

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>
13 years agousb: fix spelling errors in usb-linux.c
Brad Hards [Wed, 13 Apr 2011 09:45:33 +0000 (19:45 +1000)]
usb: fix spelling errors in usb-linux.c

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agousb: initialise data element in Linux USB_DISCONNECT ioctl
Brad Hards [Wed, 13 Apr 2011 09:45:32 +0000 (19:45 +1000)]
usb: initialise data element in Linux USB_DISCONNECT ioctl

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>
13 years agousb: trivial spelling fixes
Brad Hards [Wed, 13 Apr 2011 09:45:31 +0000 (19:45 +1000)]
usb: trivial spelling fixes

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoMakefile: Clean up after "make pdf"
Brad Hards [Wed, 13 Apr 2011 06:42:16 +0000 (16:42 +1000)]
Makefile: Clean up after "make pdf"

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoFix some typos in comments and documentation
Stefan Weil [Wed, 13 Apr 2011 20:45:22 +0000 (22:45 +0200)]
Fix some typos in comments and documentation

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>
13 years agomigration: move some declarations to migration.h
Blue Swirl [Sun, 3 Apr 2011 08:23:19 +0000 (08:23 +0000)]
migration: move some declarations to migration.h

Move a few migration related declarations to migration.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove CPU related functions to cpus.h
Blue Swirl [Sun, 27 Mar 2011 16:05:08 +0000 (16:05 +0000)]
Move CPU related functions to cpus.h

Move declarations of CPU related functions to cpus.h. Adjust the only user.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove clock related functions to qemu-timer.h
Blue Swirl [Sun, 27 Mar 2011 15:45:39 +0000 (15:45 +0000)]
Move clock related functions to qemu-timer.h

Move declarations for clock related functions from sysemu.h to qemu-timer.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMove generic or OS function declarations to qemu-common.h
Blue Swirl [Sun, 27 Mar 2011 09:04:57 +0000 (09:04 +0000)]
Move generic or OS function declarations to qemu-common.h

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>
13 years agoUse qemu-common.h or qemu-timer.h in place of sysemu.h
Blue Swirl [Sun, 27 Mar 2011 14:31:31 +0000 (14:31 +0000)]
Use qemu-common.h or qemu-timer.h in place of sysemu.h

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>
13 years agoRemove unused sysemu.h include directives
Blue Swirl [Sun, 27 Mar 2011 14:12:29 +0000 (14:12 +0000)]
Remove unused sysemu.h include directives

Remove unused sysemu.h include directives to speed up build
with the following patches.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agojson-lexer: fix conflict with mingw32 ERROR definition
Blue Swirl [Sun, 27 Mar 2011 09:07:54 +0000 (09:07 +0000)]
json-lexer: fix conflict with mingw32 ERROR definition

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>
13 years agosparc: Fix assertion caused by empty memory slot with 0 byte
Stefan Weil [Thu, 14 Apr 2011 17:19:00 +0000 (19:19 +0200)]
sparc: Fix assertion caused by empty memory slot with 0 byte

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>
13 years agoqemu_next_deadline should not consider host-time timers
Paolo Bonzini [Wed, 13 Apr 2011 08:03:46 +0000 (10:03 +0200)]
qemu_next_deadline should not consider host-time timers

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>
13 years agoRevert wrong fixes for -icount in the iothread case
Paolo Bonzini [Wed, 13 Apr 2011 08:03:45 +0000 (10:03 +0200)]
Revert wrong fixes for -icount in the iothread case

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>
13 years agoenable vm_clock to "warp" in the iothread+icount case
Paolo Bonzini [Wed, 13 Apr 2011 08:03:44 +0000 (10:03 +0200)]
enable vm_clock to "warp" in the iothread+icount case

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>
13 years agoreally fix -icount in the iothread case
Paolo Bonzini [Wed, 13 Apr 2011 08:03:43 +0000 (10:03 +0200)]
really fix -icount in the iothread case

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>
13 years agotests/test-mmap.c: Check mmap() return value before using it
Peter Maydell [Thu, 14 Apr 2011 13:11:56 +0000 (14:11 +0100)]
tests/test-mmap.c: Check mmap() return value before using it

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>