Statistics
| Branch: | Revision:

root @ 8bdd3d49

# Date Author Comment
8bdd3d49 09/26/2012 02:44 am Stefan Weil

configure: Allow builds without any system or user emulation

The old code aborted configure when no emulation target was selected.
Even after removing the 'exit 1', it tried to read from STDIN
when QEMU was configured with

configure' '--disable-user' '--disable-system'...
f4306941 09/26/2012 02:38 am Gerd Hoffmann

add pc-1.3 machine type

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

183c5eaa 09/26/2012 02:38 am Gerd Hoffmann

compat: turn off msi/msix on xhci for old machine types

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

c08ba66f 09/26/2012 02:38 am Gerd Hoffmann

ivshmem: add 64bit option

This patch adds a "use64" property which will make the ivshmem driver
register a 64bit memory bar when set, so you have something to play with
when testing 64bit pci bits. It also allows to have quite big shared
memory regions, like this:...

a9552c8e 09/26/2012 02:37 am Igor Mammedov

Introduce powerdown_notifiers

Notifier will be used for signaling powerdown request to guest in
a more general way and intended to replace very specific
qemu_irq_rise(qemu_system_powerdown) and will allow to remove global
variable qemu_system_powerdown.
...

d010f91c 09/26/2012 02:37 am Igor Mammedov

acpi: use notifier for signaling guest system_powerdown command

In addition, there is no need to allocate an extra irq just for
rising SCI in irq handler. Just rise SCI right from notifier
handler instead.

Signed-off-by: Igor Mammedov <>...

c72ddb1e 09/26/2012 02:37 am Igor Mammedov

target-arm: use notifier for signaling guest system_powerdown command

Acked-by: Peter Maydell <>
Signed-off-by: Igor Mammedov <>
Signed-off-by: Anthony Liguori <>

bea42280 09/26/2012 02:37 am Igor Mammedov

target-sparc: use notifier for signaling guest system_powerdown command

Signed-off-by: Igor Mammedov <>
Signed-off-by: Anthony Liguori <>

013c2f15 09/26/2012 02:37 am Igor Mammedov

Cleanup unused global var qemu_system_powerdown

All deps that used global qemu_system_powerdown var are now converted
to notifiers, so remove it.

Signed-off-by: Igor Mammedov <>
Signed-off-by: Anthony Liguori <>

d9b41bcd 09/26/2012 02:12 am Anthony Liguori

Merge remote-tracking branch 'origin/master' into staging

  • origin/master:
    tcg/i386: fix build with -march < i686
    tcg: Streamline movcond_i64 using movcond_i32
    tcg: Streamline movcond_i64 using 32-bit arithmetic
    tcg: Sanity check goto_tb input
    tcg: Sanity check deposit inputs...
f813cb83 09/26/2012 01:31 am Aurelien Jarno

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 <>
Signed-off-by: Aurelien Jarno <>

0a209d4b 09/26/2012 01:31 am Richard Henderson

tcg: Sanity check goto_tb input

Checking that we don't try for idx != [01] is trivial. Checking
that we don't issue more than one of any index requires a tad
more data and some ifdefs protecting that new variable.

Signed-off-by: Richard Henderson <>...

a463133e 09/26/2012 01:31 am Richard Henderson

tcg: Streamline movcond_i64 using 32-bit arithmetic

Avoiding 64-bit arithmetic (outside of the compare) reduces the
generated op count from 15 to 12, and the generated code size on
i686 from 105 to 88 bytes.

Signed-off-by: Richard Henderson <>...

a80a6b63 09/26/2012 01:31 am Richard Henderson

tcg: Streamline movcond_i64 using movcond_i32

When movcond_i32 is available we can further reduce the generated
op count from 12 to 6, and the generated code size on i686 from
88 to 74 bytes.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

8f06bf69 09/26/2012 01:31 am Aurelien Jarno

tcg/mips: fix MIPS32 detection

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

Cc: Andrew Pinski <>
Signed-off-by: Aurelien Jarno <>

5a696f6a 09/26/2012 01:31 am Richard Henderson

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 <>
Cc: malc <>...

