]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
12 years agospice: adding seamless-migration option to the command line
Yonit Halperin [Tue, 21 Aug 2012 08:51:59 +0000 (11:51 +0300)] 
spice: adding seamless-migration option to the command line

The seamless-migration flag is required in order to identify
whether libvirt supports the new QEVENT_SPICE_MIGRATE_COMPLETED or not
(by default the flag is off).
New libvirt versions that wait for QEVENT_SPICE_MIGRATE_COMPLETED should turn on this flag.
When this flag is off, spice fallbacks to its old migration method, which
can result in data loss.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 8c9570530c819821b9b5cc3113d2b2966afe7621)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agospice: add 'migrated' flag to spice info
Yonit Halperin [Tue, 21 Aug 2012 08:51:58 +0000 (11:51 +0300)] 
spice: add 'migrated' flag to spice info

The flag is 'true' when spice migration has completed on the src side.
It is needed for a case where libvirt dies before migration completes
and it misses the event QEVENT_SPICE_MIGRATE_COMPLETED.
When libvirt is restored and queries the migration status, it also needs
to query spice and check if its migration has completed.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 61c4efe2cb85b0a9c6bc68f6a2dd107c8d7ec080)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agospice migration: add QEVENT_SPICE_MIGRATE_COMPLETED
Yonit Halperin [Tue, 21 Aug 2012 08:51:57 +0000 (11:51 +0300)] 
spice migration: add QEVENT_SPICE_MIGRATE_COMPLETED

When migrating, libvirt queries the migration status, and upon migration
completions, it closes the migration src. On the other hand, when
migration is completed, spice transfers data from the src to destination
via the client. This data is required for keeping the spice session
after migration, without suffering from data loss and inconsistencies.
In order to allow this data transfer, we add QEVENT for signaling
libvirt that spice migration has completed, and libvirt needs to wait
for this event before quitting the src process.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 2fdd16e239c2a2763aa3266e637718123328688c)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agospice: notify on vm state change only via spice_server_vm_start/stop
Yonit Halperin [Tue, 21 Aug 2012 08:51:56 +0000 (11:51 +0300)] 
spice: notify on vm state change only via spice_server_vm_start/stop

QXLWorker->start/stop are deprecated since spice-server 0.11.2

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 71d388d420e68ac77cd42f15f7e68cf5a6fb01b2)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agospice: notify spice server on vm start/stop
Yonit Halperin [Tue, 21 Aug 2012 08:51:55 +0000 (11:51 +0300)] 
spice: notify spice server on vm start/stop

Spice server needs to know about the vm state in order to prevent
attempts to write to devices when they are stopped, mainly during
the non-live stage of migration.
Instead, spice will take care of restoring this writes, on the migration
target side, after migration completes.

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit f5bb039c6d97ef3e664094eab3c9a4dc1824ed73)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agospice: abort on invalid streaming cmdline params
Christophe Fergeau [Mon, 13 Aug 2012 08:32:32 +0000 (10:32 +0200)] 
spice: abort on invalid streaming cmdline params

When parsing its command line parameters, spice aborts when it
finds unexpected values, except for the 'streaming-video' option.
This happens because the parsing of the parameters for this option
is done using the 'name2enum' helper, which does not error out
on unknown values. Using the 'parse_name' helper makes sure we
error out in this case. Looking at git history, the use of
'name2enum' instead of 'parse_name' seems to have been an oversight,
so let's change to that now.

Fixes rhbz#831708

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 835cab85ad83ed8dfe1c13243aeda5959b153e3e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotci: Fix for AREG0 free mode
Stefan Weil [Tue, 18 Sep 2012 20:43:38 +0000 (22:43 +0200)] 
tci: Fix for AREG0 free mode

Support for helper functions with 5 arguments was missing
in the code generator and in the interpreter.

There is no need to pass the constant TCG_AREG0 from the
code generator to the interpreter. Remove that code for
the INDEX_op_qemu_st* opcodes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: Fix MAX_OPC_PARAM_IARGS
Stefan Weil [Wed, 12 Sep 2012 17:18:55 +0000 (19:18 +0200)] 
tcg: Fix MAX_OPC_PARAM_IARGS

