| 458 | } |
| 459 | |
| 460 | static boolean_t |
| 461 | dbg_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 | |
| 495 | static u_int |
| 496 | dbg_find_free_slot(enum dbg_t type) |
no test coverage detected