I am running one example on a72 core.I am facing issue where i am not able to read any control registers , i was trying to read CurrentEL register.As my example is running at EL0 ,so i don't have access to read this reg, so i was trying to call SVC(which we can call from el0).
when i call svc i get errorProcess 577559 (example) terminated SIGILL code=1 fltno=1 ip=00000000004052b0Illegal instruction (core dumped)
my questions are:1. can i call svc and come out clean from svc handler , my el level will be at EL1?2. can i resume my example execution at EL1?
Anoop kumar yadav said:1. can i call svc and come out clean from svc handler , my el level will be at EL1?
From an architecture point of view, sure that is possible. The issue is going to be what is already running at EL1. As you're running at EL0 I'm guessing there is come kind of OS at EL1 and that the error you quoted came from that OS. Typically SVCs will be used to call into the OS (hence Supervisor Call instruction) and the OS will have a published SVC interface describing what user-space can ask the OS to do.
Note, an SVC at EL0 will go either to EL1 or EL2 depending on how HCR_EL2.TGE is set. Just an FYI.
Anoop kumar yadav said:2. can i resume my example execution at EL1?
Do you mean resume execution of the EL0 app but at EL1? Again, strictly, that's down to the interface the OS offers - but almost certainly not. The OS is not going to allow arbitrary user space code to run in a privileged state.
Perhaps a dumb question, but why are you trying to read CurrentEL?
What does the rest of the software stack look like?
Doing what you described is fairly straightforward if you are running bare-metal, the Learn the Architecture guides will take you through installing vector tables and writing handlers. If you've got something that looks more like a full software stack (e.g. TF-A at EL3, UEFI at EL2, Host OS...) then you'd either need to modify those layers or work through whatever existing interfaces they provide.