DEF_HELPER_FLAGS_5 was added some time ago without adjusting
MAX_OPC_PARAM_IARGS.

Fixing the definition becomes more important as QEMU is using
an increasing number of helper functions called with 5 arguments.

Add also a comment to avoid future problems when DEF_HELPER_FLAGS_6
will be added.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/i386: fix build with -march < i686
Aurelien Jarno [Tue, 25 Sep 2012 22:30:12 +0000 (00:30 +0200)] 
tcg/i386: fix build with -march < i686

The movcond_i32 op has to be protected with TCG_TARGET_HAS_movcond_i32
to fix the build with -march < i686.

Thanks to Richard Henderson for the hint.

Reported-by: Alex Barcelo <abarcelo@ac.upc.edu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: Adjust descriptions of *cond opcodes
Richard Henderson [Sat, 22 Sep 2012 00:18:09 +0000 (17:18 -0700)] 
tcg: Adjust descriptions of *cond opcodes

The README file documented the operand ordering of the tcg_gen_*
functions.  Since we're documenting opcodes here, use the true
operand ordering.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Cc: malc <av1474@comtv.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: fix MIPS32(R2) detection
Aurelien Jarno [Sat, 22 Sep 2012 21:08:38 +0000 (23:08 +0200)] 
tcg/mips: fix MIPS32(R2) detection

Fix the MIPS32(R2) cpu detection so that it also works with
-march=octeon. Thanks to Andrew Pinski for the hint.

Cc: Andrew Pinski <apinski@cavium.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-alpha: Initialize env->cpu_model_str
Richard Henderson [Fri, 21 Sep 2012 12:15:36 +0000 (14:15 +0200)] 
target-alpha: Initialize env->cpu_model_str

Save the cpu_model_str so that we have a non-null value when
creating a new cpu during clone.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Preserve branch destinations during retranslation
Richard Henderson [Fri, 21 Sep 2012 18:00:23 +0000 (11:00 -0700)] 
tcg-sparc: Preserve branch destinations during retranslation

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Fix and enable direct TB chaining.
Richard Henderson [Fri, 21 Sep 2012 17:48:51 +0000 (10:48 -0700)] 
tcg-sparc: Fix and enable direct TB chaining.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Add %g/%o registers to alloc_order
Richard Henderson [Sun, 25 Mar 2012 20:43:17 +0000 (22:43 +0200)] 
tcg-sparc: Add %g/%o registers to alloc_order

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Use defines for temporaries.
Richard Henderson [Sun, 25 Mar 2012 20:04:59 +0000 (22:04 +0200)] 
tcg-sparc: Use defines for temporaries.

And change from %i4/%i5 to %g1/%o7 to remove a v8plus fixme.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Mask shift immediates to avoid illegal insns.
Richard Henderson [Sun, 25 Mar 2012 19:36:28 +0000 (21:36 +0200)] 
tcg-sparc: Mask shift immediates to avoid illegal insns.

The xtensa-test image generates a sra_i32 with count 0x40.
Whether this is accident of tcg constant propagation or
originating directly from the instruction stream is immaterial.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Clean up cruft stemming from attempts to use global registers.
Richard Henderson [Sun, 25 Mar 2012 19:21:46 +0000 (21:21 +0200)] 
tcg-sparc: Clean up cruft stemming from attempts to use global registers.

Don't use -ffixed-gN.  Don't link statically.  Don't save/restore
AREG0 around calls.  Don't allocate space on the stack for AREG0 save.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Change AREG0 in generated code to %i0.
Richard Henderson [Sun, 25 Mar 2012 17:52:11 +0000 (19:52 +0200)] 
tcg-sparc: Change AREG0 in generated code to %i0.

We can now move the TCG variable from %g[56] to a call-preserved
windowed register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Support GUEST_BASE.
Richard Henderson [Sat, 24 Mar 2012 21:11:25 +0000 (22:11 +0100)] 
tcg-sparc: Support GUEST_BASE.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Fix qemu_ld/st to handle 32-bit host.
Richard Henderson [Fri, 23 Mar 2012 22:27:39 +0000 (23:27 +0100)] 
tcg-sparc: Fix qemu_ld/st to handle 32-bit host.

