This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to deice debug target exception level of watchpoint on ARMv8 architecture

Hello, everyone

I'm new to this community.

I'd like to ask many questions and want to help someone.

Now I have some difficulties in understanding aarch64's watchpoint exception handling scheme.

I found I can decide which exception level whachpoint exception can be generated in from ARMv8 Reference manual

( plz refer to Table D2-15 Summary of watchpoint HMC, SSC, and PAC encodings in the manual)

I ,also, found I can decide Which exception level the generated exception is thrown to by setting MDCR_EL2 register

According to a description from ARMv8 Ref. Manual below, when MDSCR_EL2.TDE field is 1, all the non-secure debug exception are thrown to EL2.

=====================================================================

If EL2 is implemented, the routing of debug exceptions taken from Non-secure state depends on

MDCR_EL2.TDE:

1 Debug exceptions taken from Non-secure state are routed to EL2.

0 Debug exceptions behave as follows:

• Debug exceptions taken from Non-secure EL1 and EL0 are routed to Non-secure EL1.

• Software Breakpoint Instruction exceptions taken from EL2 are routed to EL2.

• All other debug exceptions are disabled from EL2 using AArch64.

=====================================================================

According to TAble D2-15, I can let watchpoint exception can be generated at EL2 and EL1 by controlling a DBGWCR register

But which exception level a generated exception is routed to is decided by MDCR_EL2.TDE field.

By the way, manual said All other debug exceptions are disabled from EL2 using AArch64 when MDCR_EL2.TDE is 0.

Then, Is a exception taken from EL2 ignored, when MDCR_EL2 is 0?

Actually, I found watchpoint exception taken from EL1 is routed to EL2 when MDSCR_EL2.TDE is 1.

I also found watchpoint exception take from EL2 is not routed neither EL2 nor EL1.

Is is true?

I want an exception from taken from an exception level to be routed to the exception level.

For example, an WP exception from EL1 can be routed to EL1 and one from EL2 can be routed to EL2.

Is it possible?

second question.

I found when MDCR_EL2.TDE is 1, Debug exception is generated and routed to EL2 by not only watchpoint exception but also accessing to debug register such as DBGWCR at EL1

Can I change this rule?

I mean I want to only watchpoint exception from EL1 to be routed to EL2.

Is is possible?