42ce3e20 09/26/2012 01:31 am Richard Henderson

tcg: Emit ANDI as EXTU for appropriate constants

Note that andi_i64 failed to perform even the minimal
optimizations promised by the README.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

d81ada7f 09/26/2012 01:31 am Richard Henderson

tcg: Optimize initial inputs for ori_i64

Copy the same optimizations from ori_i32.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

6f3bb33e 09/26/2012 01:31 am Richard Henderson

tcg: Emit XORI as NOT for appropriate constants

Note that xori_i64 failed to perform even the minimal
optimizations promised by the README.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

77276f65 09/26/2012 01:31 am Richard Henderson

tcg: Implement concat*_i64 with deposit_i64

For tcg_gen_concat_i32_i64 we only use deposit if the host supports it.
For tcg_gen_concat32_i64 even if the host does not, as we get identical
code before and after.

Note that this relies on the ANDI -> EXTU patch for the identity claim....

c552d6c0 09/26/2012 01:31 am Richard Henderson

tcg: Add tcg_debug_assert

Like the C assert macro, except only enabled for CONFIG_DEBUG_TCG,
and without having to set _NDEBUG and disable all other asserts at
the same time.

The use of __builtin_unreachable (when available) gives the compiler
the same information, which may (or may not) help it optimize better....

717e7036 09/26/2012 01:31 am Richard Henderson

tcg: Sanity check deposit inputs

Given these are constants, checking once here means everything
after can assume they're correct.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

d352210a 09/26/2012 12:06 am Anthony Liguori

Merge remote-tracking branch 'bonzini/scsi-next' into staging

  • bonzini/scsi-next:
    SCSI: Standard INQUIRY data should report HiSup flag as set.
    scsi-disk: use scsi_data_cdb_length
    scsi: introduce scsi_cdb_length and scsi_data_cdb_length
    scsi-disk: fix check for out-of-range LBA...
97fe81d3 09/26/2012 12:06 am Anthony Liguori

Merge remote-tracking branch 'afaerber/qom-cpu' into staging

  • afaerber/qom-cpu:
    target-alpha: Initialize env->cpu_model_str
    target-i386: Drop unused setscalar() macro
    target-i386: Kill cpudef config section support
    target-i386: x86_cpudef_setup() coding style change...
3988475b 09/26/2012 12:06 am Anthony Liguori

Merge remote-tracking branch 'stefanha/trivial-patches' into staging

  • stefanha/trivial-patches:
    w32: Always use standard instead of native format strings
    net/socket: Fix compiler warning (regression for MinGW)
    linux-user: Remove redundant null check and replace free by g_free...
444dbc38 09/26/2012 12:06 am Anthony Liguori

Merge remote-tracking branch 'kwolf/for-anthony' into staging

  • kwolf/for-anthony:
    block: remove keep_read_only flag from BlockDriverState struct
    block: convert bdrv_commit() to use bdrv_reopen()
    block: vpc image file reopen
    block: vdi image file reopen...
09d0726c 09/26/2012 12:06 am Anthony Liguori

Merge remote-tracking branch 'bonzini/nbd-next' into staging

  • bonzini/nbd-next:
    nbd: add nbd_export_get_blockdev
    nbd: negotiate with named exports
    nbd: register named exports
    qemu-nbd: rewrite termination conditions to use a state machine
    nbd: add notification for closing an NBDExport...
dc1c13d9 09/24/2012 04:15 pm Jeff Cody

block: remove keep_read_only flag from BlockDriverState struct

The keep_read_only flag is no longer used, in favor of the bdrv
flag BDRV_O_ALLOW_RDWR.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

3d1807ac 09/24/2012 04:15 pm Jeff Cody

block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c

The aligned_buf pointer and aligned_buf size are no longer used in
raw_posix.c, so remove all references to them.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

eeb6b45d 09/24/2012 04:15 pm Jeff Cody

block: raw-posix image file reopen

This is derived from the Supriya Kannery's reopen patches.

This contains the raw-posix driver changes for the bdrv_reopen_*
functions. All changes are staged into a temporary scratch buffer
during the prepare() stage, and copied over to the live structure...

