MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dbg_setup_xpoint

Function dbg_setup_xpoint

freebsd/arm/arm/debug_monitor.c:590–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590static int
591dbg_setup_xpoint(struct dbg_wb_conf *conf)
592{
593 struct pcpu *pcpu;
594 struct dbreg *d;
595 const char *typestr;
596 uint32_t cr_size, cr_priv, cr_access;
597 uint32_t reg_ctrl, reg_addr, ctrl, addr;
598 boolean_t is_bkpt;
599 u_int cpu;
600 u_int i;
601
602 if (!dbg_capable())
603 return (ENXIO);
604
605 is_bkpt = (conf->type == DBG_TYPE_BREAKPOINT);
606 typestr = is_bkpt ? "breakpoint" : "watchpoint";
607
608 if (is_bkpt) {
609 if (dbg_breakpoint_num == 0) {
610 db_printf("Breakpoints not supported on this architecture\n");
611 return (ENXIO);
612 }
613 i = conf->slot;
614 if (!dbg_check_slot_free(DBG_TYPE_BREAKPOINT, i)) {
615 /*
616 * This should never happen. If it does it means that
617 * there is an erroneus scenario somewhere. Still, it can
618 * be done but let's inform the user.
619 */
620 db_printf("ERROR: Breakpoint already set. Replacing...\n");
621 }
622 } else {
623 i = dbg_find_free_slot(DBG_TYPE_WATCHPOINT);
624 if (i == ~0U) {
625 db_printf("Can not find slot for %s, max %d slots supported\n",
626 typestr, dbg_watchpoint_num);
627 return (ENXIO);
628 }
629 }
630
631 /* Kernel access only */
632 cr_priv = DBG_WB_CTRL_PL1;
633
634 switch(conf->size) {
635 case 1:
636 cr_size = DBG_WB_CTRL_LEN_1;
637 break;
638 case 2:
639 cr_size = DBG_WB_CTRL_LEN_2;
640 break;
641 case 4:
642 cr_size = DBG_WB_CTRL_LEN_4;
643 break;
644 case 8:
645 cr_size = DBG_WB_CTRL_LEN_8;
646 break;
647 default:

Callers 2

dbg_setup_watchpointFunction · 0.85
dbg_setup_breakpointFunction · 0.85

Calls 7

dbg_capableFunction · 0.85
db_printfFunction · 0.85
dbg_check_slot_freeFunction · 0.85
pcpu_findFunction · 0.85
dbg_find_free_slotFunction · 0.70
dbg_wb_write_regFunction · 0.70
atomic_thread_fence_relFunction · 0.50

Tested by

no test coverage detected