Software single-stepping for PT_STEP on booke and ibm4xx
Rin Okuyama <[email protected]> Fri, 26 Feb 2021 18:12:24 +0900
| Newsgroups | gmane.os.netbsd.ports.powerpc |
|---|---|
| Message-ID | <[email protected]> |
Hi, Currently, PT_STEP ptrace(2) call on booke and ibm4xx is broken. I'd like to propose software-based single-stepping for them: http://www.netbsd.org/~rin/booke_4xx_software_sstep_20210226.patch With this patch, GDB works perfectly both on booke and 4xx, as far as I can see. I will commit the patch next week if there's no objection. Details: booke and ibm4xx have almost same hardware debug facilities, that are completely different from oea. They seem to be intended to debug OS (or firmware) itself with JTAG debugger, rather than user-level applications. The main difference with oea is that if target event occurs, critical exception is raised instead of ``normal'' exception. Critical exception is peculiar to booke/4xx. It is not blocked even if ``normal'' exception is disabled, unless critical exception itself is forbidden. Moreover, PSL_DE, debug interrupt enable bit in MSR, is cleared only when entering critical exception handlers; PSL_DE is not cleared when entering kernel mode via system call or hardware interrupt, unlike PSL_SE bit for oea. Therefore, this is cumbersome to use properly. The current code, as well as patch proposed by port-evbppc/24096, are intended to emulate oea's PSL_SE bit by using PSL_DE. But, due to the difficulty described above, they do not simply work. Therefore, I propose software-based single-stepping for booke and ibm4xx. Also note that DDB is already using software single-stepping. Thanks, rin