At the same time, split out the tlb load logic to a new function.
Fixes the cases of two data registers and two address registers.
Fixes the signature of, and adds missing, qemu_ld/st opcodes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode.
Richard Henderson [Fri, 21 Sep 2012 17:34:21 +0000 (10:34 -0700)] 
tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode.

Current code doesn't actually work in 32-bit mode at all.  Since
no one really noticed, drop the complication of v7 and v8 cpus.
Eliminate the --sparc_cpu configure option and standardize macro
testing on TCG_TARGET_REG_BITS / HOST_LONG_BITS

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Don't MAP_FIXED on top of the program
Richard Henderson [Fri, 21 Sep 2012 17:40:48 +0000 (10:40 -0700)] 
tcg-sparc: Don't MAP_FIXED on top of the program

The address we pick in sparc64.ld is also 0x60000000, so doing a fixed map
on top of that is guaranteed to blow up.  Choosing 0x40000000 is exactly
right for the max of code_gen_buffer_size set below.

No need to ever use MAP_FIXED.  While getting our desired address helps
optimize the generated code, we won't fail if we don't get it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Fix ADDX opcode.
Richard Henderson [Fri, 23 Mar 2012 22:57:12 +0000 (23:57 +0100)] 
tcg-sparc: Fix ADDX opcode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-sparc: Hack in qemu_ld/st64 for 32-bit.
Richard Henderson [Sat, 24 Mar 2012 20:30:20 +0000 (21:30 +0100)] 
tcg-sparc: Hack in qemu_ld/st64 for 32-bit.

Not actually implemented, but at least we avoid the tcg assert at startup.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/ppc32: Implement movcond32
malc [Sat, 22 Sep 2012 15:14:33 +0000 (19:14 +0400)] 
tcg/ppc32: Implement movcond32

Thanks to Richard Henderson

Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agow64: Fix TCG helper functions with 5 arguments
Stefan Weil [Thu, 13 Sep 2012 17:37:43 +0000 (19:37 +0200)] 
w64: Fix TCG helper functions with 5 arguments

TCG uses 6 registers for function arguments on 64 bit Linux hosts,
but only 4 registers on W64 hosts.

Commit 2999a0b20074a7e4a58f56572bb1436749368f59 increased the number
of arguments for some important helper functions from 4 to 5
which triggered a bug for W64 hosts: QEMU aborts when executing
helper_lcall_real in the guest's BIOS because function
tcg_target_get_call_iarg_regs_count always returned 6.

As W64 has only 4 registers for arguments, the 5th argument must be
passed on the stack using a correct stack offset.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/README: document tcg_gen_goto_tb restrictions
Max Filippov [Fri, 21 Sep 2012 00:18:07 +0000 (04:18 +0400)] 
tcg/README: document tcg_gen_goto_tb restrictions

See
http://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03196.html
for the whole story.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: add constant folding for deposit
Aurelien Jarno [Fri, 21 Sep 2012 09:07:29 +0000 (11:07 +0200)] 
tcg/optimize: add constant folding for deposit

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: remove #ifdef #endif around TCGOpcode tests
Aurelien Jarno [Fri, 21 Sep 2012 08:02:45 +0000 (10:02 +0200)] 
tcg: remove #ifdef #endif around TCGOpcode tests

Commit 25c4d9cc changed all TCGOpcode enums to be available, so we don't
need to #ifdef #endif the one that are available only on some targets.
This makes the code easier to read.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: prefer the "op a, a, b" form for commutative ops
Aurelien Jarno [Wed, 19 Sep 2012 20:00:22 +0000 (22:00 +0200)] 
tcg/optimize: prefer the "op a, a, b" form for commutative ops

The "op a, a, b" form is better handled on non-RISC host than the "op
a, b, a" form, so swap the arguments to this form when possible, and
when b is not a constant.

