This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: cr5-6 registers on i386
- From: Ian Lance Taylor <iant at google dot com>
- To: Clemens Kolbitsch <clemens dot kol at gmx dot at>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 30 Jul 2007 10:09:37 -0700
- Subject: Re: cr5-6 registers on i386
- References: <200707301111.06038.clemens.kol@gmx.at>
Clemens Kolbitsch <clemens.kol@gmx.at> writes:
> short question: if i include an assembler instruction like the following
>
> __asm("movl %0, %%cr5" : : "r"(0x123));
>
> or
>
> __asm("movl %0, %%cr6" : : "r"(0x123));
>
> in a c-program, i do not get any errors when compiling on a x86(i386) cpu. the
> binary codes of the generated statements also differ from
>
> __asm("movl %0, %%cr3" : : "r"(0x123));
>
> (their third hex-numbers are different - what makes sense)... the thing i
> don't understand is: are there registers cr5-cr20 (starting at cr-something
> near 20, i start getting errors that there is no such register).
>
> Is that a bug caused by the multi-platform capability of gcc or are there such
> registers on i386 that i am not aware of (e.g. the intel manual does not name
> them!!)
The x86 architecture has control registers. They are not all
implemented in hardware; I believe the only ones which are implemented
are %cr0 through %cr4 and %cr8 (64-bit only). However, as the
relevant opcodes are not (yet) used for anything else, the GNU
assembler and disassembler will recognize other registers. You will
presumably get an exception if you try to actually run the program on
x86 hardware.
See the "Control Registers" section in volume 3 of the IA32 manuals,
which are available somewhere on the Intel web site.
Ian