On 31.10.2024 14:27, Teddy Astie wrote:
> In many places of x86 HVM code, constants integer are used to indicate in 
> what mode is
> running the CPU (real, v86, 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.as...@vates.tech>
> ---
> I am not sure of other places that uses these integer constants.

At the very least svm_guest_x86_mode() also wants changing.

> @@ -2952,11 +2952,11 @@ static const char *guest_x86_mode_to_str(int mode)
>  {
>      switch ( mode )
>      {
> -    case 0:  return "Real";
> -    case 1:  return "v86";
> -    case 2:  return "16bit";
> -    case 4:  return "32bit";
> -    case 8:  return "64bit";
> +    case X86_MODE_REAL:  return "Real";
> +    case X86_MODE_V86:  return "v86";
> +    case X86_MODE_16BIT:  return "16bit";
> +    case X86_MODE_32BIT:  return "32bit";
> +    case X86_MODE_64BIT:  return "64bit";

Please don't break columnar alignment here. As hinted at in the other reply
already, personally I'd prefer VM86 anyway.

Jan

Reply via email to