01bdddb5 09/24/2012 04:15 pm Jeff Cody

block: raw image file reopen

These are the stubs for the file reopen drivers for the raw format.

There is currently nothing that needs to be done by the raw driver
in reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

f9cb20f1 09/24/2012 04:15 pm Jeff Cody

block: qed image file reopen

These are the stubs for the file reopen drivers for the qed format.

There is currently nothing that needs to be done by the qed driver
in reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

21d82ac9 09/24/2012 04:15 pm Jeff Cody

block: qcow2 image file reopen

These are the stubs for the file reopen drivers for the qcow2 format.

There is currently nothing that needs to be done by the qcow2 driver
in reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

d177692e 09/24/2012 04:15 pm Jeff Cody

block: qcow image file reopen

These are the stubs for the file reopen drivers for the qcow format.

There is currently nothing that needs to be done by the qcow driver
in reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

3897575f 09/24/2012 04:15 pm Jeff Cody

block: vmdk image file reopen

This patch supports reopen for VMDK image files. VMDK extents are added
to the existing reopen queue, so that the transactional model of reopen
is maintained with multiple image files.

Signed-off-by: Jeff Cody <>...

ecfe2bba 09/24/2012 04:15 pm Jeff Cody

block: vdi image file reopen

There is currently nothing that needs to be done for VDI reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

3fe4b700 09/24/2012 04:15 pm Jeff Cody

block: vpc image file reopen

There is currently nothing that needs to be done for VPC image
file reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

0bce597d 09/24/2012 04:15 pm Jeff Cody

block: convert bdrv_commit() to use bdrv_reopen()

Currently, bdrv_commit() reopens images r/w itself, via risky
_delete() and _open() calls. Use the new safe method for drive reopen.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

80dd1aae 09/24/2012 04:15 pm Kevin Shanahan

blockdev: preserve readonly and snapshot states across media changes

If readonly=on is given at device creation time, the ->readonly flag
needs to be set in the block driver state for this device so that
readonly-ness is preserved across media changes (qmp change command)....

be028adc 09/24/2012 04:15 pm Jeff Cody

block: correctly set the keep_read_only flag

I believe the bs->keep_read_only flag is supposed to reflect
the initial open state of the device. If the device is initially
opened R/O, then commit operations, or reopen operations changing
to R/W, are prohibited....

55b110f2 09/24/2012 04:15 pm Jeff Cody

block: make bdrv_set_enable_write_cache() modify open_flags

bdrv_set_enable_write_cache() sets the bs->enable_write_cache flag,
but without the flag recorded in bs->open_flags, then next time
a reopen() is performed the enable_write_cache setting may be
inadvertently lost....

e971aa12 09/24/2012 04:15 pm Jeff Cody

block: Framework for reopening files safely

This is based on Supriya Kannery's bdrv_reopen() patch series.

This provides a transactional method to reopen multiple
images files safely.

Image files are queue for reopen via bdrv_reopen_queue(), and the
reopen occurs when bdrv_reopen_multiple() is called. Changes are...

fc32a72d 09/24/2012 04:15 pm Jeff Cody

block: move aio initialization into a helper function

Move AIO initialization for raw-posix block driver into a helper function.

In addition to just code motion, the aio_ctx pointer is checked for NULL,
prior to calling laio_init(), to make sure laio_init() is only run once....

6a8dc042 09/24/2012 04:15 pm Jeff Cody

block: move open flag parsing in raw block drivers to helper functions

Code motion, to move parsing of open flags into a helper function.

Signed-off-by: Jeff Cody <>
Signed-off-by: Kevin Wolf <>

39c9fb95 09/24/2012 04:15 pm Jeff Cody

block: do not parse BDRV_O_CACHE_WB in block drivers

Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,
and in the bs->open_flags.

This patch removes the code, leaving the behaviour behind as if
BDRV_O_CACHE_WB was set.

Signed-off-by: Jeff Cody <>...

9acc5a06 09/24/2012 04:15 pm Jeff Cody

block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c

Rather than check for a non-NULL aligned_buf to determine if
raw_aio_submit needs to check for alignment, check for the presence
of BDRV_O_NOCACHE in the bs->open_flags.

