Commit d20f865e authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] Centralize i386 Constants

__FIXADDR_TOP and PAGE_OFFSET are hardcoded in various places.  I had to
change it to run the kernel under qemu-fast, so I wanted to centralize
them.

To do this, we rename vsyscall.lds to vsyscall.lds.s, and generate it from
vsyscall.lds.S.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (created)
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ad308764
...@@ -47,12 +47,14 @@ quiet_cmd_syscall = SYSCALL $@ ...@@ -47,12 +47,14 @@ quiet_cmd_syscall = SYSCALL $@
cmd_syscall = $(CC) -nostdlib $(SYSCFLAGS_$(@F)) \ cmd_syscall = $(CC) -nostdlib $(SYSCFLAGS_$(@F)) \
-Wl,-T,$(filter-out FORCE,$^) -o $@ -Wl,-T,$(filter-out FORCE,$^) -o $@
export AFLAGS_vsyscall.lds.o += -P -C -U$(ARCH)
vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1
SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags) SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags)
SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags) SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags)
$(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \ $(obj)/vsyscall-int80.so $(obj)/vsyscall-sysenter.so: \
$(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE $(obj)/vsyscall-%.so: $(src)/vsyscall.lds.s $(obj)/vsyscall-%.o FORCE
$(call if_changed,syscall) $(call if_changed,syscall)
# We also create a special relocatable object that should mirror the symbol # We also create a special relocatable object that should mirror the symbol
...@@ -63,5 +65,5 @@ $(obj)/built-in.o: $(obj)/vsyscall-syms.o ...@@ -63,5 +65,5 @@ $(obj)/built-in.o: $(obj)/vsyscall-syms.o
$(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o $(obj)/built-in.o: ld_flags += -R $(obj)/vsyscall-syms.o
SYSCFLAGS_vsyscall-syms.o = -r SYSCFLAGS_vsyscall-syms.o = -r
$(obj)/vsyscall-syms.o: $(src)/vsyscall.lds $(obj)/vsyscall-sysenter.o FORCE $(obj)/vsyscall-syms.o: $(src)/vsyscall.lds.s $(obj)/vsyscall-sysenter.o FORCE
$(call if_changed,syscall) $(call if_changed,syscall)
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <asm-generic/vmlinux.lds.h> #include <asm-generic/vmlinux.lds.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include <asm/page.h>
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386) OUTPUT_ARCH(i386)
...@@ -11,7 +12,7 @@ ENTRY(startup_32) ...@@ -11,7 +12,7 @@ ENTRY(startup_32)
jiffies = jiffies_64; jiffies = jiffies_64;
SECTIONS SECTIONS
{ {
. = 0xC0000000 + 0x100000; . = __PAGE_OFFSET + 0x100000;
/* read-only */ /* read-only */
_text = .; /* Text and read-only data */ _text = .; /* Text and read-only data */
.text : { .text : {
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* object prelinked to its virtual address, and with only one read-only * object prelinked to its virtual address, and with only one read-only
* segment (that fits in one page). This script controls its layout. * segment (that fits in one page). This script controls its layout.
*/ */
#include <asm/fixmap.h>
/* This must match <asm/fixmap.h>. */ VSYSCALL_BASE = __FIXADDR_TOP - 0x1000;
VSYSCALL_BASE = 0xffffe000;
SECTIONS SECTIONS
{ {
......
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
#define _ASM_FIXMAP_H #define _ASM_FIXMAP_H
#include <linux/config.h> #include <linux/config.h>
/* used by vmalloc.c, vsyscall.lds.S.
*
* Leave one empty page between vmalloc'ed areas and
* the start of the fixmap.
*/
#define __FIXADDR_TOP 0xfffff000
#ifndef __ASSEMBLY__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/acpi.h> #include <asm/acpi.h>
#include <asm/apicdef.h> #include <asm/apicdef.h>
...@@ -97,13 +106,8 @@ extern void __set_fixmap (enum fixed_addresses idx, ...@@ -97,13 +106,8 @@ extern void __set_fixmap (enum fixed_addresses idx,
#define clear_fixmap(idx) \ #define clear_fixmap(idx) \
__set_fixmap(idx, 0, __pgprot(0)) __set_fixmap(idx, 0, __pgprot(0))
/* #define FIXADDR_TOP ((unsigned long)__FIXADDR_TOP)
* used by vmalloc.c.
*
* Leave one empty page between vmalloc'ed areas and
* the start of the fixmap.
*/
#define FIXADDR_TOP (0xfffff000UL)
#define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) #define __FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) #define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)
...@@ -148,4 +152,5 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr) ...@@ -148,4 +152,5 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
return __virt_to_fix(vaddr); return __virt_to_fix(vaddr);
} }
#endif /* !__ASSEMBLY__ */
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment