Skip to content

Commit

Permalink
exec.c: Drop TARGET_HAS_ICE define and checks
Browse files Browse the repository at this point in the history
The TARGET_HAS_ICE #define is intended to indicate whether a target-*
guest CPU implementation supports the breakpoint handling. However,
all our guest CPUs have that support (the only two which do not
define TARGET_HAS_ICE are unicore32 and openrisc, and in both those
cases the bp support is present and the lack of the #define is just
a bug). So remove the #define entirely: all new guest CPU support
should include breakpoint handling as part of the basic implementation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 1420484960-32365-1-git-send-email-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Jan 20, 2015
1 parent 83ecb22 commit ec53b45
Show file tree
Hide file tree
Showing 17 changed files with 2 additions and 48 deletions.
16 changes: 0 additions & 16 deletions exec.c
Expand Up @@ -553,7 +553,6 @@ void cpu_exec_init(CPUArchState *env)
}
}

#if defined(TARGET_HAS_ICE)
#if defined(CONFIG_USER_ONLY)
static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
{
Expand All @@ -569,7 +568,6 @@ static void breakpoint_invalidate(CPUState *cpu, target_ulong pc)
}
}
#endif
#endif /* TARGET_HAS_ICE */

#if defined(CONFIG_USER_ONLY)
void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
Expand Down Expand Up @@ -689,7 +687,6 @@ static inline bool cpu_watchpoint_address_matches(CPUWatchpoint *wp,
int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
CPUBreakpoint **breakpoint)
{
#if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp;

bp = g_malloc(sizeof(*bp));
Expand All @@ -710,15 +707,11 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
*breakpoint = bp;
}
return 0;
#else
return -ENOSYS;
#endif
}

/* Remove a specific breakpoint. */
int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
{
#if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp;

QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
Expand All @@ -728,42 +721,34 @@ int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
}
}
return -ENOENT;
#else
return -ENOSYS;
#endif
}

/* Remove a specific breakpoint by reference. */
void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint)
{
#if defined(TARGET_HAS_ICE)
QTAILQ_REMOVE(&cpu->breakpoints, breakpoint, entry);

breakpoint_invalidate(cpu, breakpoint->pc);

g_free(breakpoint);
#endif
}

/* Remove all matching breakpoints. */
void cpu_breakpoint_remove_all(CPUState *cpu, int mask)
{
#if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp, *next;

QTAILQ_FOREACH_SAFE(bp, &cpu->breakpoints, entry, next) {
if (bp->flags & mask) {
cpu_breakpoint_remove_by_ref(cpu, bp);
}
}
#endif
}

/* enable or disable single step mode. EXCP_DEBUG is returned by the
CPU loop after each instruction */
void cpu_single_step(CPUState *cpu, int enabled)
{
#if defined(TARGET_HAS_ICE)
if (cpu->singlestep_enabled != enabled) {
cpu->singlestep_enabled = enabled;
if (kvm_enabled()) {
Expand All @@ -775,7 +760,6 @@ void cpu_single_step(CPUState *cpu, int enabled)
tb_flush(env);
}
}
#endif
}

void cpu_abort(CPUState *cpu, const char *fmt, ...)
Expand Down
4 changes: 0 additions & 4 deletions linux-user/main.c
Expand Up @@ -3436,10 +3436,8 @@ CPUArchState *cpu_copy(CPUArchState *env)
CPUState *cpu = ENV_GET_CPU(env);
CPUArchState *new_env = cpu_init(cpu_model);
CPUState *new_cpu = ENV_GET_CPU(new_env);
#if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp;
CPUWatchpoint *wp;
#endif

/* Reset non arch specific state */
cpu_reset(new_cpu);
Expand All @@ -3451,14 +3449,12 @@ CPUArchState *cpu_copy(CPUArchState *env)
BP_CPU break/watchpoints are handled correctly on clone. */
QTAILQ_INIT(&cpu->breakpoints);
QTAILQ_INIT(&cpu->watchpoints);
#if defined(TARGET_HAS_ICE)
QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, NULL);
}
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
cpu_watchpoint_insert(new_cpu, wp->vaddr, wp->len, wp->flags, NULL);
}
#endif

return new_env;
}
Expand Down
2 changes: 0 additions & 2 deletions target-alpha/cpu.h
Expand Up @@ -32,8 +32,6 @@

#include "fpu/softfloat.h"

#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_ALPHA

#define ICACHE_LINE_SIZE 32
Expand Down
2 changes: 0 additions & 2 deletions target-arm/cpu.h
Expand Up @@ -39,8 +39,6 @@

#include "fpu/softfloat.h"

#define TARGET_HAS_ICE 1

