When to use an LDRT instruction
Article ID: 103490421
Published date: 24 Jul 2017
Last updated: -
Applies to: Architecture
When would an LDRT instruction be used?
The LDRT instruction accesses memory as if the access were made by user-mode, even if actually in a privileged mode, and applies the permission check based on the code being 'user'. This is useful in a kernel where a user-space process passes a pointer to the kernel, and you want to ensure that the user process, not the kernel, has permissions to read the data.
This instruction could be used in a privileged code, such as an exception handler, to test whether an access is possible in thread mode. For example, if a user mode access were aborted, the exception handler might try to correct the problem by changing the memory protection settings. The LDRT could then be used to test whether the access was now possible.