Signed-off-by: Jeff Cody <>...

d3e8f957 09/23/2012 08:09 pm Stefan Weil

w32: Add implementation of gmtime_r, localtime_r

Those functions are missing in MinGW.

Some versions of MinGW-w64 include defines for gmtime_r and localtime_r.
Older versions of these macros are buggy (they return a pointer to a
static variable), therefore we don't want them. Newer versions are...

95df51a4 09/23/2012 09:39 am Stefan Weil

w32: Always use standard instead of native format strings

GLib 2.0 include files use printf for the format attribute
which resolves to native format strings on w32 hosts.

QEMU wants standard format strings instead of native format
strings, so we simply change any declaration with printf...

73062dfe 09/23/2012 09:37 am Stefan Weil

net/socket: Fix compiler warning (regression for MinGW)

Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast
which is needed for MinGW:

net/socket.c:136: warning:
pointer targets in passing argument 2 of ‘sendto’ differ in signedness
/usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/include/winsock2.h:1313: note:...

ad11ad77 09/23/2012 09:35 am Stefan Weil

linux-user: Remove redundant null check and replace free by g_free

Report from smatch:

linux-user/syscall.c:3632 do_ioctl_dm(220) info:
redundant null check on big_buf calling free()

'big_buf' was allocated by g_malloc0, therefore free was also
replaced by g_free....

144b97c2 09/23/2012 09:11 am Paolo Bonzini

qemu-timer: simplify qemu_run_timers

ptimer_head is an invariant pointer to clock->active_timers.
Remove it, and just reference clock->active_timers directly.

Signed-off-by: Paolo Bonzini <>
Signed-off-by: Stefan Hajnoczi <>

b5488288 09/23/2012 09:11 am Stefan Weil

qemu-ga: Remove unreachable code after g_error

Report from smatch:
qemu-ga.c:117 register_signal_handlers(11) info: ignoring unreachable code.
qemu-ga.c:122 register_signal_handlers(16) info: ignoring unreachable code.

g_error calls abort which terminates the program....

39b38459 09/23/2012 09:11 am Stefan Weil

qemu-sockets: Fix potential memory leak

The old code leaks variable 'peer'.

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

5d40097f 09/23/2012 09:11 am Stefan Weil

cadence_uart: Fix buffer overflow

Report from smatch:
hw/cadence_uart.c:413 uart_read(13) error: buffer overflow 's->r' 18 <= 18

This fixes read access to s->r[R_MAX] which is behind the limits of s->r.

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

81396266 09/23/2012 09:11 am Stefan Weil

lm4549: Fix buffer overflow

Report from smatch:
lm4549.c:234 lm4549_write_samples(14) error:
buffer overflow 's->buffer' 1024 <= 1024

There must be enough space to add two entries starting with index
s->buffer_level, therefore the old check was wrong.
...

997f1567 09/23/2012 09:11 am Stefan Weil

ioh3420: Remove unreachable code

Report from smatch:
hw/ioh3420.c:128 ioh3420_initfn(35) info: ignoring unreachable code.

Signed-off-by: Stefan Weil <>
Reviewed-by: Juan Quintela <>
Signed-off-by: Stefan Hajnoczi <>

12dabc79 09/23/2012 09:11 am Stefan Weil

pflash_cfi01: Fix warning caused by unreachable code

Report from smatch:
hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code.

Instead of removing the return statement after the switch statement,
the patch replaces the return statements in the switch statement by...

d8f8a860 09/23/2012 09:11 am Alon Levy

dtrace backend: add function to reserved words

Signed-off-by: Alon Levy <>
Signed-off-by: Stefan Hajnoczi <>

995ee2bf 09/23/2012 09:11 am Hitoshi Mitake

curses: don't initialize curses when qemu is daemonized

Current qemu initializes curses even if -daemonize option is
passed. This cause problem because shell prompt appears without
calling endwin().

This patch adds new function, is_daemonized(), to OS dependent...

c10600af 09/23/2012 09:11 am Laszlo Ersek

TextConsole: saturate escape parameter in TTY_STATE_CSI

