mov eax, CR4 ??

mov eax, CR4 ??

Hi everyone,

Kinda askew but thought someone here might now. I'm trying to execute an asm command:

mov eax, CR4

which of course would read the control register CR4 and put it in eax. However when I execute this I am getting a privileged instruction error. Intel's Instruction Set Reference says that *writing* to a CR is privileged (0), but makes no mention of reading being privileged. Am I doing something wrong, or have I missed something in the reference?

Thanks!
-Dale

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello,

The Intel manual uses the Intel assembly syntax. In this syntax "mov eax, CR4" means move the contents of CR4 into eax. Due to the error you describe, I will assume that you are using the compiler in Linux, where the AT&T assembly syntax is used. In that case the arguments to the instructions are reversed, which means that you should use "mov CR4, eax" to accomplish what you are trying to use.

I hope that I made the correct assumption and that this will help :-)

Ioannis

Leave a Comment

Please sign in to add a comment. Not a member? Join today