diff options
author | Joerg Roedel <jroedel@suse.de> | 2020-09-07 15:15:29 +0200 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2020-09-07 21:30:38 +0200 |
commit | 4bed2266cc6f9c3f6cd91378ea4fc76edde674cf (patch) | |
tree | 29522821292e9162d96f8c9112deab9205f606f4 /arch/x86/kernel/idt.c | |
parent | a7de15d489d956217b47671705ac2218ca50eaae (diff) | |
download | linux-stable-4bed2266cc6f9c3f6cd91378ea4fc76edde674cf.tar.gz linux-stable-4bed2266cc6f9c3f6cd91378ea4fc76edde674cf.tar.bz2 linux-stable-4bed2266cc6f9c3f6cd91378ea4fc76edde674cf.zip |
x86/idt: Split idt_data setup out of set_intr_gate()
The code to setup idt_data is needed for early exception handling, but
set_intr_gate() can't be used that early because it has pv-ops in its
code path which don't work that early.
Split out the idt_data initialization part from set_intr_gate() so
that it can be used separately.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lkml.kernel.org/r/20200907131613.12703-29-joro@8bytes.org
Diffstat (limited to 'arch/x86/kernel/idt.c')
-rw-r--r-- | arch/x86/kernel/idt.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/x86/kernel/idt.c b/arch/x86/kernel/idt.c index 7ecf9babf0cb..53946c104fa0 100644 --- a/arch/x86/kernel/idt.c +++ b/arch/x86/kernel/idt.c @@ -205,18 +205,24 @@ idt_setup_from_table(gate_desc *idt, const struct idt_data *t, int size, bool sy } } +static void init_idt_data(struct idt_data *data, unsigned int n, + const void *addr) +{ + BUG_ON(n > 0xFF); + + memset(data, 0, sizeof(*data)); + data->vector = n; + data->addr = addr; + data->segment = __KERNEL_CS; + data->bits.type = GATE_INTERRUPT; + data->bits.p = 1; +} + static __init void set_intr_gate(unsigned int n, const void *addr) { struct idt_data data; - BUG_ON(n > 0xFF); - - memset(&data, 0, sizeof(data)); - data.vector = n; - data.addr = addr; - data.segment = __KERNEL_CS; - data.bits.type = GATE_INTERRUPT; - data.bits.p = 1; + init_idt_data(&data, n, addr); idt_setup_from_table(idt_table, &data, 1, false); } |