[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and S
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT |
Date: |
Tue, 23 Apr 2024 11:18:20 +0200 |
On Mon, Apr 22, 2024 at 9:10 PM Volker Rümelin <vr_qemu@t-online.de> wrote:
>
> Am 20.04.24 um 07:40 schrieb Mark Cave-Ayland:
> >> Current documentation agrees that all 32 bits are written, so I don't
> >> think you need this comment:
> >
> > Ah that's good to know the docs are now correct. I added the comment
> > as there was a lot of conflicting information around for older CPUs so
> > I thought it was worth an explicit mention.
>
> Quote from the Intel® 64 and IA-32 Architectures Software Developer’s
> Manual Volume 2B: Instruction Set Reference, M-U March 2024:
>
> IA-32 Architecture Compatibility
> The 16-bit form of SGDT is compatible with the Intel 286 processor if
> the upper 8 bits are not referenced. The Intel 286 processor fills these
> bits with 1s; processor generations later than the Intel 286 processor
> fill these bits with 0s.
>
> Intel still claims the upper 8 bits are filled with 0s, but the
> Operation pseudo code below is correct. The same is true for SIDT.
I think the claim is that it fills with 0s when the software is
compatible with the 286, i.e. never uses a 32-bit LIDT or LGDT
instruction. Software written to target specifically older processors
typically used the undocumented LOADALL instruction to exit protected
mode or to set 4GB segment limits, so it won't run on QEMU. You can
read about the usage here:
https://www.os2museum.com/wp/more-on-loadall-and-os2/ (286)
https://www.os2museum.com/wp/386-loadall/ (386)
and about how it worked here:
https://www.pcjs.org/documents/manuals/intel/80286/loadall/
https://www.pcjs.org/documents/manuals/intel/80386/loadall/
Interestingly, byte 3 of the GDTR or IDTR on the 286 are documented as
"should be zeroes" for LOADALL, not all ones.
Let's change "Despite claims to the contrary" with "Despite a
confusing description".
Paolo
- [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Mark Cave-Ayland, 2024/04/19
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Richard Henderson, 2024/04/19
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Mark Cave-Ayland, 2024/04/20
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Volker Rümelin, 2024/04/22
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Philippe Mathieu-Daudé, 2024/04/23
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Daniel P . Berrangé, 2024/04/23
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT,
Paolo Bonzini <=
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Mark Cave-Ayland, 2024/04/23
- Re: [PATCH] target/i386/translate.c: always write 32-bits for SGDT and SIDT, Paolo Bonzini, 2024/04/26