]> Git Repo - qemu.git/log
qemu.git
12 years agolm4549: Fix buffer overflow
Stefan Weil [Sat, 1 Sep 2012 10:43:41 +0000 (12:43 +0200)]
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.

[Peter Maydell <[email protected]> clarifies the nature of the
analyser warning:

I don't object to making the change to placate the analyser,
but I don't think this is actually a buffer overrun. We always
add and remove samples from the buffer two at a time, so it's
not possible to get here with s->buffer_level == BUFFER_SIZE-1
(which is the only case where the old and new conditions
give different answers).]

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agocadence_uart: Fix buffer overflow
Stefan Weil [Sat, 1 Sep 2012 09:12:23 +0000 (11:12 +0200)]
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 <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoqemu-sockets: Fix potential memory leak
Stefan Weil [Sat, 1 Sep 2012 07:40:26 +0000 (09:40 +0200)]
qemu-sockets: Fix potential memory leak

The old code leaks variable 'peer'.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoqemu-ga: Remove unreachable code after g_error
Stefan Weil [Sat, 1 Sep 2012 07:34:15 +0000 (09:34 +0200)]
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.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agotarget-i386: Allow tsc-frequency to be larger then 2.147G
Don Slutz [Sat, 22 Sep 2012 00:13:13 +0000 (20:13 -0400)]
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 <[email protected]>
Signed-off-by: Don Slutz <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
12 years agoaudio: Fix warning from static code analysis
Stefan Weil [Mon, 3 Sep 2012 09:25:16 +0000 (09:25 +0000)]
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 <[email protected]>
Signed-off-by: malc <[email protected]>
12 years agoMerge branch 'tcg-sparc' of git://repo.or.cz/qemu/rth
Blue Swirl [Sat, 22 Sep 2012 17:59:15 +0000 (17:59 +0000)]
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
  tcg-sparc: Use defines for temporaries.
  tcg-sparc: Mask shift immediates to avoid illegal insns.
  tcg-sparc: Clean up cruft stemming from attempts to use global registers.
  tcg-sparc: Change AREG0 in generated code to %i0.
  tcg-sparc: Support GUEST_BASE.
  tcg-sparc: Fix qemu_ld/st to handle 32-bit host.
  tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode.
  tcg-sparc: Don't MAP_FIXED on top of the program
  tcg-sparc: Fix ADDX opcode.
  tcg-sparc: Hack in qemu_ld/st64 for 32-bit.
  linux-user: Use memcpy in get_user/put_user.

12 years agotarget-xtensa: implement coprocessor context option
Max Filippov [Wed, 19 Sep 2012 00:23:59 +0000 (04:23 +0400)]
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.

Signed-off-by: Max Filippov <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: implement FP1 group
Max Filippov [Wed, 19 Sep 2012 00:23:58 +0000 (04:23 +0400)]
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 <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: implement FP0 conversions
Max Filippov [Wed, 19 Sep 2012 00:23:57 +0000 (04:23 +0400)]
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 <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: implement FP0 arithmetic
Max Filippov [Wed, 19 Sep 2012 00:23:56 +0000 (04:23 +0400)]
target-xtensa: implement FP0 arithmetic

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

Signed-off-by: Max Filippov <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: implement LSCX and LSCI groups
Max Filippov [Wed, 19 Sep 2012 00:23:55 +0000 (04:23 +0400)]
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 <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: add FP registers
Max Filippov [Wed, 19 Sep 2012 00:23:54 +0000 (04:23 +0400)]
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 <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: specialize softfloat NaN rules
Max Filippov [Wed, 19 Sep 2012 00:23:53 +0000 (04:23 +0400)]
target-xtensa: specialize softfloat NaN rules

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

Signed-off-by: Max Filippov <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agotarget-xtensa: handle boolean option in overlays
Max Filippov [Wed, 19 Sep 2012 00:23:52 +0000 (04:23 +0400)]
target-xtensa: handle boolean option in overlays

Signed-off-by: Max Filippov <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agosoftfloat: add NO_SIGNALING_NANS
Max Filippov [Wed, 19 Sep 2012 00:23:51 +0000 (04:23 +0400)]
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 <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agosoftfloat: make float_muladd_negate_* flags independent
Max Filippov [Wed, 19 Sep 2012 00:23:50 +0000 (04:23 +0400)]
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 <[email protected]>
Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Blue Swirl <[email protected]>
12 years agoRevert "tcg/mips"
Aurelien Jarno [Sat, 22 Sep 2012 17:24:49 +0000 (19:24 +0200)]
Revert "tcg/mips"