This reduces the number of generated instructions by a tiny bit.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: further optimize brcond/movcond/setcond
Aurelien Jarno [Tue, 18 Sep 2012 17:37:00 +0000 (19:37 +0200)] 
tcg/optimize: further optimize brcond/movcond/setcond

When both argument of brcond/movcond/setcond are the same or when one
of the two values is a constant equal to zero, it's possible to do
further optimizations.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: optimize "op r, a, a => movi r, 0"
Aurelien Jarno [Tue, 18 Sep 2012 17:12:36 +0000 (19:12 +0200)] 
tcg/optimize: optimize "op r, a, a => movi r, 0"

Now that it's possible to detect copies, we can optimize the case
the "op r, a, a => movi r, 0". This helps in the computation of
overflow flags when one of the two args is 0.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: optimize "op r, a, a => mov r, a"
Aurelien Jarno [Tue, 18 Sep 2012 17:11:32 +0000 (19:11 +0200)] 
tcg/optimize: optimize "op r, a, a => mov r, a"

Now that we can easily detect all copies, we can optimize the
"op r, a, a => mov r, a" case a bit more.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: do copy propagation for all operations
Aurelien Jarno [Tue, 11 Sep 2012 14:18:49 +0000 (16:18 +0200)] 
tcg/optimize: do copy propagation for all operations

It is possible to due copy propagation for all operations, even the one
that have side effects or clobber arguments (it only concerns input
arguments). That said, the call operation should be handled differently
due to the variable number of arguments.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: rework copy progagation
Aurelien Jarno [Tue, 11 Sep 2012 10:31:21 +0000 (12:31 +0200)] 
tcg/optimize: rework copy progagation

The copy propagation pass tries to keep track what is a copy of what
and what has copy of what, and in addition it keep a circular list of
of all the copies. Unfortunately this doesn't fully work: a mov from
a temp which has a state "COPY" changed it into a state "HAS_COPY".
Later when this temp is used again, it is considered has not having
copy and thus no propagation is done.

This patch fixes that by removing the hiearchy between copies, and thus
only keeping a "COPY" state both meaning "is a copy" and "has a copy".
The decision of which copy to use is deferred to the actual temp
replacement. At this stage there is not one best choice to do, but only
better choices than others. For doing the best choice the operation
would have to be parsed in reversed to know if a temp is going to be
used later or not. That what is done by the liveness analysis. At this
stage it is known that globals will be always live, that local temps
will be dead at the end of the translation block, and that the temps
will be dead at the end of the basic block. This means that this stage
should try to replace temps by local temps or globals and local temps
by globals.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: check types in copy propagation
Aurelien Jarno [Tue, 11 Sep 2012 10:26:23 +0000 (12:26 +0200)] 
tcg/optimize: check types in copy propagation

The copy propagation doesn't check the types of the temps during copy
propagation. However TCG is using the mov_i32 for the i64 to i32
conversion and thus the two are not equivalent.

With this patch tcg_opt_gen_mov() doesn't consider two temps of
different type as copies anymore.

So far it seems the optimization was not aggressive enough to trigger
this bug, but it will be triggered later in this series once the copy
propagation is improved.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: remove TCG_TEMP_ANY
Aurelien Jarno [Mon, 10 Sep 2012 21:51:42 +0000 (23:51 +0200)] 
tcg/optimize: remove TCG_TEMP_ANY

TCG_TEMP_ANY has no different meaning than TCG_TEMP_UNDEF, so use
the later instead.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: implement movcond op on MIPS32R2
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: implement movcond op on MIPS32R2

movcond operation can be implemented on MIPS32 Release 2 using the MOVN,
MOVZ, SLT and SLTU instructions.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: implement deposit op on MIPS32R2
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: implement deposit op on MIPS32R2

deposit operations can be optimized on MIPS32 Release 2 using the INS
instruction.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: implement rotl/rotr ops on MIPS32R2
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: implement rotl/rotr ops on MIPS32R2

rotr operations can be optimized on MIPS32 Release 2 using the ROTR and
ROTRV instructions. Also implemented rotl operations by subtracting the
shift from 32.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: optimize bswap{16,16s,32} on MIPS32R2
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: optimize bswap{16,16s,32} on MIPS32R2

