Re: [PATCH v6 13/76] x86/boot/compressed/64: Add IDT Infrastructure

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

 



On Mon, Aug 24, 2020 at 10:54:08AM +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@xxxxxxx>
> 
> Add code needed to setup an IDT in the early pre-decompression
> boot-code. The IDT is loaded first in startup_64, which is after
> EfiExitBootServices() has been called, and later reloaded when the
> kernel image has been relocated to the end of the decompression area.
> 
> This allows to setup different IDT handlers before and after the
> relocation.
> 
> Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
> Link: https://lore.kernel.org/r/20200724160336.5435-13-joro@xxxxxxxxxx
> diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
> index 9e46729cf162..260c7940f960 100644
> --- a/arch/x86/boot/compressed/head_64.S
> +++ b/arch/x86/boot/compressed/head_64.S
> @@ -33,6 +33,7 @@
>  #include <asm/processor-flags.h>
>  #include <asm/asm-offsets.h>
>  #include <asm/bootparam.h>
> +#include <asm/desc_defs.h>
>  #include "pgtable.h"
>  
>  /*
> @@ -415,6 +416,10 @@ SYM_CODE_START(startup_64)
>  
>  .Lon_kernel_cs:
>  
> +	pushq	%rsi
> +	call	load_stage1_idt
> +	popq	%rsi
> +

Do we need the functions later in the series or could this just use lidt
directly?

Is there any risk of exceptions getting triggered during the move of the
compressed kernel, before the stage2 reload?

>  
> +SYM_DATA_START(boot_idt_desc)
> +	.word	boot_idt_end - boot_idt

I think this should be boot_idt_end - boot_idt - 1, right?
  The limit value is expressed in bytes and is added to the base address
  to get the address of the last valid byte. A limit value of 0 results
  in exactly 1 valid byte. Because IDT entries are always eight bytes
  long, the limit should always be one less than an integral multiple of
  eight (that is, 8N – 1).

> +	.quad	0
> +SYM_DATA_END(boot_idt_desc)
> +	.balign 8
> +SYM_DATA_START(boot_idt)
> +	.rept	BOOT_IDT_ENTRIES
> +	.quad	0
> +	.quad	0
> +	.endr
> +SYM_DATA_END_LABEL(boot_idt, SYM_L_GLOBAL, boot_idt_end)
> +



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux