Commit Graph

202 Commits

Author SHA1 Message Date
Richard Henderson 3b4fefd6e6 target-alpha: Implement TLB flush primitives.
Expose these via MTPR, more or less like the real HW does.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson e5214853ea target-alpha: Use a fixed frequency for the RPCC in system mode.
Also include the PCC_OFS in the return value.  For user mode we
can pretend the PCC_OFS value is always zero.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson 5b4504079a target-alpha: Trap for unassigned and unaligned addresses.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson fa6e0a6354 target-alpha: Remap PIO space for 43-bit KSEG for EV6.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson a3b9af1624 target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode.
Reads the page table how PALcode would, except that the virtual
page table base register is not used.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson 2ace7e55a2 target-alpha: Implement more CALL_PAL values inline.
In particular, SWPIPL is used quite a lot by the Linux kernel.
Doing this inline makes it significantly easier to step through
without the debugger getting confused by the mode switch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:06 -07:00
Richard Henderson 6a80e088c7 target-alpha: Disable interrupts properly.
Interrupts are disabled in PALmode, and when the PS IL is high enough.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson a18ad89351 target-alpha: All ISA checks to use TB->FLAGS.
We had two different methods in use, both of which referenced ENV,
and neither of which indicated to the generic code when different
compilation modes are not compatible.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 21d2beaaef target-alpha: Swap shadow registers moving to/from PALmode.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 3a6fa678bf target-alpha: Implement do_interrupt for system mode.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 26b4609447 target-alpha: Add IPRs to be used by the emulation PALcode.
These aren't actually used yet, but we can at least access
them via the HW_MFPR and HW_MTPR instructions.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson bba9bdcee8 target-alpha: Use kernel mmu_idx for pal_mode.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson ea879fc719 target-alpha: Add various symbolic constants.
The EXC_M_* constants were being set for the EV6, not as set for
the Unix kernel entry point.

Use PS_USER_MODE instead of hard-coding access to the PS register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 2d9671d391 target-alpha: Use do_restore_state for arithmetic exceptions.
This gets the PC right after an arithmetic exception.  Also tidies
the code in the TLB fault handlers to use common code.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson b5f1aa6444 target-alpha: Tidy up arithmetic exceptions.
Introduce and use arith_excp, filling in the trap_arg[01] IPRs.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 07b6c13b09 target-alpha: Tidy exception constants.
There's no need to attempt to match EXCP_* values with PALcode entry
point offsets.  Instead, compress all the values to make for more
efficient switch statements within QEMU.

We will be doing TLB fill within QEMU proper, not within the PALcode,
so all of the ITB/DTB miss, double fault, and access exceptions can
be compressed to EXCP_MMFAULT.

Compress all of the EXCP_CALL_PAL exceptions into one.
Use env->error_code to store the specific entry point.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson b758aca1f6 target-alpha: Enable the alpha-softmmu target.
With all of the pre-existing code that would not compile gone,
this is the earliest point at which the target can be enabled.

There is no machine defined yet, so this will crash on startup.
Enable the target anyway, to make sure that further compilation
problems do not creep back in.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 129d8aa575 target-alpha: Rationalize internal processor registers.
Delete all the code that tried to emulate the real IPRs of some
unnamed CPU.  Replace those with just 3 slots that we can use to
communicate trap information between the helper functions that
signal exceptions and the OS trap handler.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 508b43eaf3 target-alpha: Merge HW_REI and HW_RET implementations.
Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 8417845ee9 target-alpha: Cleanup MMU modes.
Don't bother including executive and supervisor modes.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson e52458fe29 target-alpha: Fix system store_conditional
This code contained typos, as it had never been compiled.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:05 -07:00
Richard Henderson 2374e73eda target-alpha: Fix translation of PALmode memory insns.
All of the "raw" memory accesses should be "phys" instead.  Fix
some confusion about argument ordering of the store routines.
Fix the implementation of store-conditional.

Delete the "alt-mode" helpers.  Because we only implement two
mmu modes, let /a imply user-mode unconditionally.

Leave some combinations of virt access without permission
checks as unimplemented.  There are too many hoops through
which to jump, and these insns will not be needed in the
emulation palcode.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Richard Henderson 352e48b0f4 target-alpha: Remove partial support for palcode emulation.
This code does not work, and will be replaced by a bios image.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Richard Henderson bf1b03fe18 target-alpha: Single-step properly across branches.
We were failing to generate EXC_DEBUG in the EXIT_PC_UPDATED path.
This caused us not to stop at the instruction after a branch, but
on the instruction afterward.

Signed-off-by: Richard Henderson <rth@twiddle.net>
2011-05-31 10:18:04 -07:00
Stefan Weil 618ba8e6a1 Remove unused function parameter from cpu_restore_state
The previous patch removed the need for parameter puc.
Is is now unused, so remove it.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-20 10:37:03 +02:00
Stefan Weil e87b7cb0f0 Remove unused function parameters from gen_pc_load and rename the function
Function gen_pc_load was introduced in commit
d2856f1ad4.
The only reason for parameter searched_pc was
a debug statement in target-i386/translate.c.

Parameter puc was needed by target-sparc until
commit d7da2a1040.

Remove searched_pc from the debug statement and remove both
parameters from the parameter list of gen_pc_load.

As the function name gen_pc_load was also misleading,
it is now called restore_state_to_opc. This new name
was suggested by Peter Maydell, thanks.

v2: Remove last parameter, too, and rename the function.

