Hi everyone,

I want to add a new register in my project that can be set by the kernel in the 
privileged mode. I'm using Linux kernel and x86. I know that there are some 
reserved control registers in x86 such as cr1, cr4 which can be easily set 
using mov instruction, therefore I would like to make use of these reserved 
registers without adding new instructions to manipulate the registers. However, 
according to the x86 manual (and gem5 also enforces the spec), accessing 
reserved registers would result in "invalid opcode" exception. I noticed that 
x86 does have encoding for such reserved registers. For example, mov %rax, %cr1 
has the following instruction format:
     0F 22 c8
The first two bytes are opcodes and the third byte is ModR/M. I went through 
the decode section of the isa description and it should match the MOV(Rd,Cd) 
statement, but not any UD2 statement (I assume there is no legacy prefix for 
this instruction and LEGACY_DECODEVAL should be zero?). I was wondering where 
in the isa description that does the check of valid control register? Does 
anyone have any idea on this? Thanks in advance!

Best regards
Fangfei


_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to