Skip to content

Commit

Permalink
Merge branch 'x86/asm' into x86/urgent
Browse files Browse the repository at this point in the history
Merge reason: The linker script cleanups are ready for upstream.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Sep 25, 2009
2 parents b0c6fbe + 123f3e1 commit 704daf5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 76 deletions.
3 changes: 2 additions & 1 deletion arch/x86/boot/compressed/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
*/
.text

#include <linux/init.h>
#include <linux/linkage.h>
#include <asm/segment.h>
#include <asm/page_types.h>
#include <asm/boot.h>
#include <asm/asm-offsets.h>

.section ".text.head","ax",@progbits
__HEAD
ENTRY(startup_32)
cld
/*
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/boot/compressed/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.code32
.text

#include <linux/init.h>
#include <linux/linkage.h>
#include <asm/segment.h>
#include <asm/pgtable_types.h>
Expand All @@ -33,7 +34,7 @@
#include <asm/processor-flags.h>
#include <asm/asm-offsets.h>

.section ".text.head"
__HEAD
.code32
ENTRY(startup_32)
cld
Expand Down
6 changes: 4 additions & 2 deletions arch/x86/boot/compressed/vmlinux.lds.S
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <asm-generic/vmlinux.lds.h>

OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT)

#undef i386
Expand All @@ -18,9 +20,9 @@ SECTIONS
* address 0.
*/
. = 0;
.text.head : {
.head.text : {
_head = . ;
*(.text.head)
HEAD_TEXT
_ehead = . ;
}
.rodata.compressed : {
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ RESERVE_BRK(pagetables, INIT_MAP_SIZE)
* any particular GDT layout, because we load our own as soon as we
* can.
*/
.section .text.head,"ax",@progbits
__HEAD
ENTRY(startup_32)
/* test KEEP_SEGMENTS flag to see if the bootloader is asking
us to not reload segments */
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ L4_START_KERNEL = pgd_index(__START_KERNEL_map)
L3_START_KERNEL = pud_index(__START_KERNEL_map)

.text
.section .text.head
__HEAD
.code64
.globl startup_64
startup_64:
Expand Down
6 changes: 2 additions & 4 deletions arch/x86/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ char ignore_fpu_irq;

/*
* The IDT has to be page-aligned to simplify the Pentium
* F0 0F bug workaround.. We have a special link segment
* for this.
* F0 0F bug workaround.
*/
gate_desc idt_table[NR_VECTORS]
__attribute__((__section__(".data.idt"))) = { { { { 0, 0 } } }, };
gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };
#endif

DECLARE_BITMAP(used_vectors, NR_VECTORS);
Expand Down
79 changes: 13 additions & 66 deletions arch/x86/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,11 @@ SECTIONS
#endif

/* Text and read-only data */

/* bootstrapping code */
.text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
_text = .;
*(.text.head)
} :text = 0x9090

/* The rest of the text */
.text : AT(ADDR(.text) - LOAD_OFFSET) {
_text = .;
/* bootstrapping code */
HEAD_TEXT
#ifdef CONFIG_X86_32
/* not really needed, already page aligned */
. = ALIGN(PAGE_SIZE);
*(.text.page_aligned)
#endif
Expand All @@ -94,13 +88,7 @@ SECTIONS

NOTES :text :note

/* Exception table */
. = ALIGN(16);
__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
} :text = 0x9090
EXCEPTION_TABLE(16) :text = 0x9090

RO_DATA(PAGE_SIZE)

Expand All @@ -118,7 +106,6 @@ SECTIONS
#endif

PAGE_ALIGNED_DATA(PAGE_SIZE)
*(.data.idt)

CACHELINE_ALIGNED_DATA(CONFIG_X86_L1_CACHE_BYTES)

Expand All @@ -135,24 +122,21 @@ SECTIONS
#ifdef CONFIG_X86_64

#define VSYSCALL_ADDR (-10*1024*1024)
#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))

#define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
#define VLOAD_OFFSET (VSYSCALL_ADDR - __vsyscall_0 + LOAD_OFFSET)
#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)

#define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
#define VVIRT_OFFSET (VSYSCALL_ADDR - __vsyscall_0)
#define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)

. = ALIGN(4096);
__vsyscall_0 = .;

. = VSYSCALL_ADDR;
.vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) {
.vsyscall_0 : AT(VLOAD(.vsyscall_0)) {
*(.vsyscall_0)
} :user

__vsyscall_0 = VSYSCALL_VIRT_ADDR;

. = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
.vsyscall_fn : AT(VLOAD(.vsyscall_fn)) {
*(.vsyscall_fn)
Expand Down Expand Up @@ -192,11 +176,9 @@ SECTIONS
*(.vsyscall_3)
}

. = VSYSCALL_VIRT_ADDR + PAGE_SIZE;
. = __vsyscall_0 + PAGE_SIZE;

#undef VSYSCALL_ADDR
#undef VSYSCALL_PHYS_ADDR
#undef VSYSCALL_VIRT_ADDR
#undef VLOAD_OFFSET
#undef VLOAD
#undef VVIRT_OFFSET
Expand All @@ -219,45 +201,19 @@ SECTIONS
PERCPU_VADDR(0, :percpu)
#endif

.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
_sinittext = .;
INIT_TEXT
_einittext = .;
}
INIT_TEXT_SECTION(PAGE_SIZE)
#ifdef CONFIG_X86_64
:init
#endif

.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
INIT_DATA
}

. = ALIGN(16);
.init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
__setup_start = .;
*(.init.setup)
__setup_end = .;
}
.initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
__initcall_start = .;
INITCALLS
__initcall_end = .;
}

.con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
}
INIT_DATA_SECTION(16)

.x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) {
__x86_cpu_dev_start = .;
*(.x86_cpu_dev.init)
__x86_cpu_dev_end = .;
}

SECURITY_INIT

. = ALIGN(8);
.parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
__parainstructions = .;
Expand Down Expand Up @@ -288,15 +244,6 @@ SECTIONS
EXIT_DATA
}

#ifdef CONFIG_BLK_DEV_INITRD
. = ALIGN(PAGE_SIZE);
.init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
__initramfs_start = .;
*(.init.ramfs)
__initramfs_end = .;
}
#endif

#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
PERCPU(PAGE_SIZE)
#endif
Expand Down

0 comments on commit 704daf5

Please sign in to comment.