A set of x86 cleanups:
- Rework the handling of x86_regset for 32 and 64 bit. The original implementation tried to minimize the allocation size with quite some hard to understand and fragile tricks. Make it robust and straight forward by separating the register enumerations for 32 and 64 bit completely. - Add a few missing static annotations - Remove the stale unused setup_once() assembly function - Address a few minor static analysis and kernel-doc warnings -----BEGIN PGP SIGNATURE----- iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmOUu0ATHHRnbHhAbGlu dXRyb25peC5kZQAKCRCmGPVMDXSYoUNzEACNn5XbRqxPQZak5XHeJ46/VNVTqTE0 Z7euwF8oP+aAybyDevvm18D2hB9Atn4vU9QJYhnTxBXbCLUNErKrH8FcXdNOBbeC YdAX7nO5WH8IM+drCMySeK6Tv6rvhnDUtgBzdBSl4NdPXUSOnGo+jHqHfN/Q+/n0 yvbwSoVAjD01sxVZQqKQOrzDgDuR/zlISCVudfS+tR4Rm/CYj0cl+MQS9Z1VM3Z6 7pqyypd5+CyNAD6vTDY/q+ZK0ShfNnU9TIIoGmOB/pc0kLctwIu3MY76Uo2DUgGn n/ItR9mvYu/QelCwX02VG3aRYJPLRfBa+DjQfZUwZapRz3rsjKtfa8ogpPZTLrSO o4ht/jxlKKDyNOQKYeL2yy054JR4DkKziilEzw5GZHeH2y66XWudRuWfMwbTdrGc esP5fSNfZ9uluYl6GCCw6S83RJzQ8aZXRcAy7CJgw2Qb4XE7IOA2jf18x5AYaDUp 4a6HCjbxYkEmKCkzkh9+w5koYruyizMBKMBBh5QsMzH4xp20s/vffHwbZ1tls9Za eTDC/E+wW9Om3qynRynm0EmcHpa0j+RcmkHOhFcXj6SRLnhzktk4Rrr3vlhardS3 Pc8h3GnE5mFXqS8t3r6/hvMk+6svhSu3RbICiLNU72F/tVLU628ux/WoCKfXZloE 7HxWoVhkTF7eOw== =DTBQ -----END PGP SIGNATURE----- Merge tag 'x86-cleanups-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 cleanups from Thomas Gleixner: "A set of x86 cleanups: - Rework the handling of x86_regset for 32 and 64 bit. The original implementation tried to minimize the allocation size with quite some hard to understand and fragile tricks. Make it robust and straight forward by separating the register enumerations for 32 and 64 bit completely. - Add a few missing static annotations - Remove the stale unused setup_once() assembly function - Address a few minor static analysis and kernel-doc warnings" * tag 'x86-cleanups-2022-12-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/asm/32: Remove setup_once() x86/kaslr: Fix process_mem_region()'s return value x86: Fix misc small issues x86/boot: Repair kernel-doc for boot_kstrtoul() x86: Improve formatting of user_regset arrays x86: Separate out x86_regset for 32 and 64 bit x86/i8259: Make default_legacy_pic static x86/tsc: Make art_related_clocksource static
This commit is contained in:
Коммит
79ad89123c
|
@ -668,7 +668,7 @@ static bool process_mem_region(struct mem_vector *region,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_EFI
|
||||
|
|
|
@ -350,7 +350,7 @@ static int _kstrtoul(const char *s, unsigned int base, unsigned long *res)
|
|||
}
|
||||
|
||||
/**
|
||||
* kstrtoul - convert a string to an unsigned long
|
||||
* boot_kstrtoul - convert a string to an unsigned long
|
||||
* @s: The start of the string. The string must be null-terminated, and may also
|
||||
* include a single newline before its terminating null. The first character
|
||||
* may also be a plus sign, but not a minus sign.
|
||||
|
|
|
@ -1608,7 +1608,7 @@ static void text_poke_loc_init(struct text_poke_loc *tp, void *addr,
|
|||
|
||||
default:
|
||||
BUG_ON(len != insn.length);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
switch (tp->opcode) {
|
||||
|
|
|
@ -260,16 +260,6 @@ SYM_FUNC_START(startup_32_smp)
|
|||
/* Shift the stack pointer to a virtual address */
|
||||
addl $__PAGE_OFFSET, %esp
|
||||
|
||||
/*
|
||||
* start system 32-bit setup. We need to re-do some of the things done
|
||||
* in 16-bit mode for the "real" operations.
|
||||
*/
|
||||
movl setup_once_ref,%eax
|
||||
andl %eax,%eax
|
||||
jz 1f # Did we do this already?
|
||||
call *%eax
|
||||
1:
|
||||
|
||||
/*
|
||||
* Check if it is 486
|
||||
*/
|
||||
|
@ -331,18 +321,7 @@ SYM_FUNC_END(startup_32_smp)
|
|||
|
||||
#include "verify_cpu.S"
|
||||
|
||||
/*
|
||||
* setup_once
|
||||
*
|
||||
* The setup work we only want to run on the BSP.
|
||||
*
|
||||
* Warning: %esi is live across this function.
|
||||
*/
|
||||
__INIT
|
||||
setup_once:
|
||||
andl $0,setup_once_ref /* Once is enough, thanks */
|
||||
RET
|
||||
|
||||
SYM_FUNC_START(early_idt_handler_array)
|
||||
# 36(%esp) %eflags
|
||||
# 32(%esp) %cs
|
||||
|
@ -458,7 +437,6 @@ SYM_DATA(early_recursion_flag, .long 0)
|
|||
__REFDATA
|
||||
.align 4
|
||||
SYM_DATA(initial_code, .long i386_start_kernel)
|
||||
SYM_DATA(setup_once_ref, .long setup_once)
|
||||
|
||||
#ifdef CONFIG_PAGE_TABLE_ISOLATION
|
||||
#define PGD_ALIGN (2 * PAGE_SIZE)
|
||||
|
|
|
@ -407,7 +407,7 @@ struct legacy_pic null_legacy_pic = {
|
|||
.make_irq = legacy_pic_uint_noop,
|
||||
};
|
||||
|
||||
struct legacy_pic default_legacy_pic = {
|
||||
static struct legacy_pic default_legacy_pic = {
|
||||
.nr_legacy_irqs = NR_IRQS_LEGACY,
|
||||
.chip = &i8259A_chip,
|
||||
.mask = mask_8259A_irq,
|
||||
|
|
|
@ -44,16 +44,35 @@
|
|||
|
||||
#include "tls.h"
|
||||
|
||||
enum x86_regset {
|
||||
REGSET_GENERAL,
|
||||
REGSET_FP,
|
||||
REGSET_XFP,
|
||||
REGSET_IOPERM64 = REGSET_XFP,
|
||||
REGSET_XSTATE,
|
||||
REGSET_TLS,
|
||||
REGSET_IOPERM32,
|
||||
enum x86_regset_32 {
|
||||
REGSET32_GENERAL,
|
||||
REGSET32_FP,
|
||||
REGSET32_XFP,
|
||||
REGSET32_XSTATE,
|
||||
REGSET32_TLS,
|
||||
REGSET32_IOPERM,
|
||||
};
|
||||
|
||||
enum x86_regset_64 {
|
||||
REGSET64_GENERAL,
|
||||
REGSET64_FP,
|
||||
REGSET64_IOPERM,
|
||||
REGSET64_XSTATE,
|
||||
};
|
||||
|
||||
#define REGSET_GENERAL \
|
||||
({ \
|
||||
BUILD_BUG_ON((int)REGSET32_GENERAL != (int)REGSET64_GENERAL); \
|
||||
REGSET32_GENERAL; \
|
||||
})
|
||||
|
||||
#define REGSET_FP \
|
||||
({ \
|
||||
BUILD_BUG_ON((int)REGSET32_FP != (int)REGSET64_FP); \
|
||||
REGSET32_FP; \
|
||||
})
|
||||
|
||||
|
||||
struct pt_regs_offset {
|
||||
const char *name;
|
||||
int offset;
|
||||
|
@ -788,13 +807,13 @@ long arch_ptrace(struct task_struct *child, long request,
|
|||
#ifdef CONFIG_X86_32
|
||||
case PTRACE_GETFPXREGS: /* Get the child extended FPU state. */
|
||||
return copy_regset_to_user(child, &user_x86_32_view,
|
||||
REGSET_XFP,
|
||||
REGSET32_XFP,
|
||||
0, sizeof(struct user_fxsr_struct),
|
||||
datap) ? -EIO : 0;
|
||||
|
||||
case PTRACE_SETFPXREGS: /* Set the child extended FPU state. */
|
||||
return copy_regset_from_user(child, &user_x86_32_view,
|
||||
REGSET_XFP,
|
||||
REGSET32_XFP,
|
||||
0, sizeof(struct user_fxsr_struct),
|
||||
datap) ? -EIO : 0;
|
||||
#endif
|
||||
|
@ -1086,13 +1105,13 @@ static long ia32_arch_ptrace(struct task_struct *child, compat_long_t request,
|
|||
|
||||
case PTRACE_GETFPXREGS: /* Get the child extended FPU state. */
|
||||
return copy_regset_to_user(child, &user_x86_32_view,
|
||||
REGSET_XFP, 0,
|
||||
REGSET32_XFP, 0,
|
||||
sizeof(struct user32_fxsr_struct),
|
||||
datap);
|
||||
|
||||
case PTRACE_SETFPXREGS: /* Set the child extended FPU state. */
|
||||
return copy_regset_from_user(child, &user_x86_32_view,
|
||||
REGSET_XFP, 0,
|
||||
REGSET32_XFP, 0,
|
||||
sizeof(struct user32_fxsr_struct),
|
||||
datap);
|
||||
|
||||
|
@ -1215,29 +1234,38 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
|
|||
#ifdef CONFIG_X86_64
|
||||
|
||||
static struct user_regset x86_64_regsets[] __ro_after_init = {
|
||||
[REGSET_GENERAL] = {
|
||||
.core_note_type = NT_PRSTATUS,
|
||||
.n = sizeof(struct user_regs_struct) / sizeof(long),
|
||||
.size = sizeof(long), .align = sizeof(long),
|
||||
.regset_get = genregs_get, .set = genregs_set
|
||||
[REGSET64_GENERAL] = {
|
||||
.core_note_type = NT_PRSTATUS,
|
||||
.n = sizeof(struct user_regs_struct) / sizeof(long),
|
||||
.size = sizeof(long),
|
||||
.align = sizeof(long),
|
||||
.regset_get = genregs_get,
|
||||
.set = genregs_set
|
||||
},
|
||||
[REGSET_FP] = {
|
||||
.core_note_type = NT_PRFPREG,
|
||||
.n = sizeof(struct fxregs_state) / sizeof(long),
|
||||
.size = sizeof(long), .align = sizeof(long),
|
||||
.active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set
|
||||
[REGSET64_FP] = {
|
||||
.core_note_type = NT_PRFPREG,
|
||||
.n = sizeof(struct fxregs_state) / sizeof(long),
|
||||
.size = sizeof(long),
|
||||
.align = sizeof(long),
|
||||
.active = regset_xregset_fpregs_active,
|
||||
.regset_get = xfpregs_get,
|
||||
.set = xfpregs_set
|
||||
},
|
||||
[REGSET_XSTATE] = {
|
||||
.core_note_type = NT_X86_XSTATE,
|
||||
.size = sizeof(u64), .align = sizeof(u64),
|
||||
.active = xstateregs_active, .regset_get = xstateregs_get,
|
||||
.set = xstateregs_set
|
||||
[REGSET64_XSTATE] = {
|
||||
.core_note_type = NT_X86_XSTATE,
|
||||
.size = sizeof(u64),
|
||||
.align = sizeof(u64),
|
||||
.active = xstateregs_active,
|
||||
.regset_get = xstateregs_get,
|
||||
.set = xstateregs_set
|
||||
},
|
||||
[REGSET_IOPERM64] = {
|
||||
.core_note_type = NT_386_IOPERM,
|
||||
.n = IO_BITMAP_LONGS,
|
||||
.size = sizeof(long), .align = sizeof(long),
|
||||
.active = ioperm_active, .regset_get = ioperm_get
|
||||
[REGSET64_IOPERM] = {
|
||||
.core_note_type = NT_386_IOPERM,
|
||||
.n = IO_BITMAP_LONGS,
|
||||
.size = sizeof(long),
|
||||
.align = sizeof(long),
|
||||
.active = ioperm_active,
|
||||
.regset_get = ioperm_get
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1256,43 +1284,57 @@ static const struct user_regset_view user_x86_64_view = {
|
|||
|
||||
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
|
||||
static struct user_regset x86_32_regsets[] __ro_after_init = {
|
||||
[REGSET_GENERAL] = {
|
||||
.core_note_type = NT_PRSTATUS,
|
||||
.n = sizeof(struct user_regs_struct32) / sizeof(u32),
|
||||
.size = sizeof(u32), .align = sizeof(u32),
|
||||
.regset_get = genregs32_get, .set = genregs32_set
|
||||
[REGSET32_GENERAL] = {
|
||||
.core_note_type = NT_PRSTATUS,
|
||||
.n = sizeof(struct user_regs_struct32) / sizeof(u32),
|
||||
.size = sizeof(u32),
|
||||
.align = sizeof(u32),
|
||||
.regset_get = genregs32_get,
|
||||
.set = genregs32_set
|
||||
},
|
||||
[REGSET_FP] = {
|
||||
.core_note_type = NT_PRFPREG,
|
||||
.n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
|
||||
.size = sizeof(u32), .align = sizeof(u32),
|
||||
.active = regset_fpregs_active, .regset_get = fpregs_get, .set = fpregs_set
|
||||
[REGSET32_FP] = {
|
||||
.core_note_type = NT_PRFPREG,
|
||||
.n = sizeof(struct user_i387_ia32_struct) / sizeof(u32),
|
||||
.size = sizeof(u32),
|
||||
.align = sizeof(u32),
|
||||
.active = regset_fpregs_active,
|
||||
.regset_get = fpregs_get,
|
||||
.set = fpregs_set
|
||||
},
|
||||
[REGSET_XFP] = {
|
||||
.core_note_type = NT_PRXFPREG,
|
||||
.n = sizeof(struct fxregs_state) / sizeof(u32),
|
||||
.size = sizeof(u32), .align = sizeof(u32),
|
||||
.active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set
|
||||
[REGSET32_XFP] = {
|
||||
.core_note_type = NT_PRXFPREG,
|
||||
.n = sizeof(struct fxregs_state) / sizeof(u32),
|
||||
.size = sizeof(u32),
|
||||
.align = sizeof(u32),
|
||||
.active = regset_xregset_fpregs_active,
|
||||
.regset_get = xfpregs_get,
|
||||
.set = xfpregs_set
|
||||
},
|
||||
[REGSET_XSTATE] = {
|
||||
.core_note_type = NT_X86_XSTATE,
|
||||
.size = sizeof(u64), .align = sizeof(u64),
|
||||
.active = xstateregs_active, .regset_get = xstateregs_get,
|
||||
.set = xstateregs_set
|
||||
[REGSET32_XSTATE] = {
|
||||
.core_note_type = NT_X86_XSTATE,
|
||||
.size = sizeof(u64),
|
||||
.align = sizeof(u64),
|
||||
.active = xstateregs_active,
|
||||
.regset_get = xstateregs_get,
|
||||
.set = xstateregs_set
|
||||
},
|
||||
[REGSET_TLS] = {
|
||||
.core_note_type = NT_386_TLS,
|
||||
.n = GDT_ENTRY_TLS_ENTRIES, .bias = GDT_ENTRY_TLS_MIN,
|
||||
.size = sizeof(struct user_desc),
|
||||
.align = sizeof(struct user_desc),
|
||||
.active = regset_tls_active,
|
||||
.regset_get = regset_tls_get, .set = regset_tls_set
|
||||
[REGSET32_TLS] = {
|
||||
.core_note_type = NT_386_TLS,
|
||||
.n = GDT_ENTRY_TLS_ENTRIES,
|
||||
.bias = GDT_ENTRY_TLS_MIN,
|
||||
.size = sizeof(struct user_desc),
|
||||
.align = sizeof(struct user_desc),
|
||||
.active = regset_tls_active,
|
||||
.regset_get = regset_tls_get,
|
||||
.set = regset_tls_set
|
||||
},
|
||||
[REGSET_IOPERM32] = {
|
||||
.core_note_type = NT_386_IOPERM,
|
||||
.n = IO_BITMAP_BYTES / sizeof(u32),
|
||||
.size = sizeof(u32), .align = sizeof(u32),
|
||||
.active = ioperm_active, .regset_get = ioperm_get
|
||||
[REGSET32_IOPERM] = {
|
||||
.core_note_type = NT_386_IOPERM,
|
||||
.n = IO_BITMAP_BYTES / sizeof(u32),
|
||||
.size = sizeof(u32),
|
||||
.align = sizeof(u32),
|
||||
.active = ioperm_active,
|
||||
.regset_get = ioperm_get
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1311,10 +1353,10 @@ u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
|
|||
void __init update_regset_xstate_info(unsigned int size, u64 xstate_mask)
|
||||
{
|
||||
#ifdef CONFIG_X86_64
|
||||
x86_64_regsets[REGSET_XSTATE].n = size / sizeof(u64);
|
||||
x86_64_regsets[REGSET64_XSTATE].n = size / sizeof(u64);
|
||||
#endif
|
||||
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
|
||||
x86_32_regsets[REGSET_XSTATE].n = size / sizeof(u64);
|
||||
x86_32_regsets[REGSET32_XSTATE].n = size / sizeof(u64);
|
||||
#endif
|
||||
xstate_fx_sw_bytes[USER_XSTATE_XCR0_WORD] = xstate_mask;
|
||||
}
|
||||
|
|
|
@ -68,13 +68,13 @@
|
|||
|
||||
#ifdef CONFIG_X86_64
|
||||
#include <asm/x86_init.h>
|
||||
#include <asm/proto.h>
|
||||
#else
|
||||
#include <asm/processor-flags.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/proto.h>
|
||||
#endif
|
||||
|
||||
#include <asm/proto.h>
|
||||
|
||||
DECLARE_BITMAP(system_vectors, NR_VECTORS);
|
||||
|
||||
static inline void cond_local_irq_enable(struct pt_regs *regs)
|
||||
|
|
|
@ -51,7 +51,7 @@ int tsc_clocksource_reliable;
|
|||
static u32 art_to_tsc_numerator;
|
||||
static u32 art_to_tsc_denominator;
|
||||
static u64 art_to_tsc_offset;
|
||||
struct clocksource *art_related_clocksource;
|
||||
static struct clocksource *art_related_clocksource;
|
||||
|
||||
struct cyc2ns {
|
||||
struct cyc2ns_data data[2]; /* 0 + 2*16 = 32 */
|
||||
|
|
Загрузка…
Ссылка в новой задаче