bswap operations can be optimized on MIPS32 Release 2 using the ROTR,
WSBH and SEH instructions. We can't use the non-R2 code to implement the
ops due to registers constraints, so don't define the corresponding
TCG_TARGET_HAS_bswap* values.

Also bswap16* operations are supposed to be called with the 16 high bits
zeroed. This is the case everywhere (including for TCG by definition)
except when called from the store helper. Remove the AND instructions from
bswap16* and move it there.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: optimize brcond arg, 0
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: optimize brcond arg, 0

MIPS has some conditional branch instructions when comparing with zero.
Use them.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: use stack for TCG temps
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: use stack for TCG temps

Use stack instead of temp_buf array in CPUState for TCG
temps.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: don't use global pointer
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: don't use global pointer

Don't use the global pointer in TCG, in case helpers try access global
variables.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: use TCGArg or TCGReg instead of int
Aurelien Jarno [Fri, 21 Sep 2012 16:20:26 +0000 (18:20 +0200)] 
tcg/mips: use TCGArg or TCGReg instead of int

Instead of int, use the correct TCGArg and TCGReg type: TCGReg when
representing a TCG target register, TCGArg when representing the latter
or a constant.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/mips: kill warnings in user mode
Aurelien Jarno [Fri, 21 Sep 2012 16:20:25 +0000 (18:20 +0200)] 
tcg/mips: kill warnings in user mode

Recent versions of GCC emit warnings when compiling user mode targets.
Kill them by reordering a bit the #ifdef.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-mips: fix wrong usage of 'Z' constraint
Aurelien Jarno [Fri, 21 Sep 2012 16:20:25 +0000 (18:20 +0200)] 
tcg-mips: fix wrong usage of 'Z' constraint

The 'Z' constraint has been introduced to map the zero register. However
when the op also accept a constant, there is no point to accept the zero
register in addition.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-hppa: Fix broken load/store helpers
Richard Henderson [Wed, 19 Sep 2012 02:59:48 +0000 (19:59 -0700)] 
tcg-hppa: Fix broken load/store helpers

The CONFIG_TCG_PASS_AREG0 code for calling ld/st helpers
was not respecting the ABI requirement for 64-bit values
being aligned in registers.

Mirror the ARM port in use of helper functions to marshal
arguments into the correct registers.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-hppa: Fix brcond2 and setcond2
Richard Henderson [Wed, 19 Sep 2012 02:59:47 +0000 (19:59 -0700)] 
tcg-hppa: Fix brcond2 and setcond2

Neither of these functions were performing double-word
compares properly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: Fix !USE_DIRECT_JUMP
Richard Henderson [Mon, 17 Sep 2012 15:28:52 +0000 (08:28 -0700)] 
tcg: Fix !USE_DIRECT_JUMP

Commit 6375e09e changed the type of TranslationBlock.tb_next,
but failed to change the type of TCGContext.tb_next.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agogdbstub/sh4: fix build with USE_SOFTFLOAT_STRUCT_TYPES
Aurelien Jarno [Sun, 16 Sep 2012 11:12:21 +0000 (13:12 +0200)] 
gdbstub/sh4: fix build with USE_SOFTFLOAT_STRUCT_TYPES

We have to use different type to access float values when
USE_SOFTFLOAT_STRUCT_TYPES is defined.

Rework SH4 version of cpu_gdb_{read,write}_register() using
a single case, and fixing the coding style. Use ldll_p() and
stfl_p() to access float values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: Optimize two-address commutative operations
Richard Henderson [Fri, 21 Sep 2012 17:13:38 +0000 (10:13 -0700)] 
tcg: Optimize two-address commutative operations

While swapping constants to the second operand, swap
sources matching destinations to the first operand.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: Optimize movcond for constant comparisons
Richard Henderson [Fri, 21 Sep 2012 17:13:37 +0000 (10:13 -0700)] 
tcg: Optimize movcond for constant comparisons

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg-i386: Implement movcond
Richard Henderson [Fri, 21 Sep 2012 17:13:36 +0000 (10:13 -0700)] 
tcg-i386: Implement movcond

Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-alpha: Use movcond
Richard Henderson [Fri, 21 Sep 2012 17:13:35 +0000 (10:13 -0700)] 
target-alpha: Use movcond