This reverts commit ad49d1f75115663731bfe06dec61eed6775526ad.

This commit was not supposed to be pushed.

Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
12 years agotcg/mips
Aurelien Jarno [Sat, 22 Sep 2012 15:07:23 +0000 (17:07 +0200)]
tcg/mips

12 years agotcg: Remove tcg_target_get_call_iarg_regs_count
Stefan Weil [Thu, 13 Sep 2012 17:37:46 +0000 (19:37 +0200)]
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
called once. Therefore the patch eliminates it completely.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotcg/i386: Remove unused registers from tcg_target_call_iarg_regs
Stefan Weil [Thu, 13 Sep 2012 17:37:45 +0000 (19:37 +0200)]
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.

Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotcg/i386: Add shortcuts for registers used in L constraint
Stefan Weil [Thu, 13 Sep 2012 17:37:44 +0000 (19:37 +0200)]
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
constraint, the patch replaces most occurrences of
tcg_target_call_iarg_regs[0], tcg_target_call_iarg_regs[1] and
tcg_target_call_iarg_regs[2] by those new macros.

tcg_target_call_iarg_regs remains unchanged when it is used for input
arguments (only with 64 bit hosts) before tcg_out_calli.

A comment related to those registers was fixed, too.

Signed-off-by: Stefan Weil <[email protected]>
[aurel32: build fix on i386, small optimization for i386 in the prologue]
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotcg-hppa: Implement movcond
Richard Henderson [Sat, 22 Sep 2012 01:46:32 +0000 (18:46 -0700)]
tcg-hppa: Implement movcond

Signed-off-by: Richard Henderson <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
12 years agolinux-user: Use memcpy in get_user/put_user.
Richard Henderson [Sat, 24 Mar 2012 20:31:25 +0000 (21:31 +0100)]
linux-user: Use memcpy in get_user/put_user.

When host and target have differing alignment rules, using a cast
and direct memory operation can result in SIGBUS.  Use memcpy instead,
which the compiler will happily optimize when alignment is satisfied.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
12 years agoMerge branch 'usb.65' of git://git.kraxel.org/qemu
Aurelien Jarno [Fri, 21 Sep 2012 17:53:26 +0000 (19:53 +0200)]
Merge branch 'usb.65' of git://git.kraxel.org/qemu

* 'usb.65' of git://git.kraxel.org/qemu:
  uhci: Don't queue up packets after one with the SPD flag set
  usb-redir: Revert usb-redir part of commit 93bfef4c
  usb-redir: Add chardev open / close debug logging
  usb-redir: Add support for migration
  usb-redir: Store max_packet_size in endp_data
  usb-redir: Add an already_in_flight packet-id queue
  usb-redir: Change cancelled packet code into a generic packet-id queue
  ehci: Walk async schedule before and after migration
  ehci: Don't set seen to 0 when removing unseen queue-heads
  configure: usbredir fixes
  ehci: Don't process too much frames in 1 timer tick (v2)
  ehci: Fix interrupts stopping when Interrupt Threshold Control is 8
  ehci: switch to new-style memory ops
  usb-host: allow emulated (non-async) control requests without USBPacket

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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Reviewed-by: Andreas Färber <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Reviewed-by: Aurelien Jarno <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: remove useless code
Aurelien Jarno [Sun, 16 Sep 2012 11:12:21 +0000 (13:12 +0200)]
target-sh4: remove useless code

Almost dead code.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: cleanup DisasContext
Aurelien Jarno [Sun, 16 Sep 2012 11:12:21 +0000 (13:12 +0200)]
target-sh4: cleanup DisasContext

We should avoid accessing env at translation stage, except of course for
static values like the supported features.

Remove variables copied from env in DisasContext and use the TB flags
instead.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: rework exceptions handling
Aurelien Jarno [Sun, 16 Sep 2012 11:12:21 +0000 (13:12 +0200)]
target-sh4: rework exceptions handling

Since commit fd4bab102 PC is restored in case of exception through code
retranslation. While it is clearly the thing to do in case it is not
not known if an helper is going to trigger an exception or not
(e.g. for load/store, FPU, etc.), it just make things slower when the
exception is already known at translation time.

