Hi all,

I'm going porting LoongArch64 to UefiCpuPkg and OvmfPkg. A problem is blocked me that EFI_CPU_ARCH_PROTOCOL only provides interrupt register method, no exception register method.

I found that RISC-V hase the same issue, Andrei modified DebugSupport.h to fix it, commitid:69da506c927f8092ea8f783a092a694a3582e3ef. But this way may be not comply with UEFI SPEC, because in section 18 of UEFI SPEC, different architectures have been defined interupt types and exception types, and modifications like Andrei's will cause the UEFI SPEC and DebugSupport.h content to not match.

I also checked in AARCH64, they don't have this problem, because in AARCH64(ARM) uses synchronous exception, this exception is CPU internal exeption entry point, different type can separated by this entry point. So they just register this synchronous exception is fine,  and the exception filtering will be handled by the synchronous exception handler.

I think we need a way to reigster the exception, because some architectures like RISC-V and LoongArch don't have synchronous exception, and some one want to register exceptions to do some different. Can we add exception registration method at the end of EFI_CPU_ARCH_PROTOCOL? If not, I think there is only a modifcation like Andrei's, when the interrupt type and exception type use same numbers, put a flag in the highest bit to distinguish them. But I don't think this way is very suitable, just like above I talk about.

Hope to know your thoughts and look forward to hearing from you!



Thanks,
Chao