For proper cmov insns, as well as the non-goto-tb case
of conditional branch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: Introduce movcond
Richard Henderson [Fri, 21 Sep 2012 17:13:34 +0000 (10:13 -0700)] 
tcg: Introduce movcond

Implemented with setcond if the target does not provide
the optional opcode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-xtensa: don't emit extra tcg_gen_goto_tb
Max Filippov [Thu, 20 Sep 2012 22:59:50 +0000 (02:59 +0400)] 
target-xtensa: don't emit extra tcg_gen_goto_tb

Unconditional gen_check_loop_end at the end of disas_xtensa_insn
can emit tcg_gen_goto_tb with slot id already used in the TB (e.g. when
TB ends at LEND with a branch).

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-xtensa: fix extui shift amount
Max Filippov [Thu, 20 Sep 2012 22:59:49 +0000 (02:59 +0400)] 
target-xtensa: fix extui shift amount

extui opcode only uses lowermost op1 bit for sa4.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: fix end of basic block detection
Aurelien Jarno [Wed, 19 Sep 2012 19:40:30 +0000 (21:40 +0200)] 
tcg/optimize: fix end of basic block detection

Commit e31b0a7c050711884ad570fe73df806520953618 fixed copy propagation on
32-bit host by restricting the copy between different types. This was the
wrong fix.

The real problem is that the all temps states should be reset at the end
of a basic block. This was done by adding such operations in the switch,
but brcond2 was forgotten (that's why the crash was only observed on 32-bit
hosts).

Fix that by looking at the TCG_OPF_BB_END instead. We need to keep the case
for op_set_label as temps might be modified through another path.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-mips: Always evaluate debugging macro arguments
Richard Henderson [Wed, 19 Sep 2012 04:55:34 +0000 (21:55 -0700)] 
target-mips: Always evaluate debugging macro arguments

this will prevent some of the compilation errors with debugging
enabled from creeping back in.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-mips: Fix MIPS_DEBUG.
Richard Henderson [Wed, 19 Sep 2012 04:55:33 +0000 (21:55 -0700)] 
target-mips: Fix MIPS_DEBUG.

The macro uses the DisasContext.  Pass it around as needed.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-mips: Set opn in gen_ldst_multiple.
Richard Henderson [Wed, 19 Sep 2012 04:55:32 +0000 (21:55 -0700)] 
target-mips: Set opn in gen_ldst_multiple.

Used by MIPS_DEBUG, when enabled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agorevert "TCG: fix copy propagation"
Aurelien Jarno [Mon, 10 Sep 2012 11:14:12 +0000 (13:14 +0200)] 
revert "TCG: fix copy propagation"

Given the copy propagation breakage on 32-bit hosts has been fixed
commit e31b0a7c050711884ad570fe73df806520953618 can be reverted.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg: mark set_label with TCG_OPF_BB_END flag
Aurelien Jarno [Mon, 10 Sep 2012 12:23:49 +0000 (14:23 +0200)] 
tcg: mark set_label with TCG_OPF_BB_END flag

set_label is effectively the end of a basic block, as no optimization
can be made accross it. It was treated as such in the liveness analysis
code, but as a special case.

Mark it with TCG_OPF_BB_END flag so that this information can be used
by other parts of the TCG code, and remove the special case in the liveness
analysis code.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/i386: allow constants in load/store ops
Aurelien Jarno [Mon, 10 Sep 2012 11:56:24 +0000 (13:56 +0200)] 
tcg/i386: allow constants in load/store ops

On x86, it is possible to move a constant value to memory. Add code to
handle a constant argument to load/store ops.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agoRemove unused CONFIG_TCG_PASS_AREG0 and dead code
Blue Swirl [Sun, 2 Sep 2012 15:28:56 +0000 (15:28 +0000)] 
Remove unused CONFIG_TCG_PASS_AREG0 and dead code

