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

Function dbg_check_slot_free

freebsd/arm/arm/debug_monitor.c:460–493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460static boolean_t
461dbg_check_slot_free(enum dbg_t type, u_int slot)
462{
463 uint32_t cr, vr;
464 uint32_t max;
465
466 switch(type) {
467 case DBG_TYPE_BREAKPOINT:
468 max = dbg_breakpoint_num;
469 cr = DBG_REG_BASE_BCR;
470 vr = DBG_REG_BASE_BVR;
471 break;
472 case DBG_TYPE_WATCHPOINT:
473 max = dbg_watchpoint_num;
474 cr = DBG_REG_BASE_WCR;
475 vr = DBG_REG_BASE_WVR;
476 break;
477 default:
478 db_printf("%s: Unsupported event type %d\n", __func__, type);
479 return (FALSE);
480 }
481
482 if (slot >= max) {
483 db_printf("%s: Invalid slot number %d, max %d\n",
484 __func__, slot, max - 1);
485 return (FALSE);
486 }
487
488 if ((dbg_wb_read_reg(cr, slot) & DBG_WB_CTRL_E) == 0 &&
489 (dbg_wb_read_reg(vr, slot) & DBGWVR_ADDR_MASK) == 0)
490 return (TRUE);
491
492 return (FALSE);
493}
494
495static u_int
496dbg_find_free_slot(enum dbg_t type)

Callers 3

dbg_remove_breakpointFunction · 0.85
dbg_find_free_slotFunction · 0.85
dbg_setup_xpointFunction · 0.85

Calls 2

db_printfFunction · 0.85
dbg_wb_read_regFunction · 0.70

Tested by

no test coverage detected