aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/arm-get-next-pcs.c9
-rw-r--r--gdb/arch/arm.c11
-rw-r--r--gdb/arch/arm.h3
3 files changed, 5 insertions, 18 deletions
diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c
index fc54133..0c49a77 100644
--- a/gdb/arch/arm-get-next-pcs.c
+++ b/gdb/arch/arm-get-next-pcs.c
@@ -22,6 +22,7 @@
#include "gdbsupport/common-regcache.h"
#include "arm.h"
#include "arm-get-next-pcs.h"
+#include "count-one-bits.h"
/* See arm-get-next-pcs.h. */
@@ -408,8 +409,8 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
/* Fetch the saved PC from the stack. It's stored above
all of the other registers. */
- unsigned long offset = bitcount (bits (inst1, 0, 7))
- * ARM_INT_REGISTER_SIZE;
+ unsigned long offset
+ = count_one_bits (bits (inst1, 0, 7)) * ARM_INT_REGISTER_SIZE;
sp = regcache_raw_get_unsigned (regcache, ARM_SP_REGNUM);
nextpc = self->ops->read_mem_uint (sp + offset, 4, byte_order);
}
@@ -496,7 +497,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
/* LDMIA or POP */
if (!bit (inst2, 15))
load_pc = 0;
- offset = bitcount (inst2) * 4 - 4;
+ offset = count_one_bits (inst2) * 4 - 4;
}
else if (!bit (inst1, 7) && bit (inst1, 8))
{
@@ -864,7 +865,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
{
/* up */
unsigned long reglist = bits (this_instr, 0, 14);
- offset = bitcount (reglist) * 4;
+ offset = count_one_bits_l (reglist) * 4;
if (bit (this_instr, 24)) /* pre */
offset += 4;
}
diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c
index 60d9f85..faa2b4f 100644
--- a/gdb/arch/arm.c
+++ b/gdb/arch/arm.c
@@ -42,17 +42,6 @@ thumb_insn_size (unsigned short inst1)
/* See arm.h. */
int
-bitcount (unsigned long val)
-{
- int nbits;
- for (nbits = 0; val != 0; nbits++)
- val &= val - 1; /* Delete rightmost 1-bit in val. */
- return nbits;
-}
-
-/* See arm.h. */
-
-int
condition_true (unsigned long cond, unsigned long status_reg)
{
if (cond == INST_AL || cond == INST_NV)
diff --git a/gdb/arch/arm.h b/gdb/arch/arm.h
index 2d9e87e..b0eb2ae 100644
--- a/gdb/arch/arm.h
+++ b/gdb/arch/arm.h
@@ -160,9 +160,6 @@ int thumb_insn_size (unsigned short inst1);
/* Returns true if the condition evaluates to true. */
int condition_true (unsigned long cond, unsigned long status_reg);
-/* Return number of 1-bits in VAL. */
-int bitcount (unsigned long val);
-
/* Return 1 if THIS_INSTR might change control flow, 0 otherwise. */
int arm_instruction_changes_pc (uint32_t this_instr);