target/cortex_m: faster reading of all CPU registers
[fw/openocd] / src / target / mips_mips64.c
index 3a592f7f329a220a9a430e3aa0681990c7cab3e4..56b0194e76a8423f7467da879301d2422c9f6601 100644 (file)
@@ -62,7 +62,7 @@ static int mips_mips64_debug_entry(struct target *target)
        mips_mips64_examine_debug_reason(target);
 
        LOG_DEBUG("entered debug state at PC 0x%" PRIx64 ", target->state: %s",
-                 *(uint64_t *)pc->value, target_state_name(target));
+                 buf_get_u64(pc->value, 0, 64), target_state_name(target));
 
        return ERROR_OK;
 }
@@ -247,7 +247,7 @@ static int mips_mips64_set_hwbp(struct target *target, struct breakpoint *bp)
                bp_num++;
 
        if (bp_num >= mips64->num_inst_bpoints) {
-               LOG_DEBUG("ERROR Can not find free FP Comparator(bpid: %d)",
+               LOG_DEBUG("ERROR Can not find free FP Comparator(bpid: %" PRIu32 ")",
                          bp->unique_id);
                LOG_WARNING("ERROR Can not find free FP Comparator");
                exit(-1);
@@ -274,7 +274,7 @@ static int mips_mips64_set_hwbp(struct target *target, struct breakpoint *bp)
        if (retval != ERROR_OK)
                return retval;
 
-       LOG_DEBUG("bpid: %d, bp_num %i bp_value 0x%" PRIx64 "", bp->unique_id,
+       LOG_DEBUG("bpid: %" PRIu32 ", bp_num %i bp_value 0x%" PRIx64, bp->unique_id,
                  bp_num, c->bp_value);
 
        return ERROR_OK;
@@ -354,7 +354,7 @@ static int mips_mips64_set_breakpoint(struct target *target,
        if (bp->type == BKPT_HARD) {
                retval = mips_mips64_set_hwbp(target, bp);
        } else {
-               LOG_DEBUG("bpid: %d", bp->unique_id);
+               LOG_DEBUG("bpid: %" PRIu32, bp->unique_id);
 
                switch (bp->length) {
                case MIPS64_SDBBP_SIZE:
@@ -410,8 +410,8 @@ static int mips_mips64_set_watchpoint(struct target *target,
         * and exclude both load and store accesses from  watchpoint
         * condition evaluation
        */
-       int enable = EJTAG_DBCn_NOSB | EJTAG_DBCn_NOLB | EJTAG_DBCn_BE
-               | (0xff << EJTAG_DBCn_BLM_SHIFT);
+       int enable = EJTAG_DBCN_NOSB | EJTAG_DBCN_NOLB | EJTAG_DBCN_BE
+               | (0xff << EJTAG_DBCN_BLM_SHIFT);
 
        if (watchpoint->set) {
                LOG_WARNING("watchpoint already set");
@@ -438,13 +438,13 @@ static int mips_mips64_set_watchpoint(struct target *target,
 
        switch (watchpoint->rw) {
        case WPT_READ:
-               enable &= ~EJTAG_DBCn_NOLB;
+               enable &= ~EJTAG_DBCN_NOLB;
                break;
        case WPT_WRITE:
-               enable &= ~EJTAG_DBCn_NOSB;
+               enable &= ~EJTAG_DBCN_NOSB;
                break;
        case WPT_ACCESS:
-               enable &= ~(EJTAG_DBCn_NOLB | EJTAG_DBCn_NOSB);
+               enable &= ~(EJTAG_DBCN_NOLB | EJTAG_DBCN_NOSB);
                break;
        default:
                LOG_ERROR("BUG: watchpoint->rw neither read, write nor access");
@@ -511,12 +511,12 @@ static int mips_mips64_unset_hwbp(struct target *target, struct breakpoint *bp)
        bp_num = bp->set - 1;
 
        if ((bp_num < 0) || (bp_num >= mips64->num_inst_bpoints)) {
-               LOG_DEBUG("Invalid FP Comparator number in breakpoint (bpid: %d)",
+               LOG_DEBUG("Invalid FP Comparator number in breakpoint (bpid: %" PRIu32 ")",
                          bp->unique_id);
                return ERROR_OK;
        }
 
-       LOG_DEBUG("bpid: %d - releasing hw: %d", bp->unique_id, bp_num);
+       LOG_DEBUG("bpid: %" PRIu32 " - releasing hw: %d", bp->unique_id, bp_num);
        comparator_list[bp_num].used = false;
        comparator_list[bp_num].bp_value = 0;
 
@@ -576,7 +576,7 @@ static int mips_mips64_unset_breakpoint(struct target *target,
        if (bp->type == BKPT_HARD) {
                retval = mips_mips64_unset_hwbp(target, bp);
        } else {
-               LOG_DEBUG("bpid: %d", bp->unique_id);
+               LOG_DEBUG("bpid: %" PRIu32, bp->unique_id);
 
                switch (bp->length) {
                case MIPS64_SDBBP_SIZE:
@@ -923,7 +923,7 @@ static int mips_mips64_read_memory(struct target *target, uint64_t address,
        retval = mips64_pracc_read_mem(ejtag_info, address, size, count,
                                       (void *)t);
 
-       if (ERROR_OK != retval) {
+       if (retval != ERROR_OK) {
                LOG_ERROR("mips64_pracc_read_mem filed");
                goto read_done;
        }