I have invested the segment selectors and descriptors.
Currently there seems to be no way to specifiy a default operand size of 64
bits ?!?!?
However some bits are reserved for future use and I think these might be
used to implement a default mode for operand size 64 bits.
CS.L = 1 and CS.D = 1 are reserved for future use.
I think this combination of bits could be used to implement default operand
size 64 bits !
However I think this would be related to 64 bit compatibility mode.
I am not sure how usefull that would be.
It might be insanely usefull or not at all ?!? I dont know
Here are some texts I found from the Intel Manual Volume 3A:
"
4.2.1 Code Segment Descriptor in 64-bit Mode
Code segments continue to exist in 64-bit mode even though, for address
calculations, the
segment base is treated as zero. Some code-segment (CS) descriptor content
(the base address
and limit fields) is ignored; the remaining fields function normally (except
for the readable bit
in the type field).
Code segment descriptors and selectors are needed in IA-32e mode to
establish the processor's
operating mode and execution privilege-level. The usage is as follows:
.. IA-32e mode uses a previously unused bit in the CS descriptor. Bit 53 is
defined as the
64-bit (L) flag and is used to select between 64-bit mode and compatibility
mode when
IA-32e mode is active (IA32_EFER.LMA = 1). See Figure 4-2.
- If CS.L = 0 and IA-32e mode is active, the processor is running in
compatibility mode.
In this case, CS.D selects the default size for data and addresses. If CS.D
= 0, the
default data and address size is 16 bits. If CS.D = 1, the default data and
address size is
32 bits.
- If CS.L = 1 and IA-32e mode is active, the only valid setting is CS.D = 0.
This setting
indicates a default operand size of 32 bits and a default address size of 64
bits. The
CS.L = 1 and CS.D = 1 bit combination is reserved for future use and a #GP
fault will
be generated on an attempt to use a code segment with these bits set in
IA-32e mode.
.. In IA-32e mode, the CS descriptor's DPL is used for execution privilege
checks (as in
legacy 32-bit mode).
"
Specifically:
"
If CS.L = 1 and IA-32e mode is active, the only valid setting is CS.D = 0.
This setting
indicates a default operand size of 32 bits and a default address size of 64
bits. The
"
As you can see from the text above, the default operand size remains 32
bits.
There is no way to specify a default operand size of 64 bits.
This makes it impossible to use a segment descriptor to quickly change
operand size from 32 bits to 64 bits or vice versa AT RUNTIME !
Otherwise it might have been possible to change the operand size at runtime
by simply changing the segment descriptor ?
^^^ Only one place for a change to occur ^^^ <- Could be a real nice feature
to convert existing binary code from 32 bit to 64 bit or vica versa with a
single change !
preferrably all at runtime ! <-- Nice idea.
Bye,
Skybuck.