Lines Matching +full:non +full:- +full:pc

1 // SPDX-License-Identifier: GPL-2.0
38 #define PC(v) ((uint64_t)&(v)) macro
183 /* Setup a context-aware breakpoint for Linked Context ID Match */ in install_wp_ctx()
189 /* Setup a linked watchpoint (linked to the context-aware breakpoint) */ in install_wp_ctx()
204 /* Setup a context-aware breakpoint for Linked Context ID Match */ in install_hw_bp_ctx()
212 * to the context-aware breakpoint. in install_hw_bp_ctx()
241 /* Software-breakpoint */ in guest_code()
244 GUEST_ASSERT_EQ(sw_bp_addr, PC(sw_bp)); in guest_code()
246 /* Hardware-breakpoint */ in guest_code()
248 install_hw_bp(bpn, PC(hw_bp)); in guest_code()
250 GUEST_ASSERT_EQ(hw_bp_addr, PC(hw_bp)); in guest_code()
252 /* Hardware-breakpoint + svc */ in guest_code()
254 install_hw_bp(bpn, PC(bp_svc)); in guest_code()
256 GUEST_ASSERT_EQ(hw_bp_addr, PC(bp_svc)); in guest_code()
257 GUEST_ASSERT_EQ(svc_addr, PC(bp_svc) + 4); in guest_code()
259 /* Hardware-breakpoint + software-breakpoint */ in guest_code()
261 install_hw_bp(bpn, PC(bp_brk)); in guest_code()
263 GUEST_ASSERT_EQ(sw_bp_addr, PC(bp_brk)); in guest_code()
264 GUEST_ASSERT_EQ(hw_bp_addr, PC(bp_brk)); in guest_code()
268 install_wp(wpn, PC(write_data)); in guest_code()
271 GUEST_ASSERT_EQ(wp_data_addr, PC(write_data)); in guest_code()
273 /* Single-step */ in guest_code()
282 GUEST_ASSERT_EQ(ss_addr[0], PC(ss_start)); in guest_code()
283 GUEST_ASSERT_EQ(ss_addr[1], PC(ss_start) + 4); in guest_code()
284 GUEST_ASSERT_EQ(ss_addr[2], PC(ss_start) + 8); in guest_code()
286 /* OS Lock does not block software-breakpoint */ in guest_code()
291 GUEST_ASSERT_EQ(sw_bp_addr, PC(sw_bp2)); in guest_code()
293 /* OS Lock blocking hardware-breakpoint */ in guest_code()
296 install_hw_bp(bpn, PC(hw_bp2)); in guest_code()
306 install_wp(wpn, PC(write_data)); in guest_code()
311 /* OS Lock blocking single-step */ in guest_code()
323 /* Linked hardware-breakpoint */ in guest_code()
326 install_hw_bp_ctx(bpn, ctx_bpn, PC(hw_bp_ctx), ctx); in guest_code()
332 GUEST_ASSERT_EQ(hw_bp_addr, PC(hw_bp_ctx)); in guest_code()
336 install_wp_ctx(wpn, ctx_bpn, PC(write_data), ctx); in guest_code()
342 GUEST_ASSERT_EQ(wp_data_addr, PC(write_data)); in guest_code()
349 sw_bp_addr = regs->pc; in guest_sw_bp_handler()
350 regs->pc += 4; in guest_sw_bp_handler()
355 hw_bp_addr = regs->pc; in guest_hw_bp_handler()
356 regs->pstate |= SPSR_D; in guest_hw_bp_handler()
362 wp_addr = regs->pc; in guest_wp_handler()
363 regs->pstate |= SPSR_D; in guest_wp_handler()
369 ss_addr[ss_idx++] = regs->pc; in guest_ss_handler()
370 regs->pstate |= SPSR_SS; in guest_ss_handler()
375 svc_addr = regs->pc; in guest_svc_handler()
391 * the ucall structures, and the built-in "atomics" are usually in guest_code_ss()
400 * The userspace will verify that the pc is as expected during in guest_code_ss()
471 uint64_t pc, cmd; in test_single_step_from_userspace() local
477 run = vcpu->run; in test_single_step_from_userspace()
482 if (run->exit_reason != KVM_EXIT_DEBUG) { in test_single_step_from_userspace()
503 /* Check if the current pc is expected. */ in test_single_step_from_userspace()
504 pc = vcpu_get_reg(vcpu, ARM64_CORE_REG(regs.pc)); in test_single_step_from_userspace()
505 TEST_ASSERT(!test_pc || pc == test_pc, in test_single_step_from_userspace()
506 "Unexpected pc 0x%lx (expected 0x%lx)", in test_single_step_from_userspace()
507 pc, test_pc); in test_single_step_from_userspace()
509 if ((pc + 4) == (uint64_t)&iter_ss_end) { in test_single_step_from_userspace()
518 * If the current pc is between iter_ss_bgin and in test_single_step_from_userspace()
519 * iter_ss_end, the pc for the next KVM_EXIT_DEBUG should in test_single_step_from_userspace()
520 * be the current pc + 4. in test_single_step_from_userspace()
522 if ((pc >= (uint64_t)&iter_ss_begin) && in test_single_step_from_userspace()
523 (pc < (uint64_t)&iter_ss_end)) in test_single_step_from_userspace()
524 test_pc = pc + 4; in test_single_step_from_userspace()
534 * context-aware breakpoint# with the given ID_AA64DFR0_EL1 configuration.
554 /* Number of normal (non-context aware) breakpoints */ in test_guest_debug_exceptions_all()
555 normal_brp_num = brp_num - ctx_brp_num; in test_guest_debug_exceptions_all()
572 printf("Usage: %s [-h] [-i iterations of the single step test]\n", name); in help()
591 while ((opt = getopt(argc, argv, "i:")) != -1) { in main()