Signed-off-by: Laszlo Ersek <>
Reviewed-by: Markus Armbruster <>
Signed-off-by: Stefan Hajnoczi <>

2e84849a 09/23/2012 09:11 am Don Slutz

target-i386: Allow tsc-frequency to be larger then 2.147G

The check using INT_MAX (2147483647) is wrong in this case.

Signed-off-by: Fred Oliveira <>
Signed-off-by: Don Slutz <>
Signed-off-by: Stefan Hajnoczi <>

93b65997 09/23/2012 12:34 am Stefan Weil

audio: Fix warning from static code analysis

smatch report:
audio/audio_template.h:416 AUD_open_out(18) warn:
variable dereferenced before check 'as' (see line 414)

Moving the ldebug statement after the statement which checks 'as'
fixes that warning.

Signed-off-by: Stefan Weil <>...

04cbbdee 09/22/2012 08:59 pm Blue Swirl

Merge branch 'tcg-sparc' of git://repo.or.cz/qemu/rth

  • 'tcg-sparc' of git://repo.or.cz/qemu/rth:
    tcg-sparc: Preserve branch destinations during retranslation
    tcg-sparc: Fix and enable direct TB chaining.
    tcg-sparc: Add %g/%o registers to alloc_order...
4e273869 09/22/2012 08:59 pm Max Filippov

target-xtensa: implement FP1 group

These are comparison and conditional move opcodes.
See ISA, 4.3.10 for more details.

Signed-off-by: Max Filippov <>
Signed-off-by: Blue Swirl <>

ef04a846 09/22/2012 08:59 pm Max Filippov

target-xtensa: implement coprocessor context option

In case Coprocessor Context option is enabled CPENABLE SR bits control
whether access to coprocessors is allowed or would rise one of
CoprocessorXDisabled exceptions.

See ISA, 4.4.5 for more details.

FP is coprocessor 0....

66176802 09/22/2012 08:59 pm Max Filippov

softfloat: make float_muladd_negate_* flags independent

Flags passed into float{32,64}_muladd are treated as bits; assign
independent bits to float_muladd_negate_* to allow precise control over
what gets negated in float{32,64}_muladd.

Signed-off-by: Max Filippov <>...

213ff4e6 09/22/2012 08:59 pm Max Filippov

softfloat: add NO_SIGNALING_NANS

Architectures that don't have signaling NaNs can define
NO_SIGNALING_NANS, it will make float*_is_quiet_nan return 1 for any NaN
and float*_is_signaling_nan always return 0.

Signed-off-by: Max Filippov <>...

10f6ca03 09/22/2012 08:59 pm Max Filippov

target-xtensa: handle boolean option in overlays

Signed-off-by: Max Filippov <>
Signed-off-by: Blue Swirl <>

b81fe822 09/22/2012 08:59 pm Max Filippov

target-xtensa: specialize softfloat NaN rules

NaN propagation rule: leftmost NaN in the expression gets propagated to
the result.

Signed-off-by: Max Filippov <>
Signed-off-by: Blue Swirl <>

dd519cbe 09/22/2012 08:59 pm Max Filippov

target-xtensa: add FP registers

There are 16 32-bit FP registers (f0 - f15), control and status user
registers (fcr, fsr).

See ISA, 4.3.10 for more details.

Signed-off-by: Max Filippov <>
Signed-off-by: Blue Swirl <>

9ed7ae12 09/22/2012 08:59 pm Max Filippov

target-xtensa: implement LSCX and LSCI groups

These are load/store instructions for FP registers with immediate or
register index and optional base post-update.
See ISA, 4.3.10 for more details.

Signed-off-by: Max Filippov <>
Signed-off-by: Blue Swirl <>

0b6df838 09/22/2012 08:59 pm Max Filippov

target-xtensa: implement FP0 arithmetic

These are FP arithmetic opcodes.
See ISA, 4.3.10 for more details.

Signed-off-by: Max Filippov <>
Signed-off-by: Blue Swirl <>

b7ee8c6a 09/22/2012 08:59 pm Max Filippov

target-xtensa: implement FP0 conversions

