stillconfused wrote:
Do you mean save the HART ID somewhere in the same structure I'm using to persist the HART state in my trap handler?
Yes. In user mode, each HART needs to point to a different instance of that structure to prevent traps from overwriting each others' state. Since each HART is guaranteed its own structure, you can store supervisor data there without risk of another HART accidentally claiming it.
You don't need to store any supervisor data in the structure while the HART is in supervisor mode. You probably don't want to, if you have a separate instance of that structure for each task.
You also don't need to store the HART ID directly. You could store the thread pointer register and make the HART ID a thread-local variable.