Hey, I have only one question. When we try to set the first bit of CR0, many web site do
MOV EAX, CR0. But EAX is a 32 bit register and in rMode we works with 16 bit register. Why this is a good instruction ?
Protected mode
Re: Protected mode
Hi,
When you 'MOV EAX, CR0' in real mode, your assembler automatically adds a 32 bit prefix to extend the operation size. There are many circumstances where it's useful to work with the full 32 bit registers even in real mode.
Cheers,
Adam
When you 'MOV EAX, CR0' in real mode, your assembler automatically adds a 32 bit prefix to extend the operation size. There are many circumstances where it's useful to work with the full 32 bit registers even in real mode.
Cheers,
Adam
Re: Protected mode
Because in real mode you can work with 32-bits registers as well as you in protected mode can work with 16-bits registers. The operand size prefix is used to use the size that is not default.
Re: Protected mode
Ok, but rMode is also in 32 bit ??
Re: Protected mode
Hi,
In real mode, the default operand size (registers and stack operations) and addressing mode is 16 bit. You are stuck with the 16 bit addressing mode in pure Real Mode, but the default operand size can be overridden.
Cheers,
Adam
In real mode, the default operand size (registers and stack operations) and addressing mode is 16 bit. You are stuck with the 16 bit addressing mode in pure Real Mode, but the default operand size can be overridden.
Cheers,
Adam
- 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: Protected mode
Not entirely true, you can use 32-bit addressing in pure real mode - you just have to be aware of the real mode access limit preventing you from using an effective address over 64k. As with 32 bit code, the assembler will add the necessary prefixes if you use [EAX+4*EBX] in real mode to make it work (just make sure that eax+4*ebx < 65536 when that gets executed).AJ wrote:You are stuck with the 16 bit addressing mode in pure Real Mode, but the default operand size can be overridden.