Partially revert this commit and save PC in the TCG code. Set bstate to
BS_BRANCH to not generate TCG exit code. Micro-optimize the sleep
helper. Make all the exception helpers to call raise_exception and mark
it as noreturn.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: remove gen_clr_t() and gen_set_t()
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: remove gen_clr_t() and gen_set_t()

gen_clr_t() and gen_set_t() have very few callers and can be remplaced
by a single line. Remove them.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: optimize swap.w
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: optimize swap.w

It's possible swap the two 16-bit words of a 32-bit register using a
rotation. If the TCG target doesn't implement rotation, the replacement
code is similar to the previously implemented code.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: optimize xtrct
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: optimize xtrct

The register being 32 bit long, after a shift to the right by 16 bits,
the upper 16 bit are already cleared. There is no need to call ext16u
to clear them.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: implement addv and subv using TCG
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: implement addv and subv using TCG

addv and subv helpers implementation is directly copied from the SH4
manual and looks quite complex. It is however possible to explain it
without branches, and is therefore possible to implement it with TCG.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: implement addc and subc using TCG
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: implement addc and subc using TCG

Now that setcond is available, the addc and subc can easily be
implemented using TCG.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: use float32_muladd() to implement fmac
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: use float32_muladd() to implement fmac

There is no need to add a SH4 specific pickNaNMulAdd() to softfloat as
SH4 is always returning a default NaN.

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agotarget-sh4: mark a few helpers const and pure
Aurelien Jarno [Sun, 16 Sep 2012 11:12:20 +0000 (13:12 +0200)]
target-sh4: mark a few helpers const and pure

Signed-off-by: Aurelien Jarno <[email protected]>
12 years agoSCSI: Standard INQUIRY data should report HiSup flag as set.
Ronnie Sahlberg [Sat, 15 Sep 2012 01:13:29 +0000 (18:13 -0700)]
SCSI: Standard INQUIRY data should report HiSup flag as set.

QEMU as far as I know only reports LUN numbers using the modes that
are described in SAM4.
As such, since all LUN numbers generated by the SCSI emulation in QEMU
follow SAM4, we should set the HiSup bit in the standard INQUIRY data
to indicate such.

From SAM4:
  4.6.3 LUNs overview
  All LUN formats described in this standard are hierarchical in
  structure even when only a single level in that hierarchy is used.
  The HISUP bit shall be set to one in the standard INQUIRY data
  (see SPC-4) when any LUN format described in this standard is used.
  Non-hierarchical formats are outside the scope of this standard.

Signed-off-by: Ronnie Sahlberg <[email protected]>
12 years agoscsi-disk: use scsi_data_cdb_length
Paolo Bonzini [Wed, 5 Sep 2012 16:00:57 +0000 (18:00 +0200)]
scsi-disk: use scsi_data_cdb_length

This simplifies and unifies the parsing of READ, WRITE and WRITE SAME
commands.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi: introduce scsi_cdb_length and scsi_data_cdb_length
Paolo Bonzini [Wed, 5 Sep 2012 15:57:19 +0000 (17:57 +0200)]
scsi: introduce scsi_cdb_length and scsi_data_cdb_length

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi-disk: fix check for out-of-range LBA
Paolo Bonzini [Wed, 5 Sep 2012 15:54:36 +0000 (17:54 +0200)]
scsi-disk: fix check for out-of-range LBA

This fix is needed to correctly handle 0-block read and writes.
Without it, a 0-block access at LBA 0 would underflow.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoscsi-disk: introduce check_lba_range
Paolo Bonzini [Wed, 5 Sep 2012 15:46:18 +0000 (17:46 +0200)]
scsi-disk: introduce check_lba_range

Abstract the test for an out-of-range (starting block, block count)
pair.

Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoiSCSI: We dont need to explicitely call qemu_notify_event() any more
Ronnie Sahlberg [Thu, 30 Aug 2012 23:56:36 +0000 (16:56 -0700)]
iSCSI: We dont need to explicitely call qemu_notify_event() any more

We no longer need to explicitely call qemu_notify_event() any more
since this is now done automatically any time the filehandles we listen
to change.

Signed-off-by: Ronnie Sahlberg <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
12 years agoiSCSI: We need to support SG_IO also from iscsi_ioctl()
Ronnie Sahlberg [Fri, 31 Aug 2012 00:28:40 +0000 (17:28 -0700)]
iSCSI: We need to support SG_IO also from iscsi_ioctl()

