Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/machdep.c
Show First 20 Lines • Show All 371 Lines • ▼ Show 20 Lines | set_dbregs(struct thread *td, struct dbreg *regs) | ||||
monitor = &td->td_pcb->pcb_dbg_regs; | monitor = &td->td_pcb->pcb_dbg_regs; | ||||
count = 0; | count = 0; | ||||
monitor->dbg_enable_count = 0; | monitor->dbg_enable_count = 0; | ||||
for (i = 0; i < DBG_BRP_MAX; i++) { | for (i = 0; i < DBG_BRP_MAX; i++) { | ||||
addr = regs->db_breakregs[i].dbr_addr; | addr = regs->db_breakregs[i].dbr_addr; | ||||
ctrl = regs->db_breakregs[i].dbr_ctrl; | ctrl = regs->db_breakregs[i].dbr_ctrl; | ||||
/* Don't let the user set a breakpoint on a kernel address. */ | /* | ||||
* Don't let the user set a breakpoint on a kernel or | |||||
* non-canonical user address. | |||||
*/ | |||||
if (addr >= VM_MAXUSER_ADDRESS) | if (addr >= VM_MAXUSER_ADDRESS) | ||||
return (EINVAL); | return (EINVAL); | ||||
/* | /* | ||||
* The lowest 2 bits are ignored, so record the effective | * The lowest 2 bits are ignored, so record the effective | ||||
* address. | * address. | ||||
*/ | */ | ||||
addr = rounddown2(addr, 4); | addr = rounddown2(addr, 4); | ||||
Show All 18 Lines | for (i = 0; i < DBG_BRP_MAX; i++) { | ||||
monitor->dbg_bvr[i] = addr; | monitor->dbg_bvr[i] = addr; | ||||
monitor->dbg_bcr[i] = ctrl; | monitor->dbg_bcr[i] = ctrl; | ||||
} | } | ||||
for (i = 0; i < DBG_WRP_MAX; i++) { | for (i = 0; i < DBG_WRP_MAX; i++) { | ||||
addr = regs->db_watchregs[i].dbw_addr; | addr = regs->db_watchregs[i].dbw_addr; | ||||
ctrl = regs->db_watchregs[i].dbw_ctrl; | ctrl = regs->db_watchregs[i].dbw_ctrl; | ||||
/* Don't let the user set a watchpoint on a kernel address. */ | /* | ||||
* Don't let the user set a watchpoint on a kernel or | |||||
* non-canonical user address. | |||||
*/ | |||||
if (addr >= VM_MAXUSER_ADDRESS) | if (addr >= VM_MAXUSER_ADDRESS) | ||||
return (EINVAL); | return (EINVAL); | ||||
/* | /* | ||||
* Some control fields are ignored, and other bits reserved. | * Some control fields are ignored, and other bits reserved. | ||||
* Only unlinked watchpoints are supported. | * Only unlinked watchpoints are supported. | ||||
*/ | */ | ||||
ctrl &= DBG_WCR_EN | DBG_WCR_PAC | DBG_WCR_LSC | DBG_WCR_BAS | | ctrl &= DBG_WCR_EN | DBG_WCR_PAC | DBG_WCR_LSC | DBG_WCR_BAS | | ||||
▲ Show 20 Lines • Show All 1,076 Lines • Show Last 20 Lines |