Browse Source

Update gate-descriptor initialization

The initialization of gate descriptors was changed from using
set_intr_gate_ist() to idt_setup_from_table, which initalizes the
struct idt_data def_idts[] array.
Commit: https://lkml.org/lkml/2017/8/25/732

Update the entry point definition to contain the new read_cr2 attribute
Commit: https://lkml.org/lkml/2019/7/4/656

Update ENTRY and END macro to the new SYM_CODE_START & SYM_CODE_END
Commit: https://lkml.org/lkml/2019/10/11/344

Update the description of the code passages accordingly.
Sebastian Fricke 5 years ago
parent
commit
350c9715ee
1 changed files with 17 additions and 17 deletions
  1. 17 17
      Interrupts/linux-interrupts-1.md

+ 17 - 17
Interrupts/linux-interrupts-1.md

@@ -422,35 +422,35 @@ or
 #define MCE_STACK 4
 ```
 
-All interrupt-gate descriptors which switch to a new stack with the `IST` are initialized with the `set_intr_gate_ist` function. For example:
+All interrupt-gate descriptors, which switch to a new stack with the `IST`, are initialized within the `idt_setup_from_table` function. That function initializes every gate descriptor within the `struct idt_data def_idts[]` array.
+For example:
 
 ```C
-set_intr_gate_ist(X86_TRAP_NMI, &nmi, NMI_STACK);
-...
-...
-...
-set_intr_gate_ist(X86_TRAP_DF, &double_fault, DOUBLEFAULT_STACK);
-```
-
-where `&nmi` and `&double_fault` are addresses of the entries to the given interrupt handlers:
-
-```C
-asmlinkage void nmi(void);
-asmlinkage void double_fault(void);
+static const __initconst struct idt_data def_idts[] = {
+    ...
+	INTG(X86_TRAP_NMI,		nmi),
+    ...
+	INTG(X86_TRAP_DF,		double_fault),
 ```
 
-defined in the [arch/x86/kernel/entry_64.S](https://github.com/torvalds/linux/blob/16f73eb02d7e1765ccab3d2018e0bd98eb93d973/arch/x86/kernel/entry_64.S)
+where `nmi` and `double_fault` are entry points created at [arch/x86/kernel/entry\_64.S](https://github.com/torvalds/linux/blob/master/arch/x86/entry/entry_64.S): 
 
 ```assembly
-idtentry double_fault do_double_fault has_error_code=1 paranoid=2
+idtentry double_fault			do_double_fault			has_error_code=1 paranoid=2 read_cr2=1
 ...
 ...
 ...
-ENTRY(nmi)
+SYM_CODE_START(nmi)
 ...
 ...
 ...
-END(nmi)
+SYM_CODE_END(nmi)
+```
+for the the given interrupt handlers declared at [arch/x86/include/asm/traps.h](https://github.com/torvalds/linux/blob/master/arch/x86/include/asm/traps.h):
+
+```C
+asmlinkage void nmi(void);
+asmlinkage void double_fault(void);
 ```
 
 When an interrupt or an exception occurs, the new `ss` selector is forced to `NULL` and the `ss` selector’s `rpl` field is set to the new `cpl`. The old `ss`, `rsp`, register flags, `cs`, `rip` are pushed onto the new stack. In 64-bit mode, the size of interrupt stack-frame pushes is fixed at 8-bytes, so that we will get the following stack: