cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together.Explicitly zero them on reset since they were located beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Replace do_interrupt() by CPUClass::do_interrupt method
This removes a global per-target function and thus takes us one stepcloser to compiling multiple targets into one executable.
It will also allow to override the interrupt handling for certain CPU...
gen-icount.h: Rename gen_icount_start/end to gen_tb_start/end
The gen_icount_start/end functions are now somewhat misnamed since theyare useful for generic "start/end of TB" code, used for more than justicount. Rename them to gen_tb_start/end.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>...
cpu: Introduce ENV_OFFSET macros
Introduce ENV_OFFSET macros which can be used in non-target-specificcode that needs to generate TCG instructions which reference CPUStatefields given the cpu_env register that TCG targets set up with apointer to the CPUArchState struct....
target-alpha: Use mulu2 for umulh insn
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cpu: Add CPUArchState pointer to CPUState
The target-specific ENV_GET_CPU() macros have allowed us to navigatefrom CPUArchState to CPUState. The reverse direction was not supported.Avoid introducing CPU_GET_ENV() macros by initializing an untypedpointer that is initialized in derived instance_init functions....
target-alpha: Update AlphaCPU to QOM realizefn
Update the alpha_cpu_realize() signature and hook up toDeviceClass::realize. Set realized = true in cpu_alpha_init().
qapi/error.h is included through qdev now and no longer needed.
Acked-by: Richard Henderson <rth@twiddle.net>...
target-alpha: Catch attempt to instantiate abstract type in cpu_init()
This fixes -cpu alpha-cpu asserting.
Cc: qemu-stable@nongnu.orgSigned-off-by: Andreas Färber <afaerber@suse.de>
target-alpha: Detect attempt to instantiate non-CPU type in cpu_init()
Check in alpha_cpu_class_by_name() whether the type found is actually(a sub-type of) TYPE_ALPHA_CPU.
This fixes, e.g., -cpu typhoon-pcihost asserting.
cpu: Add model resolution support to CPUClass
Introduce CPUClass::class_by_name and add a default implementation.Hook up the alpha and ppc implementations.
Introduce a wrapper function cpu_class_by_name().
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative offset. Therefore the field is placed last in CPUState.
Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change.
Move common parts of mips cpu_state_reset() to mips_cpu_reset()....
qemu-common.h: Make qemu_init_vcpu() stub static inline
Turn the *-user macro into a no-op inline function to avoidunused-variable warnings and band-aiding #ifdef'ery.
This allows to drop an #ifdef for alpha and avoids more for unicore32and other upcoming trivial realizefn implementations....
Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu
Adapt header include paths.
cpu: Introduce CPUListState struct
This generalizes {ARM,M68k,Alpha}CPUListState to avoid declaring it foreach target. Place it in cpu-common.h to avoid circular dependencies.
Signed-off-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Igor Mammedov <imammedo@redhat.com>...
fpu: move public header file to include/fpu
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
qom: move include files to include/qom/
exec: move include files to include/exec/
build: kill libdis, move disassemblers to disas/
target-alpha: Add support for -cpu ?
Implement alphabetical listing of CPU subclasses.
Signed-off-by: Andreas Färber <afaerber@suse.de>Acked-by: Richard Henderson <rth@twiddle.net>
target-alpha: Let cpu_alpha_init() return AlphaCPU
Replace cpu_init() macro with inline function for backwardscompatibility.
target-alpha: Avoid leaking the alarm timer over reset
Move the timer from CPUAlphaState to AlphaCPU to avoid the pointer beingzero'ed once we implement reset. Would cause a segfault insys_helper.c:helper_set_alarm().
This also simplifies timer initialization in Typhoon....
target-alpha: Turn CPU definitions into subclasses
Make TYPE_ALPHA_CPU abstract and add types <name>-alpha-cpu.Use type inheritence, and turn "2*" models into aliases.
Move cpu_alpha_init() to cpu.c and split out CPU realization.Default to creating type "ev67-alpha-cpu" as before....
exec: refactor cpu_restore_state
Refactor common code around calls to cpu_restore_state().
tb_find_pc() has now no external users, make it static.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
TCG: Use gen_opc_instr_start from context instead of global variable.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Use gen_opc_pc from context instead of global variable.
TCG: Use gen_opc_icount from context instead of global variable.
target-alpha: Remove t0, t1 from CPUAlphaState
These fields are no longer (or were never?) used.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
TCG: Use gen_opc_buf from context instead of global variable.
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
TCG: Use gen_opc_ptr from context instead of global variable.
disas: avoid using cpu_single_env
Pass around CPUArchState instead of using global cpu_single_env.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Acked-by: Richard Henderson <rth@twiddle.net>Acked-by: Aurelien Jarno <aurelien@aurel32.net>Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
target-alpha: Use TCG_CALL_NO_WG
Mark helper functions that raise exceptions, but otherwise do notchange TCG register state, with TCG_CALL_NO_WG.
Signed-off-by: Richard Henderson <rth@twiddle.net>
cpus: Pass CPUState to [qemu_]cpu_has_work()
For target-mips also change the return type to bool.
Make include paths for cpu-qom.h consistent for alpha and unicore32.
Signed-off-by: Andreas Färber <afaerber@suse.de>[AF: Updated new target-openrisc function accordingly]...
target-alpha: rename helper flags
Rename helper flags to the new ones. This is purely a mechanical change,it's possible to use better flags by looking at the helpers.
Acked-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Rename target_phys_addr_t to hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes arereserved) and its purpose doesn't match the name (most target_phys_addr_taddresses are not target specific). Replace it with a finger-friendly,...
Emit debug_insn for CPU_LOG_TB_OP_OPT as well.
For all targets that currently call tcg_gen_debug_insn_start,add CPU_LOG_TB_OP_OPT to the condition that gates it.
This is useful for comparing optimization dumps, when thepre-optimization dump is merely noise....
target-alpha: Use movcond
For proper cmov insns, as well as the non-goto-tb caseof conditional branch.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-alpha: Initialize env->cpu_model_str
Save the cpu_model_str so that we have a non-null value whencreating a new cpu during clone.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
alpha-linux-user: Work around hosted mmap allocation problems
build: move other target-*/ objects to nested Makefile.objs
build: move libobj-y variable to nested Makefile.objs
build: move obj-TARGET-y variables to nested Makefile.objs
Also drop duplicate occurrence of device-hotplug.o.
target-alpha: QOM'ify CPU init
Move code from cpu_alpha_init() into a CPU initializer.
target-alpha: QOM'ify CPU
Embed CPUAlphaState as first member of AlphaCPU.
Use uintptr_t for various op related functions
Use uintptr_t instead of void * or unsigned long inseveral op related functions, env->mem_io_pc andGETPC macro.
Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Replace Qemu by QEMU in comments
The official spelling is QEMU.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>[blauwirbel@gmail.com: fixed comment style in hw/sun4m.c]Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Replace Qemu by QEMU in internal documentation
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-alpha: Use noreturn marker in helper.h.
target-alpha: Make use of fp_status.flush_inputs_to_zero.
This softfp feature post-dates the last major update to the Alphafpu translation. We can make use of this to eliminate at leastone helper function that was performing this operation by hand.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
target-alpha: Move memory helpers to mem_helper.c.
This completes the transition away from AREG0. This patch mustbe last because it requires CONFIG_TCG_PASS_AREG0 set too.
target-alpha: Move palcode support helpers to sys_helper.c.
target-alpha: Move integer overflow helpers to int_helper.c.
target-alpha: Move fpcr helpers from op_helper.c to helper.c.
target-alpha: Move floating-point helpers to fpu_helper.c.
target-alpha: Move integer helpers to int_helper.c.
target-alpha: Move exception helpers to helper.c.
alpha-linux-user: Initialize fpu to round-to-normal.
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
target-alpha: Don't overuse CPUState
Scripted conversion: sed -i "s/CPUState/CPUAlphaState/g" target-alpha/*.[hc] sed -i "s/#define CPUAlphaState/#define CPUState/" target-alpha/cpu.h
Signed-off-by: Andreas Färber <afaerber@suse.de>Acked-by: Anthony Liguori <aliguori@us.ibm.com>
target-alpha: Clean includes
The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.
Cc: Richard Henderson <rth@twiddle.net>Signed-off-by: Stefan Weil <sw@weilnetz.de>
fix spelling in target sub directory
Cc: Richard Henderson <rth@twiddle.net>Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>Cc: Aurelien Jarno <aurelien@aurel32.net>Cc: Alexander Graf <agraf@suse.de>Cc: Aurelien Jarno <aurelien@aurel32.net>Cc: Blue Swirl <blauwirbel@gmail.com>...
target-alpha: Implement WAIT IPR.
target-alpha: Implement HALT IPR.
target-alpha: Add high-resolution access to wall clock and an alarm.
The alarm is a fully general one-shot time comparator, which will beusable under Linux as a hrtimer source. It's much more flexible thanthe RTC source available on real hardware.
The wall clock allows the guest access to the host timekeeping. Much...
target-alpha: Honor icount for RPCC instruction.
softmmu_header: pass CPUState to tlb_fill
Pass CPUState pointer to tlb_fill() instead of architecture localcpu_single_env hacks.
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove unused is_softmmu parameter from cpu_handle_mmu_fault
Parameter is_softmmu (and its evil mutant twin brother is_softmuu)is not used in cpu_*_handle_mmu_fault() functions, remove themand adjust callers.
exec.h cleanup
Move softmmu_exec.h include directives from target-*/exec.h totarget-*/op_helper.c. Move also various other stuff only used inop_helper.c there.
Define global env in dyngen-exec.h.
For i386, move wrappers for segment and FPU helpers from user-exec.c...
Fix unassigned memory access handling
cea5f9a28faa528b6b1b117c9ab2d8828f473fef exposed bugs in unassigned memoryaccess handling. Fix them by always passing CPUState to the handlers.
Reported-by: Hervé Poussineau <hpoussin@reactos.org>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-alpha, target-ppc: Remove unnecessary setjmp.h include
Remove the include of setjmp.h from the cpu.h of target-alphaand target-ppc. This is unnecessary because cpu-defs.h alreadyincludes this header; this change brings these two targetsinto line with all the rest....
Remove exec-all.h include directives
Most exec-all.h include directives are now useless, remove them.
Move cpu_has_work and cpu_pc_from_tb to cpu.h
Move functions cpu_has_work() and cpu_pc_from_tb() from exec.h to cpu.h. This isneeded by later patches.
exec.h: fix coding style and change cpu_has_work to return bool
Before the next patch, fix coding style of the areas affected.
Change the type of the return value from cpu_has_work() andqemu_cpu_has_work() to bool.
cpu_loop_exit: avoid using AREG0
Make cpu_loop_exit() take a parameter for CPUState instead of relyingon global env.
alpha/translate: remve unused variables
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Richard Henderson <rth@twiddle.net>
alpha: remove unused variable
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 throughwithout the debugger getting confused by the mode switch.
target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode.
Reads the page table how PALcode would, except that the virtualpage table base register is not used.
target-alpha: Remap PIO space for 43-bit KSEG for EV6.
target-alpha: Trap for unassigned and unaligned addresses.
target-alpha: Use a fixed frequency for the RPCC in system mode.
Also include the PCC_OFS in the return value. For user mode wecan pretend the PCC_OFS value is always zero.
target-alpha: Implement TLB flush primitives.
Expose these via MTPR, more or less like the real HW does.
target-alpha: Merge HW_REI and HW_RET implementations.
target-alpha: Rationalize internal processor registers.
Delete all the code that tried to emulate the real IPRs of someunnamed CPU. Replace those with just 3 slots that we can use tocommunicate trap information between the helper functions thatsignal exceptions and the OS trap handler....
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...
target-alpha: Tidy exception constants.
There's no need to attempt to match EXCP_* values with PALcode entrypoint offsets. Instead, compress all the values to make for moreefficient switch statements within QEMU.
We will be doing TLB fill within QEMU proper, not within the PALcode,...
target-alpha: Tidy up arithmetic exceptions.
Introduce and use arith_excp, filling in the trap_arg01 IPRs.
target-alpha: Use do_restore_state for arithmetic exceptions.
This gets the PC right after an arithmetic exception. Also tidiesthe code in the TLB fault handlers to use common code.
target-alpha: Add various symbolic constants.
The EXC_M_* constants were being set for the EV6, not as set forthe Unix kernel entry point.
Use PS_USER_MODE instead of hard-coding access to the PS register.
target-alpha: Use kernel mmu_idx for pal_mode.
target-alpha: Add IPRs to be used by the emulation PALcode.
These aren't actually used yet, but we can at least accessthem via the HW_MFPR and HW_MTPR instructions.
target-alpha: Implement do_interrupt for system mode.
target-alpha: Swap shadow registers moving to/from PALmode.
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 differentcompilation modes are not compatible.
target-alpha: Disable interrupts properly.
Interrupts are disabled in PALmode, and when the PS IL is high enough.