v3: Fix [] typo in target-arm/translate.c.
    Fix wrong SHA1 object name in commit message (copy+paste error).

Cc: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-20 10:33:59 +02:00
Aurelien Jarno 211315fb5e softfloat: rename float*_eq() into float*_eq_quiet()
float*_eq functions have a different semantics than other comparison
functions. Fix that by first renaming float*_quiet() into float*_eq_quiet().

Note that it is purely mechanical, and the behaviour should be unchanged.
That said it clearly highlight problems due to this different semantics,
they are fixed later in this patch series.

Cc: Alexander Graf <agraf@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17 20:32:14 +02:00
Aurelien Jarno a4d2d1a063 target-alpha: use new float64_unordered_quiet() function
Use float64_unordered_quiet() in helper_cmptun() instead of doing the
the comparison manually.

According to the "Alpha Compiler Writer's Guide", we should use the
_quiet version here, as CMPTUN and CMPTEQ should generate InvalidOp
for SNaNs but not for QNaNs.

Thanks to Peter Maydell <peter.maydell@linaro.org> and Richard
Henderson <rth@twiddle.net> for digging into the manuals.

Acked-by: Richard Henderson  <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-17 20:32:14 +02:00
Stefan Weil 4b4a72e556 Fix conversions from pointer to tcg_target_long
tcg_gen_exit_tb takes a parameter of type tcg_target_long,
so the type casts of pointer to long should be replaced by
type casts of pointer to tcg_target_long (suggested by Blue Swirl).

These changes are needed for build environments where
sizeof(long) != sizeof(void *), especially for w64.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-10 00:45:16 +02:00
Paolo Bonzini eda48c344f inline cpu_halted into sole caller
All implementations are now the same, and there is only one caller,
so inline the function there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-03-13 14:44:21 +00:00
Peter Maydell 185698715d softfloat: Rename float*_is_nan() functions to float*_is_quiet_nan()
The softfloat functions float*_is_nan() were badly misnamed,
because they return true only for quiet NaNs, not for all NaNs.
Rename them to float*_is_quiet_nan() to more accurately reflect
what they do.

This change was produced by:
 perl -p -i -e 's/_is_nan/_is_quiet_nan/g' $(git grep -l is_nan)
(with the results manually checked.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-02 11:15:25 +01:00
Stefan Weil 9a78eead0c target-xxx: Use fprintf_function (format checking)
fprintf_function uses format checking with GCC_FMT_ATTR.

Format errors were fixed in
* target-i386/helper.c
* target-mips/translate.c
* target-ppc/translate.c

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-30 08:01:59 +00:00
Paolo Bonzini a88790a14f remove exec-all.h inclusion from cpu.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03 09:48:24 +03:00
Paolo Bonzini 10eb0cc03c move cpu_pc_from_tb to target-*/exec.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03 09:48:12 +03:00
Paolo Bonzini 83dae09588 remove unused stuff from */exec.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-03 06:47:13 +00:00
Richard Henderson 18f8e2c08b target-alpha: Implement RPCC.
A minimal implementation that more or less corresponds to the
user-level version used by target-i386.  More hoops will want
to be jumped through when alpha gets system-level emulation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:42 +02:00
Richard Henderson 6910b8f66a target-alpha: Fix load-locked/store-conditional.
Use an exception plus start_exclusive to implement the compare-and-swap.
This follows the example set by the MIPS and PPC ports.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 8aa3fa2038 target-alpha: Indicate NORETURN status when raising exception.
When (indirectly) calling raise_exception, don't emit cleanup
code at the end of the TB, as it is unused.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson a4b388ff51 target-alpha: Enable NPTL.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 49563a7274 target-alpha: Update commentary for opcode 0x1A.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 4af7037462 target-alpha: Emit goto_tb opcodes.
Use an ExitStatus enumeration instead of magic numbers as the return
value from translate_one.  Emit goto_tb opcodes when ending a TB via
a direct branch.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson 593f17e5f2 target-alpha: Implement cvtlq inline.
It's a simple shift and mask sequence.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson ac316ca4b7 target-alpha: Implement rs/rc properly.
This is a per-cpu flag; there's no need for a spinlock of any kind.

We were also failing to manipulate the flag with $31 as a target reg
and failing to clear the flag on execution of a return-from-interrupt
instruction.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Richard Henderson dc96be4b97 target-alpha: Implement cpys{, n, e} inline.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:41 +02:00
Blue Swirl b2c58871c9 alpha: add missing 'break', spotted by clang analyzer
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25 20:31:42 +00:00
Blue Swirl f88fe4e370 alpha: remove dead assignments, spotted by clang analyzer
Value stored is never read.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-25 20:30:17 +00:00
Richard Henderson bbe1dab430 target-alpha: Use non-inverted arguments to gen_{f}cmov.
The inverted conditions as argument to the function looks wrong
at a glance inside translate_one.  Since we have an easy function
to produce the inversion now, use it.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-10 02:44:32 +02:00
Richard Henderson 9e05960fdc target-alpha: Use setcond for int comparisons.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-10 02:44:32 +02:00
Richard Henderson 735cf45f9c target-alpha: Implement cvtql inline.
It's a simple mask and shift sequence.
Also, fix a typo in the actual masks used.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-10 02:44:31 +02:00
Richard Henderson 0c287402a8 target-alpha: Add flags markups to helpers.h.
Almost all alpha helpers are at least TCG_CALL_CONST
and a fair few are also TCG_CALL_PURE.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-10 02:27:55 +02:00