We need to support SG_IO from the synchronous iscsi_ioctl() since
scsi-block uses this to do an INQ to the device to discover its properties
This patch makes scsi-block work with iscsi.

Signed-off-by: Ronnie Sahlberg <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
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 <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agotarget-i386: Drop unused setscalar() macro
Andreas Färber [Mon, 17 Sep 2012 17:02:13 +0000 (19:02 +0200)]
target-i386: Drop unused setscalar() macro

It was only used by now removed setfeatures() function.

Suggested-by: Igor Mammedov <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agotarget-i386: Kill cpudef config section support
Eduardo Habkost [Wed, 5 Sep 2012 20:41:13 +0000 (17:41 -0300)]
target-i386: Kill cpudef config section support

It's nice to have a flexible system to maintain CPU models as data, but
this is holding us from making improvements in the CPU code because it's
not using the common infra-structure, and because the machine-type data
is still inside C code.

Users who want to configure CPU features directly may simply use the
"-cpu" command-line option (and maybe an equivalent -device option in
the future) to set CPU features.

Signed-off-by: Eduardo Habkost <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agotarget-i386: x86_cpudef_setup() coding style change
Eduardo Habkost [Wed, 5 Sep 2012 20:41:12 +0000 (17:41 -0300)]
target-i386: x86_cpudef_setup() coding style change

Make source code lines shorter.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Don Slutz <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agoEliminate cpus-x86_64.conf file
Eduardo Habkost [Wed, 5 Sep 2012 20:41:11 +0000 (17:41 -0300)]
Eliminate cpus-x86_64.conf file

This file is not needed anymore, as QEMU won't ship any config-based
cpudefs out of the box, relying only on the builtin CPU models.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agotarget-i386: Move CPU models from cpus-x86_64.conf to C
Eduardo Habkost [Wed, 5 Sep 2012 20:41:10 +0000 (17:41 -0300)]
target-i386: Move CPU models from cpus-x86_64.conf to C

Those models are maintained by QEMU and may require compatibility code
to be added when making some changes. Keeping the data in the C source
code should make it simpler to handle those details.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Don Slutz <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agotarget-i386: Add missing CPUID_* constants
Eduardo Habkost [Wed, 5 Sep 2012 20:41:09 +0000 (17:41 -0300)]
target-i386: Add missing CPUID_* constants

Those constants will be used by new CPU model definitions.

Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agoDrop cpu_list_id macro
Peter Maydell [Wed, 5 Sep 2012 20:41:08 +0000 (17:41 -0300)]
Drop cpu_list_id macro

Since the only user of the extended cpu_list_id() format
was the x86 ?model/?dump/?cpuid output, we can drop it
completely.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agotarget-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump
Peter Maydell [Wed, 5 Sep 2012 20:41:07 +0000 (17:41 -0300)]
target-i386: Fold -cpu ?cpuid, ?model output into -cpu help, drop ?dump

Commit c8057f95 (accidentally) disabled the ability to pass
option strings starting with '?' to the target-specific
cpu_list function, so the target-i386 specific "-cpu ?dump",
"-cpu ?cpuid" and "-cpu ?model" stopped working.

Since these options are undocumented and not used by libvirt,
simply drop them completely rather than reinstating them
with new style syntax. Instead, we fold the ?model and ?cpuid
output into the output of the plain "-cpu help" output. The
detailed output produced by ?dump is dropped.

Signed-off-by: Peter Maydell <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Andreas Färber <[email protected]>
12 years agoMAINTAINERS: Add entry for QOM CPU
Andreas Färber [Mon, 17 Sep 2012 17:10:32 +0000 (19:10 +0200)]
MAINTAINERS: Add entry for QOM CPU

Signed-off-by: Andreas Färber <[email protected]>
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 <[email protected]>
Cc: qemu-stable <[email protected]>
Signed-off-by: malc <[email protected]>
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 <[email protected]>
Signed-off-by: Max Filippov <[email protected]>
Cc: qemu-stable <[email protected]>
Signed-off-by: malc <[email protected]>
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 <[email protected]>
Signed-off-by: Aurelien Jarno <[email protected]>
This page took 0.075945 seconds and 4 git commands to generate.