Merge branch 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-vdso-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86-64, vdso: Do not allocate memory for the vDSO clocksource: Change __ARCH_HAS_CLOCKSOURCE_DATA to a CONFIG option x86, vdso: Drop now wrong comment Document the vDSO and add a reference parser ia64: Replace clocksource.fsys_mmio with generic arch data x86-64: Move vread_tsc and vread_hpet into the vDSO clocksource: Replace vread with generic arch data x86-64: Add --no-undefined to vDSO build x86-64: Allow alternative patching in the vDSO x86: Make alternative instruction pointers relative x86-64: Improve vsyscall emulation CS and RIP handling x86-64: Emulate legacy vsyscalls x86-64: Fill unused parts of the vsyscall page with 0xcc x86-64: Remove vsyscall number 3 (venosys) x86-64: Map the HPET NX x86-64: Remove kernel.vsyscall64 sysctl x86-64: Give vvars their own page x86-64: Document some of entry_64.S x86-64: Fix alignment of jiffies variable
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
|
||||
.macro altinstruction_entry orig alt feature orig_len alt_len
|
||||
.align 8
|
||||
.quad \orig
|
||||
.quad \alt
|
||||
.long \orig - .
|
||||
.long \alt - .
|
||||
.word \feature
|
||||
.byte \orig_len
|
||||
.byte \alt_len
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
#endif
|
||||
|
||||
struct alt_instr {
|
||||
u8 *instr; /* original instruction */
|
||||
u8 *replacement;
|
||||
s32 instr_offset; /* original instruction */
|
||||
s32 repl_offset; /* offset to replacement instruction */
|
||||
u16 cpuid; /* cpuid bit set for replacement */
|
||||
u8 instrlen; /* length of original instruction */
|
||||
u8 replacementlen; /* length of new instruction, <= instrlen */
|
||||
@@ -84,8 +84,8 @@ static inline int alternatives_text_reserved(void *start, void *end)
|
||||
"661:\n\t" oldinstr "\n662:\n" \
|
||||
".section .altinstructions,\"a\"\n" \
|
||||
_ASM_ALIGN "\n" \
|
||||
_ASM_PTR "661b\n" /* label */ \
|
||||
_ASM_PTR "663f\n" /* new instruction */ \
|
||||
" .long 661b - .\n" /* label */ \
|
||||
" .long 663f - .\n" /* new instruction */ \
|
||||
" .word " __stringify(feature) "\n" /* feature bit */ \
|
||||
" .byte 662b-661b\n" /* sourcelen */ \
|
||||
" .byte 664f-663f\n" /* replacementlen */ \
|
||||
|
||||
18
arch/x86/include/asm/clocksource.h
Normal file
18
arch/x86/include/asm/clocksource.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/* x86-specific clocksource additions */
|
||||
|
||||
#ifndef _ASM_X86_CLOCKSOURCE_H
|
||||
#define _ASM_X86_CLOCKSOURCE_H
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
|
||||
#define VCLOCK_NONE 0 /* No vDSO clock available. */
|
||||
#define VCLOCK_TSC 1 /* vDSO should use vread_tsc. */
|
||||
#define VCLOCK_HPET 2 /* vDSO should use vread_hpet. */
|
||||
|
||||
struct arch_clocksource_data {
|
||||
int vclock_mode;
|
||||
};
|
||||
|
||||
#endif /* CONFIG_X86_64 */
|
||||
|
||||
#endif /* _ASM_X86_CLOCKSOURCE_H */
|
||||
@@ -331,8 +331,8 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
|
||||
"2:\n"
|
||||
".section .altinstructions,\"a\"\n"
|
||||
_ASM_ALIGN "\n"
|
||||
_ASM_PTR "1b\n"
|
||||
_ASM_PTR "0\n" /* no replacement */
|
||||
" .long 1b - .\n"
|
||||
" .long 0\n" /* no replacement */
|
||||
" .word %P0\n" /* feature bit */
|
||||
" .byte 2b - 1b\n" /* source len */
|
||||
" .byte 0\n" /* replacement len */
|
||||
@@ -349,8 +349,8 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
|
||||
"2:\n"
|
||||
".section .altinstructions,\"a\"\n"
|
||||
_ASM_ALIGN "\n"
|
||||
_ASM_PTR "1b\n"
|
||||
_ASM_PTR "3f\n"
|
||||
" .long 1b - .\n"
|
||||
" .long 3f - .\n"
|
||||
" .word %P1\n" /* feature bit */
|
||||
" .byte 2b - 1b\n" /* source len */
|
||||
" .byte 4f - 3f\n" /* replacement len */
|
||||
|
||||
@@ -78,6 +78,7 @@ enum fixed_addresses {
|
||||
VSYSCALL_LAST_PAGE,
|
||||
VSYSCALL_FIRST_PAGE = VSYSCALL_LAST_PAGE
|
||||
+ ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
|
||||
VVAR_PAGE,
|
||||
VSYSCALL_HPET,
|
||||
#endif
|
||||
FIX_DBGP_BASE,
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
* Vectors 0 ... 31 : system traps and exceptions - hardcoded events
|
||||
* Vectors 32 ... 127 : device interrupts
|
||||
* Vector 128 : legacy int80 syscall interface
|
||||
* Vectors 129 ... INVALIDATE_TLB_VECTOR_START-1 : device interrupts
|
||||
* Vector 204 : legacy x86_64 vsyscall emulation
|
||||
* Vectors 129 ... INVALIDATE_TLB_VECTOR_START-1 except 204 : device interrupts
|
||||
* Vectors INVALIDATE_TLB_VECTOR_START ... 255 : special interrupts
|
||||
*
|
||||
* 64-bit x86 has per CPU IDT tables, 32-bit has one shared IDT table.
|
||||
@@ -50,6 +51,9 @@
|
||||
#ifdef CONFIG_X86_32
|
||||
# define SYSCALL_VECTOR 0x80
|
||||
#endif
|
||||
#ifdef CONFIG_X86_64
|
||||
# define VSYSCALL_EMU_VECTOR 0xcc
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Vectors 0x30-0x3f are used for ISA interrupts.
|
||||
|
||||
@@ -107,7 +107,8 @@
|
||||
#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
|
||||
#define __PAGE_KERNEL_UC_MINUS (__PAGE_KERNEL | _PAGE_PCD)
|
||||
#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
|
||||
#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
|
||||
#define __PAGE_KERNEL_VVAR (__PAGE_KERNEL_RO | _PAGE_USER)
|
||||
#define __PAGE_KERNEL_VVAR_NOCACHE (__PAGE_KERNEL_VVAR | _PAGE_PCD | _PAGE_PWT)
|
||||
#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
|
||||
#define __PAGE_KERNEL_LARGE_NOCACHE (__PAGE_KERNEL | _PAGE_CACHE_UC | _PAGE_PSE)
|
||||
#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
|
||||
@@ -129,7 +130,8 @@
|
||||
#define PAGE_KERNEL_LARGE_NOCACHE __pgprot(__PAGE_KERNEL_LARGE_NOCACHE)
|
||||
#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC)
|
||||
#define PAGE_KERNEL_VSYSCALL __pgprot(__PAGE_KERNEL_VSYSCALL)
|
||||
#define PAGE_KERNEL_VSYSCALL_NOCACHE __pgprot(__PAGE_KERNEL_VSYSCALL_NOCACHE)
|
||||
#define PAGE_KERNEL_VVAR __pgprot(__PAGE_KERNEL_VVAR)
|
||||
#define PAGE_KERNEL_VVAR_NOCACHE __pgprot(__PAGE_KERNEL_VVAR_NOCACHE)
|
||||
|
||||
#define PAGE_KERNEL_IO __pgprot(__PAGE_KERNEL_IO)
|
||||
#define PAGE_KERNEL_IO_NOCACHE __pgprot(__PAGE_KERNEL_IO_NOCACHE)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _ASM_X86_TRAPS_H
|
||||
#define _ASM_X86_TRAPS_H
|
||||
|
||||
#include <linux/kprobes.h>
|
||||
|
||||
#include <asm/debugreg.h>
|
||||
#include <asm/siginfo.h> /* TRAP_TRACE, ... */
|
||||
|
||||
@@ -38,6 +40,7 @@ asmlinkage void alignment_check(void);
|
||||
asmlinkage void machine_check(void);
|
||||
#endif /* CONFIG_X86_MCE */
|
||||
asmlinkage void simd_coprocessor_error(void);
|
||||
asmlinkage void emulate_vsyscall(void);
|
||||
|
||||
dotraplinkage void do_divide_error(struct pt_regs *, long);
|
||||
dotraplinkage void do_debug(struct pt_regs *, long);
|
||||
@@ -64,6 +67,7 @@ dotraplinkage void do_alignment_check(struct pt_regs *, long);
|
||||
dotraplinkage void do_machine_check(struct pt_regs *, long);
|
||||
#endif
|
||||
dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long);
|
||||
dotraplinkage void do_emulate_vsyscall(struct pt_regs *, long);
|
||||
#ifdef CONFIG_X86_32
|
||||
dotraplinkage void do_iret_error(struct pt_regs *, long);
|
||||
#endif
|
||||
|
||||
@@ -51,10 +51,6 @@ extern int unsynchronized_tsc(void);
|
||||
extern int check_tsc_unstable(void);
|
||||
extern unsigned long native_calibrate_tsc(void);
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
extern cycles_t vread_tsc(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Boot-time check whether the TSCs are synchronized across
|
||||
* all CPUs/cores:
|
||||
|
||||
@@ -11,10 +11,9 @@ struct vsyscall_gtod_data {
|
||||
time_t wall_time_sec;
|
||||
u32 wall_time_nsec;
|
||||
|
||||
int sysctl_enabled;
|
||||
struct timezone sys_tz;
|
||||
struct { /* extract of a clocksource struct */
|
||||
cycle_t (*vread)(void);
|
||||
int vclock_mode;
|
||||
cycle_t cycle_last;
|
||||
cycle_t mask;
|
||||
u32 mult;
|
||||
|
||||
@@ -16,10 +16,6 @@ enum vsyscall_num {
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/seqlock.h>
|
||||
|
||||
/* Definitions for CONFIG_GENERIC_TIME definitions */
|
||||
#define __vsyscall_fn \
|
||||
__attribute__ ((unused, __section__(".vsyscall_fn"))) notrace
|
||||
|
||||
#define VGETCPU_RDTSCP 1
|
||||
#define VGETCPU_LSL 2
|
||||
|
||||
|
||||
@@ -10,15 +10,14 @@
|
||||
* In normal kernel code, they are used like any other variable.
|
||||
* In user code, they are accessed through the VVAR macro.
|
||||
*
|
||||
* Each of these variables lives in the vsyscall page, and each
|
||||
* one needs a unique offset within the little piece of the page
|
||||
* reserved for vvars. Specify that offset in DECLARE_VVAR.
|
||||
* (There are 896 bytes available. If you mess up, the linker will
|
||||
* catch it.)
|
||||
* These variables live in a page of kernel data that has an extra RO
|
||||
* mapping for userspace. Each variable needs a unique offset within
|
||||
* that page; specify that offset with the DECLARE_VVAR macro. (If
|
||||
* you mess up, the linker will catch it.)
|
||||
*/
|
||||
|
||||
/* Offset of vars within vsyscall page */
|
||||
#define VSYSCALL_VARS_OFFSET (3072 + 128)
|
||||
/* Base address of vvars. This is not ABI. */
|
||||
#define VVAR_ADDRESS (-10*1024*1024 - 4096)
|
||||
|
||||
#if defined(__VVAR_KERNEL_LDS)
|
||||
|
||||
@@ -26,17 +25,17 @@
|
||||
* right place.
|
||||
*/
|
||||
#define DECLARE_VVAR(offset, type, name) \
|
||||
EMIT_VVAR(name, VSYSCALL_VARS_OFFSET + offset)
|
||||
EMIT_VVAR(name, offset)
|
||||
|
||||
#else
|
||||
|
||||
#define DECLARE_VVAR(offset, type, name) \
|
||||
static type const * const vvaraddr_ ## name = \
|
||||
(void *)(VSYSCALL_START + VSYSCALL_VARS_OFFSET + (offset));
|
||||
(void *)(VVAR_ADDRESS + (offset));
|
||||
|
||||
#define DEFINE_VVAR(type, name) \
|
||||
type __vvar_ ## name \
|
||||
__attribute__((section(".vsyscall_var_" #name), aligned(16)))
|
||||
type name \
|
||||
__attribute__((section(".vvar_" #name), aligned(16)))
|
||||
|
||||
#define VVAR(name) (*vvaraddr_ ## name)
|
||||
|
||||
@@ -45,8 +44,7 @@
|
||||
/* DECLARE_VVAR(offset, type, name) */
|
||||
|
||||
DECLARE_VVAR(0, volatile unsigned long, jiffies)
|
||||
DECLARE_VVAR(8, int, vgetcpu_mode)
|
||||
DECLARE_VVAR(16, int, vgetcpu_mode)
|
||||
DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data)
|
||||
|
||||
#undef DECLARE_VVAR
|
||||
#undef VSYSCALL_VARS_OFFSET
|
||||
|
||||
Reference in New Issue
Block a user