Is it possible to make some privileged instructions (eg sti, cli) available via some Java’s API?
Why not? (Or if it’s is, could you give me some outline/basic idea of how this would be implemented?)
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In a conventional Java implementation, your only option is to implement the code that executes the privileged instructions in a native method that you call using JNI or JNA. And it won’t do you any good … because the hardware / operating system will prevent the instructions from running. (You will get an illegal instruction trap … and the program will be killed.)
Basically, if a regular Java application (or any other user-space application) could execute privileged instructions, it could trivially crash the operating system. That is a really bad idea.
In a bare-metal implementation of Java, it may be possible to execute privileged instructions via native code, or possibly by other means. (For instance, in JNode the native code compiler will replace certain “magic” method calls with privileged instructions … under carefully controlled circumstances.)