Code: Select all
unsigned int???testcode(unsigned int lev)
{
int return_value;
__asm__ volatile ("int $0x80" \
: "=a" (return_value) \
: "0" ((long)(12)),"b" ((long)(lev))); \
return return_value;
}
Code: Select all
unsigned int???testcode(unsigned int lev)
{
int return_value;
__asm__ volatile ("int $0x80" \
: "=a" (return_value) \
: "0" ((long)(12)),"b" ((long)(lev))); \
return return_value;
}
can you confirm that ? esp. for 16 bits and the "segments" word ? (i thought there were no segments anymore in long mode -- and if there were 16 bits segments, using VBE bios wouldn't be that hard, right ?)AR wrote: In longmode, you can still use 32bit and 16bit segments which allows the 64bit kernel to run 64, 32 and 16 bit software all at the same time.
I can confirm that you can use 16 and 32 bit modes, and that they both support segmentation (although only as a superficial thingy on the paging layer, but it's logically equivalent with the normal way of doing stuff). I've not seen a problem using the VBE bios (now that I think of it) aside from being required to use 16/32-bit mode which not all have and which not all properly support.Pype.Clicker wrote:can you confirm that ? esp. for 16 bits and the "segments" word ? (i thought there were no segments anymore in long mode -- and if there were 16 bits segments, using VBE bios wouldn't be that hard, right ?)AR wrote: In longmode, you can still use 32bit and 16bit segments which allows the 64bit kernel to run 64, 32 and 16 bit software all at the same time.
IIRC, and using the terminology that AMD use, "long mode" has 2 different submodes (that are determined by CS) - "64 bit Mode" (64 bit registers, additional registers, 64 bit addressing, 64 bit operands), and "Compatibility Mode" which is intended to run 32 bit and 16 bit applications that were originally designed for normal/legacy protected mode.Pype.Clicker wrote:can you confirm that ? esp. for 16 bits and the "segments" word ? (i thought there were no segments anymore in long mode -- and if there were 16 bits segments, using VBE bios wouldn't be that hard, right ?)AR wrote:In longmode, you can still use 32bit and 16bit segments which allows the 64bit kernel to run 64, 32 and 16 bit software all at the same time.
AFAIK this basically means that 16-bit protected mode code and 32 bit protected mode code can be run like normal if the 64-bit kernel/OS supports it, which would include the 16 bit protected mode interfaces used by the VBE BIOS (and the protected mode interfaces for Plug & Play, APM, PCI, etc).Compatibility Mode --the second submode of long mode-- allows 64 bit operating systems to run existing 16 bit and 32 bit x86 applications. These legacy applications run in compatibility mode without recompilation.
Applications running in compatibility mode use 32-bit or 16-bit addressing and can access the first 4 GB of virtual-address space. Legacy x86 instruction prefixes toggle between 16-bit and 32-bit addressing and operand sizes.
As with 64-bit mode, compatibility mode is enabled by the operating system on a per code-segment basis. Unlike 64-bit mode, however, x86 segmentation functions the same as in legacy x86 architecture, using 16-bit or 32-bit protected mode semantics. From the application viewpoint, compatibility mode looks like the legacy x86 protected mode environment. From the operating system viewpoint, however, address translation, interrupt and exception handling, and system data structures use the 64-bit long mode mechanisms.
How confused can you be? Let me count the ways....Mike wrote:AFAIK, once in long mode, no 16-bit protected mode code is supported at all. The bit in the GDT entry used to specify 16-bit code is used under long mode to specify 64-bit code. Therefore, 16-bit protected mode cannot exist.
16-bit pmode _does_ exist on x64 machines before long mode is enabled.
I recall reading something on MSDN that warned developers about migrating their installers to Win64. The problem is that some installer bootstrap programs are Win16 (i.e. -- 16-bit protected mode), and therefore won't run.AR wrote: I'm pretty sure Windows x64 supports 16bit protected apps still, it's the real mode 16bit apps support that has been removed.
Oops! :-[Brendan wrote: How confused can you be?
Is it just me, or do I see a contradiction here? FYI, I don't know much about 64 bit, since I didn't look at it..Brendan wrote: Hi,
Basically, they've used this previously reserved bit 21 and called it "L", but the original default size bit (or bit 22, called 'D') still selects the default operand size. My AMD manual also says that if the 'L' bit is set, then the 'D' bit must be clear (that combination might be good for future 128 bit code ::)).
This gives 3 possible code types for long mode:
[tt] L = 1, D = 1 - A 64 bit code segment (the 64 bit sub-mode of long mode)
L = 0, D = 1 - A 32 bit code segment (the compatibility sub-mode of long mode)
L = 0, D = 0 - A 16 bit code segment (the compatibility sub-mode of long mode)[/tt]