#define EXCP_UDEF 1 /* undefined instruction */
#define EXCP_SWI 2 /* software interrupt */
#define EXCP_PREFETCH_ABORT 3
Expand Down
2 changes: 0 additions & 2 deletions target-cris/cpu.h
Expand Up @@ -29,8 +29,6 @@

#include "exec/cpu-defs.h"

#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_CRIS

#define EXCP_NMI 1
Expand Down
2 changes: 0 additions & 2 deletions target-i386/cpu.h
Expand Up @@ -37,8 +37,6 @@
close to the modifying instruction */
#define TARGET_HAS_PRECISE_SMC

#define TARGET_HAS_ICE 1

#ifdef TARGET_X86_64
#define ELF_MACHINE EM_X86_64
#define ELF_MACHINE_UNAME "x86_64"
Expand Down
2 changes: 0 additions & 2 deletions target-lm32/cpu.h
Expand Up @@ -30,8 +30,6 @@
struct CPULM32State;
typedef struct CPULM32State CPULM32State;

#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_LATTICEMICO32

#define NB_MMU_MODES 1
Expand Down
2 changes: 0 additions & 2 deletions target-m68k/cpu.h
Expand Up @@ -32,8 +32,6 @@

#define MAX_QREGS 32

#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_68K

#define EXCP_ACCESS 2 /* Access (MMU) error. */
Expand Down
2 changes: 0 additions & 2 deletions target-microblaze/cpu.h
Expand Up @@ -34,8 +34,6 @@ typedef struct CPUMBState CPUMBState;
#include "mmu.h"
#endif

#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_MICROBLAZE

#define EXCP_NMI 1
Expand Down
1 change: 0 additions & 1 deletion target-mips/cpu.h
Expand Up @@ -4,7 +4,6 @@
//#define DEBUG_OP

#define ALIGNED_ONLY
#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_MIPS

Expand Down
2 changes: 0 additions & 2 deletions target-moxie/cpu.h
Expand Up @@ -26,8 +26,6 @@

#define CPUArchState struct CPUMoxieState

#define TARGET_HAS_ICE 1

#define ELF_MACHINE 0xFEED /* EM_MOXIE */

#define MOXIE_EX_DIV0 0
Expand Down
2 changes: 0 additions & 2 deletions target-ppc/cpu.h
Expand Up @@ -79,8 +79,6 @@

#include "fpu/softfloat.h"

#define TARGET_HAS_ICE 1

#if defined (TARGET_PPC64)
#define ELF_MACHINE EM_PPC64
#else
Expand Down
2 changes: 0 additions & 2 deletions target-s390x/cpu.h
Expand Up @@ -886,8 +886,6 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code);
uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,
uint64_t vr);

#define TARGET_HAS_ICE 1

/* The value of the TOD clock for 1.1.1970. */
#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL

Expand Down
1 change: 0 additions & 1 deletion target-sh4/cpu.h
Expand Up @@ -23,7 +23,6 @@
#include "qemu-common.h"

#define TARGET_LONG_BITS 32
#define TARGET_HAS_ICE 1

#define ELF_MACHINE EM_SH

Expand Down
2 changes: 0 additions & 2 deletions target-sparc/cpu.h
Expand Up @@ -31,8 +31,6 @@

#include "fpu/softfloat.h"

#define TARGET_HAS_ICE 1

#if !defined(TARGET_SPARC64)
#define ELF_MACHINE EM_SPARC
#else
Expand Down
2 changes: 0 additions & 2 deletions target-xtensa/cpu.h
Expand Up @@ -39,8 +39,6 @@
#include "exec/cpu-defs.h"
#include "fpu/softfloat.h"

#define TARGET_HAS_ICE 1

#define NB_MMU_MODES 4

#define TARGET_PHYS_ADDR_SPACE_BITS 32
Expand Down
4 changes: 2 additions & 2 deletions translate-all.c
Expand Up @@ -1451,7 +1451,7 @@ static TranslationBlock *tb_find_pc(uintptr_t tc_ptr)
return &tcg_ctx.tb_ctx.tbs[m_max];
}

#if defined(TARGET_HAS_ICE) && !defined(CONFIG_USER_ONLY)
#if !defined(CONFIG_USER_ONLY)
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
{
ram_addr_t ram_addr;
Expand All @@ -1467,7 +1467,7 @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr)
+ addr;
tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0);
}
#endif /* TARGET_HAS_ICE && !defined(CONFIG_USER_ONLY) */
#endif /* !defined(CONFIG_USER_ONLY) */

void tb_check_watchpoint(CPUState *cpu)
{
Expand Down

0 comments on commit ec53b45

Please sign in to comment.