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

Trap control and instruction enable/disable in ARMv8

Hi Experts,

What is the trap control feature and its typical use case of the same ?

How instruction enable/disable feature in ARMv8 is useful  ?

Regards,

Techguyz

Parents
  • This functionality is used by more privileged SW to control the behaviour of less privileged SW.  Eg OS controlling user-space apps, Hypervisor controlling Guest OS etc.  Quite often this functionality is not used to disable instructions, but to detect them.  So the trap triggers when the instruction is used, this causes an exception to more privileged SW which now knows the instruction has been attempted.  The more privileged SW can then allow the instruction to be re-executed.

    The ability to disable FPU/NEON instructions is useful for "lazy context switching".  The FPU register bank is quite large and therefore expensive to save/restore to.from RAM but if you can guarantee that the register banks is never used you don't need to save them. 

    It can also be used to change the behaviour of operations.  Say an OS executes WFI which would usually put the core to sleep.  If that Os was running on a hypervisor then EL2 could trap execution of WFI and now that Guest OS can't sleep the physical core but the hypervisor can use this as a signal to suspend the Guest OS.

Reply
  • This functionality is used by more privileged SW to control the behaviour of less privileged SW.  Eg OS controlling user-space apps, Hypervisor controlling Guest OS etc.  Quite often this functionality is not used to disable instructions, but to detect them.  So the trap triggers when the instruction is used, this causes an exception to more privileged SW which now knows the instruction has been attempted.  The more privileged SW can then allow the instruction to be re-executed.

    The ability to disable FPU/NEON instructions is useful for "lazy context switching".  The FPU register bank is quite large and therefore expensive to save/restore to.from RAM but if you can guarantee that the register banks is never used you don't need to save them. 

    It can also be used to change the behaviour of operations.  Say an OS executes WFI which would usually put the core to sleep.  If that Os was running on a hypervisor then EL2 could trap execution of WFI and now that Guest OS can't sleep the physical core but the hypervisor can use this as a signal to suspend the Guest OS.

Children
No data