These are FP to integer and integer to FP conversion opcodes.
See ISA, 4.3.10 for more details.

Note that ISA description for utrunc.s is currently incorrect and will
be fixed in future revisions.

Signed-off-by: Max Filippov <>...

e809c0dc 09/22/2012 08:24 pm Aurelien Jarno

Revert "tcg/mips"

This reverts commit ad49d1f75115663731bfe06dec61eed6775526ad.

This commit was not supposed to be pushed.

Signed-off-by: Aurelien Jarno <>

23f3ff26 09/22/2012 06:16 pm malc

tcg/ppc32: Implement movcond32

Thanks to Richard Henderson

Signed-off-by: malc <>

ad49d1f7 09/22/2012 06:07 pm Aurelien Jarno

tcg/mips

b18212c6 09/22/2012 05:52 pm Stefan Weil

tcg/i386: Add shortcuts for registers used in L constraint

While 64 bit hosts use the first three registers which are also used
as function input parameters, 32 bit hosts use TCG_REG_EAX and
TCG_REG_EDX which are not used in parameter passing.

After defining new register macros for the registers used in L...

d73685e3 09/22/2012 05:52 pm Stefan Weil

tcg/i386: Remove unused registers from tcg_target_call_iarg_regs

32 bit x86 hosts don't need registers for helper function arguments
because they use the default stack based calling convention.

Removing the registers allows simpler code for function
tcg_target_get_call_iarg_regs_count....

6e17d0c5 09/22/2012 05:52 pm Stefan Weil

tcg: Remove tcg_target_get_call_iarg_regs_count

The TCG targets no longer need individual implementations.

Since commit 6a18ae2d2947532d5c26439548afa0481c4529f9,
'flags' is no longer used in tcg_target_get_call_iarg_regs_count.

The remaining tcg_target_get_call_iarg_regs_count is trivial and only...

f0da3757 09/22/2012 04:10 pm Richard Henderson

tcg-hppa: Implement movcond

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

9bacf414 09/22/2012 04:10 pm Max Filippov

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 <>
Signed-off-by: Aurelien Jarno <>

1b7621ad 09/22/2012 04:10 pm Stefan Weil

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...

e590d4e6 09/22/2012 04:10 pm Aurelien Jarno

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"....

1ff8c541 09/22/2012 04:10 pm Aurelien Jarno

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...

0aba1c73 09/22/2012 04:10 pm Aurelien Jarno

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 <>
Signed-off-by: Aurelien Jarno <>

3c94193e 09/22/2012 04:10 pm Aurelien Jarno

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 <>...

b336ceb6 09/22/2012 04:10 pm Aurelien Jarno

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 <>...

c2b0e2fe 09/22/2012 04:10 pm Aurelien Jarno

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....

fba3161f 09/22/2012 04:10 pm Aurelien Jarno

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 <>...

7ef55fc9 09/22/2012 04:10 pm Aurelien Jarno

tcg/optimize: add constant folding for deposit

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

0f46c064 09/22/2012 04:10 pm Aurelien Jarno

tcg/mips: optimize brcond arg, 0

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

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

c1cf85c9 09/22/2012 04:10 pm Aurelien Jarno

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...

9a152519 09/22/2012 04:10 pm Aurelien Jarno

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 <>...

04f71aa3 09/22/2012 04:10 pm Aurelien Jarno

tcg/mips: implement deposit op on MIPS32R2

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

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

7d7c4930 09/22/2012 04:10 pm Aurelien Jarno

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 <>
Signed-off-by: Aurelien Jarno <>

48b56ce1 09/22/2012 04:10 pm Aurelien Jarno

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 <>
Signed-off-by: Aurelien Jarno <>

b80bb016 09/22/2012 04:10 pm Aurelien Jarno

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...

5a0eed37 09/22/2012 04:10 pm Aurelien Jarno

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 <>
Signed-off-by: Aurelien Jarno <>

3314e008 09/22/2012 04:10 pm Aurelien Jarno

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 <>

0d0b53a6 09/22/2012 04:10 pm Aurelien Jarno

tcg/mips: use stack for TCG temps

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

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>