Now that CONFIG_TCG_PASS_AREG0 is enabled for all targets,
remove dead code and support for !CONFIG_TCG_PASS_AREG0 case.

Remove dyngen-exec.h and all references to it. Although included by
hw/spapr_hcall.c, it does not seem to use it.

Remove unused HELPER_CFLAGS.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-mips: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 14:52:59 +0000 (14:52 +0000)] 
target-mips: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0
and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-sh4: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 10:37:06 +0000 (10:37 +0000)] 
target-sh4: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0
and switch to AREG0 free mode.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-cris: Switch to AREG0 free mode
Aurelien Jarno [Fri, 7 Sep 2012 14:13:27 +0000 (16:13 +0200)] 
target-cris: Switch to AREG0 free mode

Add an explicit CPUCRISState parameter instead of relying on AREG0, and
use cpu_ld* in translation and interrupt handling. Remove AREG0 swapping
in tlb_fill(). Switch to AREG0 free mode

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-cris: Avoid AREG0 for helpers
Aurelien Jarno [Thu, 30 Aug 2012 14:56:39 +0000 (16:56 +0200)] 
target-cris: Avoid AREG0 for helpers

Add an explicit CPUCRISState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-microblaze: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 08:39:22 +0000 (08:39 +0000)] 
target-microblaze: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0
and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-arm: final conversion to AREG0 free mode
Blue Swirl [Tue, 4 Sep 2012 20:25:59 +0000 (20:25 +0000)] 
target-arm: final conversion to AREG0 free mode

Convert code load functions and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-arm: convert remaining helpers
Blue Swirl [Tue, 4 Sep 2012 20:19:15 +0000 (20:19 +0000)] 
target-arm: convert remaining helpers

Convert remaining helpers to AREG0 free mode: add an explicit
CPUState parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-arm: convert void helpers
Blue Swirl [Tue, 4 Sep 2012 20:08:34 +0000 (20:08 +0000)] 
target-arm: convert void helpers

Add an explicit CPUState parameter instead of relying on AREG0.

For easier review, convert only op helpers which don't return any value.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-unicore32: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 07:42:33 +0000 (07:42 +0000)] 
target-unicore32: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0
and switch to AREG0 free mode.

Tested-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-m68k: avoid using cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 10:48:20 +0000 (10:48 +0000)] 
target-m68k: avoid using cpu_single_env

Pass around CPUState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-m68k: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 07:27:38 +0000 (07:27 +0000)] 
target-m68k: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0
and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-lm32: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 06:57:17 +0000 (06:57 +0000)] 
target-lm32: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0
and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: avoid cpu_single_env
Blue Swirl [Sat, 8 Sep 2012 11:15:37 +0000 (11:15 +0000)] 
target-s390x: avoid cpu_single_env

Pass around CPUState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: fix if/else/break coding style
Aurelien Jarno [Fri, 7 Sep 2012 10:24:32 +0000 (12:24 +0200)] 
tcg/optimize: fix if/else/break coding style

optimizer.c contains some cases were the break is appearing in both the
if and the else parts. Fix that by moving it to the outer part. Also
move some common code there.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: add constant folding for brcond
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)] 
tcg/optimize: add constant folding for brcond

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: add constant folding for setcond
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)] 
tcg/optimize: add constant folding for setcond

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: swap brcond/setcond arguments when possible
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)] 
tcg/optimize: swap brcond/setcond arguments when possible

brcond and setcond ops are not commutative, but it's easy to compute the
new condition after swapping the arguments. Try to always put the constant
argument in second position like for commutative ops, to help backends to
generate better code.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: simplify shift/rot r, 0, a => movi r, 0 cases
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)] 
tcg/optimize: simplify shift/rot r, 0, a => movi r, 0 cases

shift/rot r, 0, a is equivalent to movi r, 0.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: simplify and r, a, 0 cases
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)] 
tcg/optimize: simplify and r, a, 0 cases

