In x86-64, there are 2 sub-modes for ia-32e mode:
1> the compatibility mode
2> the 64-bit mode
My questions are:
1> why should we use a compatibility mode? Can't we just use ia32 protected mode if we wanna run 32-bit apps?
2> when transferring from 64-bit mode back to real mode, we must first enter the compatibility mode, why?
3> the intel manual says that in 64-bit mode, segmentation is generally disabled(for cs, ds, ss, gs), but in the structure of segment descriptor, there's a bit - bit21, and in 3.4.5 of Software Developer’s Manual 3A, description of this bit is: "In IA-32e mode, bit 21 of the second doubleword of the segment descriptor indicates whether a code segment contains native 64-bit code. A value of 1 indicates instructions in this code segment are executed in 64-bit mode. A value of 0 indicates the instructions in this code segment are executed in compatibility mode." So, if we do not use segment in 64-bit mode, why we need a segment descriptor like this?
Well, I'm muddled, and hope someone may help.
Thanks a lot!
question about ia-32e compatibility mode
Re: question about ia-32e compatibility mode
Hi,
1) You use compatibility mode so that you can have 32 bit and 64 bit tasks running alongside one another.
2) Because that's how the manuals say you should do the mode swich On the wiki, you will see a method of switching directly from real to long mode, though. Once in long mode, why would you want to switch back anyway?
Cheers,
Adam
1) You use compatibility mode so that you can have 32 bit and 64 bit tasks running alongside one another.
2) Because that's how the manuals say you should do the mode swich On the wiki, you will see a method of switching directly from real to long mode, though. Once in long mode, why would you want to switch back anyway?
Cheers,
Adam
Re: question about ia-32e compatibility mode
Thanks AJ,
1> Here's my interpretation about your "32 bit and 64 bit tasks running alongside one another":
Once we turned on the LME bit of IA32_EFER MSR, the ia32-e mode is entered. But whether we are running in 64-bit sub-mode or in compatibility mode is decided by the L-bit of the code segment descriptor (which is indexed by %cs). So, we can run a task(e.g. a 32-bit app) in compatibility sub-mode, and another(e.g. a 64-bit kernel thread) in 64-bit sub-mode, as long as we use different %cs values when task switch.
Am I right?
If so, here's another question: since 64-bit uses flat memory model, what kind of segment descriptor is appropriate for the 64-bit mode?
2> Do you know any particular reason for the manual to say so? Besides, we wanna transfer from the long mode back to real mode to invoke some bios routines.
1> Here's my interpretation about your "32 bit and 64 bit tasks running alongside one another":
Once we turned on the LME bit of IA32_EFER MSR, the ia32-e mode is entered. But whether we are running in 64-bit sub-mode or in compatibility mode is decided by the L-bit of the code segment descriptor (which is indexed by %cs). So, we can run a task(e.g. a 32-bit app) in compatibility sub-mode, and another(e.g. a 64-bit kernel thread) in 64-bit sub-mode, as long as we use different %cs values when task switch.
Am I right?
If so, here's another question: since 64-bit uses flat memory model, what kind of segment descriptor is appropriate for the 64-bit mode?
2> Do you know any particular reason for the manual to say so? Besides, we wanna transfer from the long mode back to real mode to invoke some bios routines.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: question about ia-32e compatibility mode
Which is the best way to break your OS in the long run.noodlezh wrote:we wanna transfer from the long mode back to real mode to invoke some bios routines
Re: question about ia-32e compatibility mode
Well, this is invoked once at the intitial process.
But, I wonder why you said so.
Also, could you please help me with my questions about the ia32-e mode?
Thanks!:)
But, I wonder why you said so.
Also, could you please help me with my questions about the ia32-e mode?
Thanks!:)
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: question about ia-32e compatibility mode
You could also have read the manuals and the wiki...
Re: question about ia-32e compatibility mode
It's better to do all required BIOS call at early boot stage, since returning from long mode to real mode has not been extensively tested by the world.
Re: question about ia-32e compatibility mode
Ok, thanks