mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge branch 'x86/asm' into tracing/syscalls
We need the wider TIF work-mask checks in entry_32.S. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -933,6 +933,12 @@ config X86_CPUID
|
||||
with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
|
||||
/dev/cpu/31/cpuid.
|
||||
|
||||
config X86_CPU_DEBUG
|
||||
tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support"
|
||||
---help---
|
||||
If you select this option, this will provide various x86 CPUs
|
||||
information through debugfs.
|
||||
|
||||
choice
|
||||
prompt "High Memory Support"
|
||||
default HIGHMEM4G if !X86_NUMAQ
|
||||
@@ -1433,7 +1439,7 @@ config CRASH_DUMP
|
||||
config KEXEC_JUMP
|
||||
bool "kexec jump (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
depends on KEXEC && HIBERNATION && X86_32
|
||||
depends on KEXEC && HIBERNATION
|
||||
---help---
|
||||
Jump between original kernel and kexeced kernel and invoke
|
||||
code in physical address mode via KEXEC
|
||||
|
||||
@@ -6,26 +6,23 @@
|
||||
# for more details.
|
||||
#
|
||||
# Copyright (C) 1994 by Linus Torvalds
|
||||
# Changed by many, many contributors over the years.
|
||||
#
|
||||
|
||||
# ROOT_DEV specifies the default root-device when making the image.
|
||||
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
|
||||
# the default of FLOPPY is used by 'build'.
|
||||
|
||||
ROOT_DEV := CURRENT
|
||||
ROOT_DEV := CURRENT
|
||||
|
||||
# If you want to preset the SVGA mode, uncomment the next line and
|
||||
# set SVGA_MODE to whatever number you want.
|
||||
# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
|
||||
# The number is the same as you would ordinarily press at bootup.
|
||||
|
||||
SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
|
||||
SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
|
||||
|
||||
# If you want the RAM disk device, define this to be the size in blocks.
|
||||
|
||||
#RAMDISK := -DRAMDISK=512
|
||||
|
||||
targets := vmlinux.bin setup.bin setup.elf zImage bzImage
|
||||
targets := vmlinux.bin setup.bin setup.elf bzImage
|
||||
subdir- := compressed
|
||||
|
||||
setup-y += a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o
|
||||
@@ -71,17 +68,13 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
|
||||
KBUILD_CFLAGS += $(call cc-option,-m32)
|
||||
KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
$(obj)/zImage: asflags-y := $(SVGA_MODE) $(RAMDISK)
|
||||
$(obj)/bzImage: ccflags-y := -D__BIG_KERNEL__
|
||||
$(obj)/bzImage: asflags-y := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
|
||||
$(obj)/bzImage: BUILDFLAGS := -b
|
||||
$(obj)/bzImage: asflags-y := $(SVGA_MODE)
|
||||
|
||||
quiet_cmd_image = BUILD $@
|
||||
cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \
|
||||
$(obj)/vmlinux.bin $(ROOT_DEV) > $@
|
||||
cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
|
||||
$(ROOT_DEV) > $@
|
||||
|
||||
$(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \
|
||||
$(obj)/vmlinux.bin $(obj)/tools/build FORCE
|
||||
$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
|
||||
$(call if_changed,image)
|
||||
@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
|
||||
|
||||
|
||||
@@ -24,12 +24,8 @@
|
||||
#include "boot.h"
|
||||
#include "offsets.h"
|
||||
|
||||
SETUPSECTS = 4 /* default nr of setup-sectors */
|
||||
BOOTSEG = 0x07C0 /* original address of boot-sector */
|
||||
SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
|
||||
SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
|
||||
/* to be loaded */
|
||||
ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
|
||||
SYSSEG = 0x1000 /* historical load address >> 4 */
|
||||
|
||||
#ifndef SVGA_MODE
|
||||
#define SVGA_MODE ASK_VGA
|
||||
@@ -97,12 +93,12 @@ bugger_off_msg:
|
||||
.section ".header", "a"
|
||||
.globl hdr
|
||||
hdr:
|
||||
setup_sects: .byte SETUPSECTS
|
||||
setup_sects: .byte 0 /* Filled in by build.c */
|
||||
root_flags: .word ROOT_RDONLY
|
||||
syssize: .long SYSSIZE
|
||||
ram_size: .word RAMDISK
|
||||
syssize: .long 0 /* Filled in by build.c */
|
||||
ram_size: .word 0 /* Obsolete */
|
||||
vid_mode: .word SVGA_MODE
|
||||
root_dev: .word ROOT_DEV
|
||||
root_dev: .word 0 /* Filled in by build.c */
|
||||
boot_flag: .word 0xAA55
|
||||
|
||||
# offset 512, entry point
|
||||
@@ -123,14 +119,15 @@ _start:
|
||||
# or else old loadlin-1.5 will fail)
|
||||
.globl realmode_swtch
|
||||
realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
|
||||
start_sys_seg: .word SYSSEG
|
||||
start_sys_seg: .word SYSSEG # obsolete and meaningless, but just
|
||||
# in case something decided to "use" it
|
||||
.word kernel_version-512 # pointing to kernel version string
|
||||
# above section of header is compatible
|
||||
# with loadlin-1.5 (header v1.5). Don't
|
||||
# change it.
|
||||
|
||||
type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin,
|
||||
# Bootlin, SYSLX, bootsect...)
|
||||
type_of_loader: .byte 0 # 0 means ancient bootloader, newer
|
||||
# bootloaders know to change this.
|
||||
# See Documentation/i386/boot.txt for
|
||||
# assigned ids
|
||||
|
||||
@@ -142,11 +139,7 @@ CAN_USE_HEAP = 0x80 # If set, the loader also has set
|
||||
# space behind setup.S can be used for
|
||||
# heap purposes.
|
||||
# Only the loader knows what is free
|
||||
#ifndef __BIG_KERNEL__
|
||||
.byte 0
|
||||
#else
|
||||
.byte LOADED_HIGH
|
||||
#endif
|
||||
|
||||
setup_move_size: .word 0x8000 # size to move, when setup is not
|
||||
# loaded at 0x90000. We will move setup
|
||||
@@ -157,11 +150,7 @@ setup_move_size: .word 0x8000 # size to move, when setup is not
|
||||
|
||||
code32_start: # here loaders can put a different
|
||||
# start address for 32-bit code.
|
||||
#ifndef __BIG_KERNEL__
|
||||
.long 0x1000 # 0x1000 = default for zImage
|
||||
#else
|
||||
.long 0x100000 # 0x100000 = default for big kernel
|
||||
#endif
|
||||
|
||||
ramdisk_image: .long 0 # address of loaded ramdisk image
|
||||
# Here the loader puts the 32-bit
|
||||
|
||||
@@ -32,47 +32,6 @@ static void realmode_switch_hook(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A zImage kernel is loaded at 0x10000 but wants to run at 0x1000.
|
||||
* A bzImage kernel is loaded and runs at 0x100000.
|
||||
*/
|
||||
static void move_kernel_around(void)
|
||||
{
|
||||
/* Note: rely on the compile-time option here rather than
|
||||
the LOADED_HIGH flag. The Qemu kernel loader unconditionally
|
||||
sets the loadflags to zero. */
|
||||
#ifndef __BIG_KERNEL__
|
||||
u16 dst_seg, src_seg;
|
||||
u32 syssize;
|
||||
|
||||
dst_seg = 0x1000 >> 4;
|
||||
src_seg = 0x10000 >> 4;
|
||||
syssize = boot_params.hdr.syssize; /* Size in 16-byte paragraphs */
|
||||
|
||||
while (syssize) {
|
||||
int paras = (syssize >= 0x1000) ? 0x1000 : syssize;
|
||||
int dwords = paras << 2;
|
||||
|
||||
asm volatile("pushw %%es ; "
|
||||
"pushw %%ds ; "
|
||||
"movw %1,%%es ; "
|
||||
"movw %2,%%ds ; "
|
||||
"xorw %%di,%%di ; "
|
||||
"xorw %%si,%%si ; "
|
||||
"rep;movsl ; "
|
||||
"popw %%ds ; "
|
||||
"popw %%es"
|
||||
: "+c" (dwords)
|
||||
: "r" (dst_seg), "r" (src_seg)
|
||||
: "esi", "edi");
|
||||
|
||||
syssize -= paras;
|
||||
dst_seg += paras;
|
||||
src_seg += paras;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable all interrupts at the legacy PIC.
|
||||
*/
|
||||
@@ -147,9 +106,6 @@ void go_to_protected_mode(void)
|
||||
/* Hook before leaving real mode, also disables interrupts */
|
||||
realmode_switch_hook();
|
||||
|
||||
/* Move the kernel/setup to their final resting places */
|
||||
move_kernel_around();
|
||||
|
||||
/* Enable the A20 gate */
|
||||
if (enable_a20()) {
|
||||
puts("A20 gate not responding, unable to boot...\n");
|
||||
|
||||
@@ -130,7 +130,7 @@ static void die(const char * str, ...)
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
die("Usage: build [-b] setup system [rootdev] [> image]");
|
||||
die("Usage: build setup system [rootdev] [> image]");
|
||||
}
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
@@ -145,11 +145,6 @@ int main(int argc, char ** argv)
|
||||
void *kernel;
|
||||
u32 crc = 0xffffffffUL;
|
||||
|
||||
if (argc > 2 && !strcmp(argv[1], "-b"))
|
||||
{
|
||||
is_big_kernel = 1;
|
||||
argc--, argv++;
|
||||
}
|
||||
if ((argc < 3) || (argc > 4))
|
||||
usage();
|
||||
if (argc > 3) {
|
||||
@@ -216,8 +211,6 @@ int main(int argc, char ** argv)
|
||||
die("Unable to mmap '%s': %m", argv[2]);
|
||||
/* Number of 16-byte paragraphs, including space for a 4-byte CRC */
|
||||
sys_size = (sz + 15 + 4) / 16;
|
||||
if (!is_big_kernel && sys_size > DEF_SYSSIZE)
|
||||
die("System is too big. Try using bzImage or modules.");
|
||||
|
||||
/* Patch the setup code with the appropriate size parameters */
|
||||
buf[0x1f1] = setup_sectors-1;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifndef _ASM_X86_BOOT_H
|
||||
#define _ASM_X86_BOOT_H
|
||||
|
||||
/* Don't touch these, unless you really know what you're doing. */
|
||||
#define DEF_SYSSEG 0x1000
|
||||
#define DEF_SYSSIZE 0x7F00
|
||||
|
||||
/* Internal svga startup constants */
|
||||
#define NORMAL_VGA 0xffff /* 80x25 mode */
|
||||
#define EXTENDED_VGA 0xfffe /* 80x50 mode */
|
||||
|
||||
193
arch/x86/include/asm/cpu_debug.h
Executable file
193
arch/x86/include/asm/cpu_debug.h
Executable file
@@ -0,0 +1,193 @@
|
||||
#ifndef _ASM_X86_CPU_DEBUG_H
|
||||
#define _ASM_X86_CPU_DEBUG_H
|
||||
|
||||
/*
|
||||
* CPU x86 architecture debug
|
||||
*
|
||||
* Copyright(C) 2009 Jaswinder Singh Rajput
|
||||
*/
|
||||
|
||||
/* Register flags */
|
||||
enum cpu_debug_bit {
|
||||
/* Model Specific Registers (MSRs) */
|
||||
CPU_MC_BIT, /* Machine Check */
|
||||
CPU_MONITOR_BIT, /* Monitor */
|
||||
CPU_TIME_BIT, /* Time */
|
||||
CPU_PMC_BIT, /* Performance Monitor */
|
||||
CPU_PLATFORM_BIT, /* Platform */
|
||||
CPU_APIC_BIT, /* APIC */
|
||||
CPU_POWERON_BIT, /* Power-on */
|
||||
CPU_CONTROL_BIT, /* Control */
|
||||
CPU_FEATURES_BIT, /* Features control */
|
||||
CPU_LBRANCH_BIT, /* Last Branch */
|
||||
CPU_BIOS_BIT, /* BIOS */
|
||||
CPU_FREQ_BIT, /* Frequency */
|
||||
CPU_MTTR_BIT, /* MTRR */
|
||||
CPU_PERF_BIT, /* Performance */
|
||||
CPU_CACHE_BIT, /* Cache */
|
||||
CPU_SYSENTER_BIT, /* Sysenter */
|
||||
CPU_THERM_BIT, /* Thermal */
|
||||
CPU_MISC_BIT, /* Miscellaneous */
|
||||
CPU_DEBUG_BIT, /* Debug */
|
||||
CPU_PAT_BIT, /* PAT */
|
||||
CPU_VMX_BIT, /* VMX */
|
||||
CPU_CALL_BIT, /* System Call */
|
||||
CPU_BASE_BIT, /* BASE Address */
|
||||
CPU_SMM_BIT, /* System mgmt mode */
|
||||
CPU_SVM_BIT, /*Secure Virtual Machine*/
|
||||
CPU_OSVM_BIT, /* OS-Visible Workaround*/
|
||||
/* Standard Registers */
|
||||
CPU_TSS_BIT, /* Task Stack Segment */
|
||||
CPU_CR_BIT, /* Control Registers */
|
||||
CPU_DT_BIT, /* Descriptor Table */
|
||||
/* End of Registers flags */
|
||||
CPU_REG_ALL_BIT, /* Select all Registers */
|
||||
};
|
||||
|
||||
#define CPU_REG_ALL (~0) /* Select all Registers */
|
||||
|
||||
#define CPU_MC (1 << CPU_MC_BIT)
|
||||
#define CPU_MONITOR (1 << CPU_MONITOR_BIT)
|
||||
#define CPU_TIME (1 << CPU_TIME_BIT)
|
||||
#define CPU_PMC (1 << CPU_PMC_BIT)
|
||||
#define CPU_PLATFORM (1 << CPU_PLATFORM_BIT)
|
||||
#define CPU_APIC (1 << CPU_APIC_BIT)
|
||||
#define CPU_POWERON (1 << CPU_POWERON_BIT)
|
||||
#define CPU_CONTROL (1 << CPU_CONTROL_BIT)
|
||||
#define CPU_FEATURES (1 << CPU_FEATURES_BIT)
|
||||
#define CPU_LBRANCH (1 << CPU_LBRANCH_BIT)
|
||||
#define CPU_BIOS (1 << CPU_BIOS_BIT)
|
||||
#define CPU_FREQ (1 << CPU_FREQ_BIT)
|
||||
#define CPU_MTRR (1 << CPU_MTTR_BIT)
|
||||
#define CPU_PERF (1 << CPU_PERF_BIT)
|
||||
#define CPU_CACHE (1 << CPU_CACHE_BIT)
|
||||
#define CPU_SYSENTER (1 << CPU_SYSENTER_BIT)
|
||||
#define CPU_THERM (1 << CPU_THERM_BIT)
|
||||
#define CPU_MISC (1 << CPU_MISC_BIT)
|
||||
#define CPU_DEBUG (1 << CPU_DEBUG_BIT)
|
||||
#define CPU_PAT (1 << CPU_PAT_BIT)
|
||||
#define CPU_VMX (1 << CPU_VMX_BIT)
|
||||
#define CPU_CALL (1 << CPU_CALL_BIT)
|
||||
#define CPU_BASE (1 << CPU_BASE_BIT)
|
||||
#define CPU_SMM (1 << CPU_SMM_BIT)
|
||||
#define CPU_SVM (1 << CPU_SVM_BIT)
|
||||
#define CPU_OSVM (1 << CPU_OSVM_BIT)
|
||||
#define CPU_TSS (1 << CPU_TSS_BIT)
|
||||
#define CPU_CR (1 << CPU_CR_BIT)
|
||||
#define CPU_DT (1 << CPU_DT_BIT)
|
||||
|
||||
/* Register file flags */
|
||||
enum cpu_file_bit {
|
||||
CPU_INDEX_BIT, /* index */
|
||||
CPU_VALUE_BIT, /* value */
|
||||
};
|
||||
|
||||
#define CPU_FILE_VALUE (1 << CPU_VALUE_BIT)
|
||||
|
||||
/*
|
||||
* DisplayFamily_DisplayModel Processor Families/Processor Number Series
|
||||
* -------------------------- ------------------------------------------
|
||||
* 05_01, 05_02, 05_04 Pentium, Pentium with MMX
|
||||
*
|
||||
* 06_01 Pentium Pro
|
||||
* 06_03, 06_05 Pentium II Xeon, Pentium II
|
||||
* 06_07, 06_08, 06_0A, 06_0B Pentium III Xeon, Pentum III
|
||||
*
|
||||
* 06_09, 060D Pentium M
|
||||
*
|
||||
* 06_0E Core Duo, Core Solo
|
||||
*
|
||||
* 06_0F Xeon 3000, 3200, 5100, 5300, 7300 series,
|
||||
* Core 2 Quad, Core 2 Extreme, Core 2 Duo,
|
||||
* Pentium dual-core
|
||||
* 06_17 Xeon 5200, 5400 series, Core 2 Quad Q9650
|
||||
*
|
||||
* 06_1C Atom
|
||||
*
|
||||
* 0F_00, 0F_01, 0F_02 Xeon, Xeon MP, Pentium 4
|
||||
* 0F_03, 0F_04 Xeon, Xeon MP, Pentium 4, Pentium D
|
||||
*
|
||||
* 0F_06 Xeon 7100, 5000 Series, Xeon MP,
|
||||
* Pentium 4, Pentium D
|
||||
*/
|
||||
|
||||
/* Register processors bits */
|
||||
enum cpu_processor_bit {
|
||||
CPU_NONE,
|
||||
/* Intel */
|
||||
CPU_INTEL_PENTIUM_BIT,
|
||||
CPU_INTEL_P6_BIT,
|
||||
CPU_INTEL_PENTIUM_M_BIT,
|
||||
CPU_INTEL_CORE_BIT,
|
||||
CPU_INTEL_CORE2_BIT,
|
||||
CPU_INTEL_ATOM_BIT,
|
||||
CPU_INTEL_XEON_P4_BIT,
|
||||
CPU_INTEL_XEON_MP_BIT,
|
||||
};
|
||||
|
||||
#define CPU_ALL (~0) /* Select all CPUs */
|
||||
|
||||
#define CPU_INTEL_PENTIUM (1 << CPU_INTEL_PENTIUM_BIT)
|
||||
#define CPU_INTEL_P6 (1 << CPU_INTEL_P6_BIT)
|
||||
#define CPU_INTEL_PENTIUM_M (1 << CPU_INTEL_PENTIUM_M_BIT)
|
||||
#define CPU_INTEL_CORE (1 << CPU_INTEL_CORE_BIT)
|
||||
#define CPU_INTEL_CORE2 (1 << CPU_INTEL_CORE2_BIT)
|
||||
#define CPU_INTEL_ATOM (1 << CPU_INTEL_ATOM_BIT)
|
||||
#define CPU_INTEL_XEON_P4 (1 << CPU_INTEL_XEON_P4_BIT)
|
||||
#define CPU_INTEL_XEON_MP (1 << CPU_INTEL_XEON_MP_BIT)
|
||||
|
||||
#define CPU_INTEL_PX (CPU_INTEL_P6 | CPU_INTEL_PENTIUM_M)
|
||||
#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2)
|
||||
#define CPU_INTEL_XEON (CPU_INTEL_XEON_P4 | CPU_INTEL_XEON_MP)
|
||||
#define CPU_CO_AT (CPU_INTEL_CORE | CPU_INTEL_ATOM)
|
||||
#define CPU_C2_AT (CPU_INTEL_CORE2 | CPU_INTEL_ATOM)
|
||||
#define CPU_CX_AT (CPU_INTEL_COREX | CPU_INTEL_ATOM)
|
||||
#define CPU_CX_XE (CPU_INTEL_COREX | CPU_INTEL_XEON)
|
||||
#define CPU_P6_XE (CPU_INTEL_P6 | CPU_INTEL_XEON)
|
||||
#define CPU_PM_CO_AT (CPU_INTEL_PENTIUM_M | CPU_CO_AT)
|
||||
#define CPU_C2_AT_XE (CPU_C2_AT | CPU_INTEL_XEON)
|
||||
#define CPU_CX_AT_XE (CPU_CX_AT | CPU_INTEL_XEON)
|
||||
#define CPU_P6_CX_AT (CPU_INTEL_P6 | CPU_CX_AT)
|
||||
#define CPU_P6_CX_XE (CPU_P6_XE | CPU_INTEL_COREX)
|
||||
#define CPU_P6_CX_AT_XE (CPU_INTEL_P6 | CPU_CX_AT_XE)
|
||||
#define CPU_PM_CX_AT_XE (CPU_INTEL_PENTIUM_M | CPU_CX_AT_XE)
|
||||
#define CPU_PM_CX_AT (CPU_INTEL_PENTIUM_M | CPU_CX_AT)
|
||||
#define CPU_PM_CX_XE (CPU_INTEL_PENTIUM_M | CPU_CX_XE)
|
||||
#define CPU_PX_CX_AT (CPU_INTEL_PX | CPU_CX_AT)
|
||||
#define CPU_PX_CX_AT_XE (CPU_INTEL_PX | CPU_CX_AT_XE)
|
||||
|
||||
/* Select all Intel CPUs*/
|
||||
#define CPU_INTEL_ALL (CPU_INTEL_PENTIUM | CPU_PX_CX_AT_XE)
|
||||
|
||||
#define MAX_CPU_FILES 512
|
||||
|
||||
struct cpu_private {
|
||||
unsigned cpu;
|
||||
unsigned type;
|
||||
unsigned reg;
|
||||
unsigned file;
|
||||
};
|
||||
|
||||
struct cpu_debug_base {
|
||||
char *name; /* Register name */
|
||||
unsigned flag; /* Register flag */
|
||||
};
|
||||
|
||||
struct cpu_cpuX_base {
|
||||
struct dentry *dentry; /* Register dentry */
|
||||
int init; /* Register index file */
|
||||
};
|
||||
|
||||
struct cpu_file_base {
|
||||
char *name; /* Register file name */
|
||||
unsigned flag; /* Register file flag */
|
||||
};
|
||||
|
||||
struct cpu_debug_range {
|
||||
unsigned min; /* Register range min */
|
||||
unsigned max; /* Register range max */
|
||||
unsigned flag; /* Supported flags */
|
||||
unsigned model; /* Supported models */
|
||||
};
|
||||
|
||||
#endif /* _ASM_X86_CPU_DEBUG_H */
|
||||
@@ -91,7 +91,6 @@ static inline int desc_empty(const void *ptr)
|
||||
#define store_gdt(dtr) native_store_gdt(dtr)
|
||||
#define store_idt(dtr) native_store_idt(dtr)
|
||||
#define store_tr(tr) (tr = native_store_tr())
|
||||
#define store_ldt(ldt) asm("sldt %0":"=m" (ldt))
|
||||
|
||||
#define load_TLS(t, cpu) native_load_tls(t, cpu)
|
||||
#define set_ldt native_set_ldt
|
||||
@@ -112,6 +111,8 @@ static inline void paravirt_free_ldt(struct desc_struct *ldt, unsigned entries)
|
||||
}
|
||||
#endif /* CONFIG_PARAVIRT */
|
||||
|
||||
#define store_ldt(ldt) asm("sldt %0" : "=m"(ldt))
|
||||
|
||||
static inline void native_write_idt_entry(gate_desc *idt, int entry,
|
||||
const gate_desc *gate)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,7 @@ void *kmap_atomic_prot(struct page *page, enum km_type type, pgprot_t prot);
|
||||
void *kmap_atomic(struct page *page, enum km_type type);
|
||||
void kunmap_atomic(void *kvaddr, enum km_type type);
|
||||
void *kmap_atomic_pfn(unsigned long pfn, enum km_type type);
|
||||
void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot);
|
||||
struct page *kmap_atomic_to_page(void *ptr);
|
||||
|
||||
#ifndef CONFIG_PARAVIRT
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
# define PAGES_NR 4
|
||||
#else
|
||||
# define PA_CONTROL_PAGE 0
|
||||
# define PA_TABLE_PAGE 1
|
||||
# define PAGES_NR 2
|
||||
# define VA_CONTROL_PAGE 1
|
||||
# define PA_TABLE_PAGE 2
|
||||
# define PA_SWAP_PAGE 3
|
||||
# define PAGES_NR 4
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
# define KEXEC_CONTROL_CODE_MAX_SIZE 2048
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
@@ -136,10 +136,11 @@ relocate_kernel(unsigned long indirection_page,
|
||||
unsigned int has_pae,
|
||||
unsigned int preserve_context);
|
||||
#else
|
||||
NORET_TYPE void
|
||||
unsigned long
|
||||
relocate_kernel(unsigned long indirection_page,
|
||||
unsigned long page_list,
|
||||
unsigned long start_address) ATTRIB_NORET;
|
||||
unsigned long start_address,
|
||||
unsigned int preserve_context);
|
||||
#endif
|
||||
|
||||
#define ARCH_HAS_KIMAGE_ARCH
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _ASM_X86_LINKAGE_H
|
||||
#define _ASM_X86_LINKAGE_H
|
||||
|
||||
#include <linux/stringify.h>
|
||||
|
||||
#undef notrace
|
||||
#define notrace __attribute__((no_instrument_function))
|
||||
|
||||
@@ -53,14 +55,9 @@
|
||||
.globl name; \
|
||||
name:
|
||||
|
||||
#ifdef CONFIG_X86_64
|
||||
#define __ALIGN .p2align 4,,15
|
||||
#define __ALIGN_STR ".p2align 4,,15"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_ALIGNMENT_16
|
||||
#define __ALIGN .align 16,0x90
|
||||
#define __ALIGN_STR ".align 16,0x90"
|
||||
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
|
||||
#define __ALIGN .p2align 4, 0x90
|
||||
#define __ALIGN_STR __stringify(__ALIGN)
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
@@ -14,6 +14,8 @@ obj-y += vmware.o hypervisor.o
|
||||
obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
|
||||
obj-$(CONFIG_X86_64) += bugs_64.o
|
||||
|
||||
obj-$(CONFIG_X86_CPU_DEBUG) += cpu_debug.o
|
||||
|
||||
obj-$(CONFIG_CPU_SUP_INTEL) += intel.o
|
||||
obj-$(CONFIG_CPU_SUP_AMD) += amd.o
|
||||
obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix.o
|
||||
|
||||
@@ -1078,8 +1078,7 @@ void __cpuinit cpu_init(void)
|
||||
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
me->active_mm = &init_mm;
|
||||
if (me->mm)
|
||||
BUG();
|
||||
BUG_ON(me->mm);
|
||||
enter_lazy_tlb(&init_mm, me);
|
||||
|
||||
load_sp0(t, ¤t->thread);
|
||||
@@ -1145,8 +1144,7 @@ void __cpuinit cpu_init(void)
|
||||
*/
|
||||
atomic_inc(&init_mm.mm_count);
|
||||
curr->active_mm = &init_mm;
|
||||
if (curr->mm)
|
||||
BUG();
|
||||
BUG_ON(curr->mm);
|
||||
enter_lazy_tlb(&init_mm, curr);
|
||||
|
||||
load_sp0(t, thread);
|
||||
|
||||
785
arch/x86/kernel/cpu/cpu_debug.c
Executable file
785
arch/x86/kernel/cpu/cpu_debug.c
Executable file
File diff suppressed because it is too large
Load Diff
@@ -639,7 +639,7 @@ static void mce_init_timer(void)
|
||||
if (!next_interval)
|
||||
return;
|
||||
setup_timer(t, mcheck_timer, smp_processor_id());
|
||||
t->expires = round_jiffies_relative(jiffies + next_interval);
|
||||
t->expires = round_jiffies(jiffies + next_interval);
|
||||
add_timer(t);
|
||||
}
|
||||
|
||||
@@ -1110,7 +1110,7 @@ static int __cpuinit mce_cpu_callback(struct notifier_block *nfb,
|
||||
break;
|
||||
case CPU_DOWN_FAILED:
|
||||
case CPU_DOWN_FAILED_FROZEN:
|
||||
t->expires = round_jiffies_relative(jiffies + next_interval);
|
||||
t->expires = round_jiffies(jiffies + next_interval);
|
||||
add_timer_on(t, cpu);
|
||||
smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
|
||||
break;
|
||||
|
||||
@@ -442,8 +442,7 @@ sysenter_past_esp:
|
||||
|
||||
GET_THREAD_INFO(%ebp)
|
||||
|
||||
/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
|
||||
testw $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
|
||||
jnz sysenter_audit
|
||||
sysenter_do_call:
|
||||
cmpl $(nr_syscalls), %eax
|
||||
@@ -454,7 +453,7 @@ sysenter_do_call:
|
||||
DISABLE_INTERRUPTS(CLBR_ANY)
|
||||
TRACE_IRQS_OFF
|
||||
movl TI_flags(%ebp), %ecx
|
||||
testw $_TIF_ALLWORK_MASK, %cx
|
||||
testl $_TIF_ALLWORK_MASK, %ecx
|
||||
jne sysexit_audit
|
||||
sysenter_exit:
|
||||
/* if something modifies registers it must also disable sysexit */
|
||||
@@ -468,7 +467,7 @@ sysenter_exit:
|
||||
|
||||
#ifdef CONFIG_AUDITSYSCALL
|
||||
sysenter_audit:
|
||||
testw $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
|
||||
testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
|
||||
jnz syscall_trace_entry
|
||||
addl $4,%esp
|
||||
CFI_ADJUST_CFA_OFFSET -4
|
||||
@@ -485,7 +484,7 @@ sysenter_audit:
|
||||
jmp sysenter_do_call
|
||||
|
||||
sysexit_audit:
|
||||
testw $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %cx
|
||||
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx
|
||||
jne syscall_exit_work
|
||||
TRACE_IRQS_ON
|
||||
ENABLE_INTERRUPTS(CLBR_ANY)
|
||||
@@ -498,7 +497,7 @@ sysexit_audit:
|
||||
DISABLE_INTERRUPTS(CLBR_ANY)
|
||||
TRACE_IRQS_OFF
|
||||
movl TI_flags(%ebp), %ecx
|
||||
testw $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %cx
|
||||
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %ecx
|
||||
jne syscall_exit_work
|
||||
movl PT_EAX(%esp),%eax /* reload syscall return value */
|
||||
jmp sysenter_exit
|
||||
@@ -523,8 +522,7 @@ ENTRY(system_call)
|
||||
SAVE_ALL
|
||||
GET_THREAD_INFO(%ebp)
|
||||
# system call tracing in operation / emulation
|
||||
/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
|
||||
testw $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
|
||||
jnz syscall_trace_entry
|
||||
cmpl $(nr_syscalls), %eax
|
||||
jae syscall_badsys
|
||||
@@ -538,7 +536,7 @@ syscall_exit:
|
||||
# between sampling and the iret
|
||||
TRACE_IRQS_OFF
|
||||
movl TI_flags(%ebp), %ecx
|
||||
testw $_TIF_ALLWORK_MASK, %cx # current->work
|
||||
testl $_TIF_ALLWORK_MASK, %ecx # current->work
|
||||
jne syscall_exit_work
|
||||
|
||||
restore_all:
|
||||
@@ -673,7 +671,7 @@ END(syscall_trace_entry)
|
||||
# perform syscall exit tracing
|
||||
ALIGN
|
||||
syscall_exit_work:
|
||||
testb $_TIF_WORK_SYSCALL_EXIT, %cl
|
||||
testl $_TIF_WORK_SYSCALL_EXIT, %ecx
|
||||
jz work_pending
|
||||
TRACE_IRQS_ON
|
||||
ENABLE_INTERRUPTS(CLBR_ANY) # could let syscall_trace_leave() call
|
||||
|
||||
@@ -368,6 +368,7 @@ ENTRY(save_rest)
|
||||
END(save_rest)
|
||||
|
||||
/* save complete stack frame */
|
||||
.pushsection .kprobes.text, "ax"
|
||||
ENTRY(save_paranoid)
|
||||
XCPT_FRAME 1 RDI+8
|
||||
cld
|
||||
@@ -396,6 +397,7 @@ ENTRY(save_paranoid)
|
||||
1: ret
|
||||
CFI_ENDPROC
|
||||
END(save_paranoid)
|
||||
.popsection
|
||||
|
||||
/*
|
||||
* A newly forked process directly context switches into this address.
|
||||
@@ -416,7 +418,6 @@ ENTRY(ret_from_fork)
|
||||
|
||||
GET_THREAD_INFO(%rcx)
|
||||
|
||||
CFI_REMEMBER_STATE
|
||||
RESTORE_REST
|
||||
|
||||
testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread?
|
||||
@@ -428,7 +429,6 @@ ENTRY(ret_from_fork)
|
||||
RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET
|
||||
jmp ret_from_sys_call # go to the SYSRET fastpath
|
||||
|
||||
CFI_RESTORE_STATE
|
||||
CFI_ENDPROC
|
||||
END(ret_from_fork)
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/tlbflush.h>
|
||||
#include <asm/mmu_context.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/apic.h>
|
||||
#include <asm/cpufeature.h>
|
||||
#include <asm/desc.h>
|
||||
@@ -63,7 +63,7 @@ static void load_segments(void)
|
||||
"\tmovl %%eax,%%fs\n"
|
||||
"\tmovl %%eax,%%gs\n"
|
||||
"\tmovl %%eax,%%ss\n"
|
||||
::: "eax", "memory");
|
||||
: : : "eax", "memory");
|
||||
#undef STR
|
||||
#undef __STR
|
||||
}
|
||||
@@ -205,7 +205,8 @@ void machine_kexec(struct kimage *image)
|
||||
|
||||
if (image->preserve_context) {
|
||||
#ifdef CONFIG_X86_IO_APIC
|
||||
/* We need to put APICs in legacy mode so that we can
|
||||
/*
|
||||
* We need to put APICs in legacy mode so that we can
|
||||
* get timer interrupts in second kernel. kexec/kdump
|
||||
* paths already have calls to disable_IO_APIC() in
|
||||
* one form or other. kexec jump path also need
|
||||
@@ -227,7 +228,8 @@ void machine_kexec(struct kimage *image)
|
||||
page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
|
||||
<< PAGE_SHIFT);
|
||||
|
||||
/* The segment registers are funny things, they have both a
|
||||
/*
|
||||
* The segment registers are funny things, they have both a
|
||||
* visible and an invisible part. Whenever the visible part is
|
||||
* set to a specific selector, the invisible part is loaded
|
||||
* with from a table in memory. At no other time is the
|
||||
@@ -237,11 +239,12 @@ void machine_kexec(struct kimage *image)
|
||||
* segments, before I zap the gdt with an invalid value.
|
||||
*/
|
||||
load_segments();
|
||||
/* The gdt & idt are now invalid.
|
||||
/*
|
||||
* The gdt & idt are now invalid.
|
||||
* If you want to load them you must set up your own idt & gdt.
|
||||
*/
|
||||
set_gdt(phys_to_virt(0),0);
|
||||
set_idt(phys_to_virt(0),0);
|
||||
set_gdt(phys_to_virt(0), 0);
|
||||
set_idt(phys_to_virt(0), 0);
|
||||
|
||||
/* now call it */
|
||||
image->start = relocate_kernel_ptr((unsigned long)image->head,
|
||||
|
||||
@@ -12,11 +12,47 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/numa.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/suspend.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/tlbflush.h>
|
||||
#include <asm/mmu_context.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
static int init_one_level2_page(struct kimage *image, pgd_t *pgd,
|
||||
unsigned long addr)
|
||||
{
|
||||
pud_t *pud;
|
||||
pmd_t *pmd;
|
||||
struct page *page;
|
||||
int result = -ENOMEM;
|
||||
|
||||
addr &= PMD_MASK;
|
||||
pgd += pgd_index(addr);
|
||||
if (!pgd_present(*pgd)) {
|
||||
page = kimage_alloc_control_pages(image, 0);
|
||||
if (!page)
|
||||
goto out;
|
||||
pud = (pud_t *)page_address(page);
|
||||
memset(pud, 0, PAGE_SIZE);
|
||||
set_pgd(pgd, __pgd(__pa(pud) | _KERNPG_TABLE));
|
||||
}
|
||||
pud = pud_offset(pgd, addr);
|
||||
if (!pud_present(*pud)) {
|
||||
page = kimage_alloc_control_pages(image, 0);
|
||||
if (!page)
|
||||
goto out;
|
||||
pmd = (pmd_t *)page_address(page);
|
||||
memset(pmd, 0, PAGE_SIZE);
|
||||
set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE));
|
||||
}
|
||||
pmd = pmd_offset(pud, addr);
|
||||
if (!pmd_present(*pmd))
|
||||
set_pmd(pmd, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC));
|
||||
result = 0;
|
||||
out:
|
||||
return result;
|
||||
}
|
||||
|
||||
static void init_level2_page(pmd_t *level2p, unsigned long addr)
|
||||
{
|
||||
@@ -83,9 +119,8 @@ static int init_level4_page(struct kimage *image, pgd_t *level4p,
|
||||
}
|
||||
level3p = (pud_t *)page_address(page);
|
||||
result = init_level3_page(image, level3p, addr, last_addr);
|
||||
if (result) {
|
||||
if (result)
|
||||
goto out;
|
||||
}
|
||||
set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE));
|
||||
addr += PGDIR_SIZE;
|
||||
}
|
||||
@@ -154,6 +189,13 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable)
|
||||
int result;
|
||||
level4p = (pgd_t *)__va(start_pgtable);
|
||||
result = init_level4_page(image, level4p, 0, max_pfn << PAGE_SHIFT);
|
||||
if (result)
|
||||
return result;
|
||||
/*
|
||||
* image->start may be outside 0 ~ max_pfn, for example when
|
||||
* jump back to original kernel from kexeced kernel
|
||||
*/
|
||||
result = init_one_level2_page(image, level4p, image->start);
|
||||
if (result)
|
||||
return result;
|
||||
return init_transition_pgtable(image, level4p);
|
||||
@@ -229,20 +271,45 @@ void machine_kexec(struct kimage *image)
|
||||
{
|
||||
unsigned long page_list[PAGES_NR];
|
||||
void *control_page;
|
||||
int save_ftrace_enabled;
|
||||
|
||||
tracer_disable();
|
||||
#ifdef CONFIG_KEXEC_JUMP
|
||||
if (kexec_image->preserve_context)
|
||||
save_processor_state();
|
||||
#endif
|
||||
|
||||
save_ftrace_enabled = __ftrace_enabled_save();
|
||||
|
||||
/* Interrupts aren't acceptable while we reboot */
|
||||
local_irq_disable();
|
||||
|
||||
if (image->preserve_context) {
|
||||
#ifdef CONFIG_X86_IO_APIC
|
||||
/*
|
||||
* We need to put APICs in legacy mode so that we can
|
||||
* get timer interrupts in second kernel. kexec/kdump
|
||||
* paths already have calls to disable_IO_APIC() in
|
||||
* one form or other. kexec jump path also need
|
||||
* one.
|
||||
*/
|
||||
disable_IO_APIC();
|
||||
#endif
|
||||
}
|
||||
|
||||
control_page = page_address(image->control_code_page) + PAGE_SIZE;
|
||||
memcpy(control_page, relocate_kernel, PAGE_SIZE);
|
||||
memcpy(control_page, relocate_kernel, KEXEC_CONTROL_CODE_MAX_SIZE);
|
||||
|
||||
page_list[PA_CONTROL_PAGE] = virt_to_phys(control_page);
|
||||
page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
|
||||
page_list[PA_TABLE_PAGE] =
|
||||
(unsigned long)__pa(page_address(image->control_code_page));
|
||||
|
||||
/* The segment registers are funny things, they have both a
|
||||
if (image->type == KEXEC_TYPE_DEFAULT)
|
||||
page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page)
|
||||
<< PAGE_SHIFT);
|
||||
|
||||
/*
|
||||
* The segment registers are funny things, they have both a
|
||||
* visible and an invisible part. Whenever the visible part is
|
||||
* set to a specific selector, the invisible part is loaded
|
||||
* with from a table in memory. At no other time is the
|
||||
@@ -252,15 +319,25 @@ void machine_kexec(struct kimage *image)
|
||||
* segments, before I zap the gdt with an invalid value.
|
||||
*/
|
||||
load_segments();
|
||||
/* The gdt & idt are now invalid.
|
||||
/*
|
||||
* The gdt & idt are now invalid.
|
||||
* If you want to load them you must set up your own idt & gdt.
|
||||
*/
|
||||
set_gdt(phys_to_virt(0),0);
|
||||
set_idt(phys_to_virt(0),0);
|
||||
set_gdt(phys_to_virt(0), 0);
|
||||
set_idt(phys_to_virt(0), 0);
|
||||
|
||||
/* now call it */
|
||||
relocate_kernel((unsigned long)image->head, (unsigned long)page_list,
|
||||
image->start);
|
||||
image->start = relocate_kernel((unsigned long)image->head,
|
||||
(unsigned long)page_list,
|
||||
image->start,
|
||||
image->preserve_context);
|
||||
|
||||
#ifdef CONFIG_KEXEC_JUMP
|
||||
if (kexec_image->preserve_context)
|
||||
restore_processor_state();
|
||||
#endif
|
||||
|
||||
__ftrace_enabled_restore(save_ftrace_enabled);
|
||||
}
|
||||
|
||||
void arch_crash_save_vmcoreinfo(void)
|
||||
|
||||
@@ -74,8 +74,7 @@ static void ich_force_hpet_resume(void)
|
||||
if (!force_hpet_address)
|
||||
return;
|
||||
|
||||
if (rcba_base == NULL)
|
||||
BUG();
|
||||
BUG_ON(rcba_base == NULL);
|
||||
|
||||
/* read the Function Disable register, dword mode only */
|
||||
val = readl(rcba_base + 0x3404);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user