and r, a, 0 is equivalent to a movi r, 0.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: simplify or/xor r, a, 0 cases
Aurelien Jarno [Thu, 6 Sep 2012 14:47:14 +0000 (16:47 +0200)] 
tcg/optimize: simplify or/xor r, a, 0 cases

or/xor r, a, 0 is equivalent to a mov r, a.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/optimize: split expression simplification
Aurelien Jarno [Thu, 6 Sep 2012 14:47:13 +0000 (16:47 +0200)] 
tcg/optimize: split expression simplification

Split expression simplification in multiple parts so that a given op
can appear multiple times. This patch should not change anything.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-arm: Fix potential buffer overflow
Stefan Weil [Tue, 4 Sep 2012 05:35:57 +0000 (07:35 +0200)] 
target-arm: Fix potential buffer overflow

Report from smatch:

target-arm/helper.c:651 arm946_prbs_read(6) error:
 buffer overflow 'env->cp15.c6_region' 8 <= 8
target-arm/helper.c:661 arm946_prbs_write(6) error:
 buffer overflow 'env->cp15.c6_region' 8 <= 8

c7_region is an array with 8 elements, so the index must be less than 8.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0
Aurelien Jarno [Sat, 8 Sep 2012 03:45:43 +0000 (03:45 +0000)] 
tcg/s390: fix ld/st with CONFIG_TCG_PASS_AREG0

The load/store slow path has been broken in e141ab52d:
- We need to move 4 registers for store functions and 3 registers for
  load functions and not the reverse.
- According to the s390x calling convention the arguments of a function
  should be zero extended. This means that the register shift should be
  done with TCG_TYPE_I64 to ensure the higher word is correctly zero
  extended when needed.

I am aware that CONFIG_TCG_PASS_AREG0 is being removed and thus that
this patch can be improved, but doing so means it can also be applied to
the 1.1 and 1.2 stable branches.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: switch to AREG0 free mode
Blue Swirl [Sun, 2 Sep 2012 07:33:40 +0000 (07:33 +0000)] 
target-s390x: switch to AREG0 free mode

Add an explicit CPUState parameter instead of relying on AREG0.

Remove temporary wrappers and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflicts]
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: avoid AREG0 for misc helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:39 +0000 (07:33 +0000)] 
target-s390x: avoid AREG0 for misc helpers

Make misc helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflict]
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: avoid AREG0 for condition code helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:38 +0000 (07:33 +0000)] 
target-s390x: avoid AREG0 for condition code helpers

Make condition code helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: avoid AREG0 for integer helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:37 +0000 (07:33 +0000)] 
target-s390x: avoid AREG0 for integer helpers

Make integer helpers take a parameter for CPUState instead
of relying on global env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: avoid AREG0 for FPU helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:36 +0000 (07:33 +0000)] 
target-s390x: avoid AREG0 for FPU helpers

Make FPU helpers take a parameter for CPUState instead
of relying on global env.

Introduce temporary wrappers for FPU load and store ops.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: rename op_helper.c to misc_helper.c
Blue Swirl [Sun, 2 Sep 2012 07:33:35 +0000 (07:33 +0000)] 
target-s390x: rename op_helper.c to misc_helper.c

Now op_helper.c contains miscellaneous helpers, rename
it to misc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fix conflict]
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: split memory access helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:34 +0000 (07:33 +0000)] 
target-s390x: split memory access helpers

Move memory access helpers to mem_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
[agraf: fold softmmu include ifdefs together]
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: split integer helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:33 +0000 (07:33 +0000)] 
target-s390x: split integer helpers

Move integer helpers to int_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: split condition code helpers
Blue Swirl [Sun, 2 Sep 2012 07:33:32 +0000 (07:33 +0000)] 
target-s390x: split condition code helpers

Move condition code helpers to cc_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
12 years agotarget-s390x: split FPU ops
Blue Swirl [Sun, 2 Sep 2012 07:33:31 +0000 (07:33 +0000)] 
target-s390x: split FPU ops

Move floating point instructions to fpu_helper.c.

While exporting some condition code helpers,
avoid duplicate identifier conflict with translate.c.

Remove unused set_cc_nz_f64() in translate.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>