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

Re: [Minios-devel] [UNIKRAFT PATCH 2/4] plat/kvm: remove 32-bit GDT entry



Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>

Florian Schmidt <florian.schmidt@xxxxxxxxx> writes:

> Since we spend almost no time in 32-bit mode, and never do any calls or
> returns, there's no reason to have a specific section in the GDT for
> 32-bit code. Just set up the bare essentials, then move on to long mode.
>
> Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
> ---
>  plat/kvm/include/kvm-x86/traps.h |  9 ++++-----
>  plat/kvm/x86/entry64.S           | 14 +++-----------
>  2 files changed, 7 insertions(+), 16 deletions(-)
>
> diff --git a/plat/kvm/include/kvm-x86/traps.h 
> b/plat/kvm/include/kvm-x86/traps.h
> index c457bda5..39bf0386 100644
> --- a/plat/kvm/include/kvm-x86/traps.h
> +++ b/plat/kvm/include/kvm-x86/traps.h
> @@ -29,14 +29,13 @@
>   */
>  #define GDT_DESC_NULL           0
>  #define GDT_DESC_CODE           1
> -#define GDT_DESC_CODE32         2 /* Used by _libkvmplat_start32 */
> -#define GDT_DESC_DATA           3
> -#define GDT_DESC_TSS_LO         4
> -#define GDT_DESC_TSS_HI         5
> +#define GDT_DESC_DATA           2
> +#define GDT_DESC_TSS_LO         3
> +#define GDT_DESC_TSS_HI         4
>  #define GDT_DESC_TSS            GDT_DESC_TSS_LO
>  
>  #define GDT_DESC_OFFSET(n)      ((n) * 0x8)
> -#define GDT_NUM_ENTRIES         6
> +#define GDT_NUM_ENTRIES         5
>  
>  #define GDT_DESC_CODE_VAL       0x00af99000000ffff
>  #define GDT_DESC_CODE32_VAL     0x00cf9b000000ffff
> diff --git a/plat/kvm/x86/entry64.S b/plat/kvm/x86/entry64.S
> index e15d41e2..7647446d 100644
> --- a/plat/kvm/x86/entry64.S
> +++ b/plat/kvm/x86/entry64.S
> @@ -79,14 +79,8 @@ ENTRY(_libkvmplat_start32)
>       jne nomultiboot
>  
>       lgdt (gdt64_ptr)
> -     /* let lret jump just one instruction ahead, but set %cs
> -      * to the correct GDT entry while doing that.
> -      */
> -     pushl $(gdt64_32cs-gdt64)
> -     pushl $1f
> -     lret
>  
> -1:   movl $(gdt64_ds-gdt64), %eax
> +     movl $(gdt64_ds-gdt64), %eax
>       movl %eax, %ds
>       movl %eax, %es
>       movl %eax, %ss
> @@ -122,7 +116,7 @@ ENTRY(_libkvmplat_start32)
>       /* 5: poetically longjump to longmode,
>        *    letting lret set %cs to the correct GDT entry on the way
>        */
> -     pushl $(gdt64_64cs-gdt64)
> +     pushl $(gdt64_cs-gdt64)
>       pushl $_libkvmplat_start64
>       lret
>  
> @@ -149,10 +143,8 @@ END(_libkvmplat_start32)
>  .align 64
>  gdt64:
>       .quad 0x0000000000000000
> -gdt64_64cs:
> +gdt64_cs:
>       .quad GDT_DESC_CODE_VAL         /* 64bit CS             */
> -gdt64_32cs:
> -     .quad GDT_DESC_CODE32_VAL       /* 32bit CS             */
>  gdt64_ds:
>       .quad GDT_DESC_DATA_VAL         /* DS                   */
>       .quad 0x0000000000000000        /* TSS part 1 (via C)   */
> -- 
> 2.21.0
>

-- 
Yuri Volchkov
Software Specialist

NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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