[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v2] x86/hvm: Use constants for x86 modes



Hello,

Le 04/12/2024 à 14:01, Andrew Cooper a écrit :
> On 02/12/2024 9:49 am, Teddy Astie wrote:
>> In many places of x86 HVM code, constants integer are used to indicate in 
>> what mode is
>> running the CPU (real, vm86, 16-bits, 32-bits, 64-bits). However, these 
>> constants are
>> are written directly as integer which hides the actual meaning of these 
>> modes.
>>
>> This patch introduces X86_MODE_* macros and replace those occurences with it.
>>
>> Signed-off-by Teddy Astie <teddy.astie@xxxxxxxxxx>
>
> As fed back previously, these are (mostly) not modes.
>
> "Mode" has a specific meaning in the x86 architecture which is not
> this.  You are going to have to change your commit message, and choice
> of constant names.
>
> ~Andrew

I took a look on the page you sent in the past [1], but I am quite
confused on how they should be named then.

Intel System Programming Guide in 2.2 "Modes of operation" defines these
as "operating modes"
- Protected mode (which are named in this patch X86_MODE_32BIT and
X86_MODE_16BIT)
- Real-address mode (which is named in this patch X86_MODE_REAL)
- Virtual-8086 mode (X86_MODE_VM86)
- IA-32e mode (X86_MODE_64BIT and in some cases X86_MODE_32BIT)

The page you sent introduce multiple "processor modes" with variants of
real mode (RM16, RM32), VM86 (VM16, VM16E0, VM16E1), Protected mode
(PM16, PM32) and IA32-mode "long mode" (CM16, CM32, PM64).

I think we can add all these modes as separate defines, while having a
way (macro ?) to check some attributes (e.g is it "long mode" ? with a
bit indicating a "long mode" mode).

[1] https://sandpile.org/x86/mode.htm

Teddy


Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.