Commit a7dfa940 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Linus Torvalds

uml: use PAGE_SIZE in linker scripts

This patch includes page.h header into linker scripts that allow us to
use PAGE_SIZE macro instead of numeric constant.

To be able to include page.h into linker scripts page.h is needed for
some modification - i.e.  we need to use __ASSEMBLY__ and _AC macro

[jdike@linux.intel.com - fixed conflict with as-layout.h]
Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: default avatarJeff Dike <jdike@linux.intel.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6d074242
...@@ -23,16 +23,16 @@ ...@@ -23,16 +23,16 @@
*/ */
#ifdef __ASSEMBLY__ #ifdef __ASSEMBLY__
#define _AC(X, Y) (Y) #define _UML_AC(X, Y) (Y)
#else #else
#define __AC(X, Y) (X (Y)) #define __UML_AC(X, Y) (X(Y))
#define _AC(X, Y) __AC(X, Y) #define _UML_AC(X, Y) __UML_AC(X, Y)
#endif #endif
#define STUB_START _AC(, 0x100000) #define STUB_START _UML_AC(, 0x100000)
#define STUB_CODE _AC((unsigned long), STUB_START) #define STUB_CODE _UML_AC((unsigned long), STUB_START)
#define STUB_DATA _AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE) #define STUB_DATA _UML_AC((unsigned long), STUB_CODE + UM_KERN_PAGE_SIZE)
#define STUB_END _AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE) #define STUB_END _UML_AC((unsigned long), STUB_DATA + UM_KERN_PAGE_SIZE)
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
......
#include <asm-generic/vmlinux.lds.h> #include <asm-generic/vmlinux.lds.h>
#include <asm/page.h>
OUTPUT_FORMAT(ELF_FORMAT) OUTPUT_FORMAT(ELF_FORMAT)
OUTPUT_ARCH(ELF_ARCH) OUTPUT_ARCH(ELF_ARCH)
...@@ -21,7 +22,7 @@ SECTIONS ...@@ -21,7 +22,7 @@ SECTIONS
_einittext = .; _einittext = .;
} }
. = ALIGN(4096); . = ALIGN(PAGE_SIZE);
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */
.hash : { *(.hash) } .hash : { *(.hash) }
...@@ -68,9 +69,9 @@ SECTIONS ...@@ -68,9 +69,9 @@ SECTIONS
/* .gnu.warning sections are handled specially by elf32.em. */ /* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning) *(.gnu.warning)
. = ALIGN(4096); . = ALIGN(PAGE_SIZE);
} =0x90909090 } =0x90909090
. = ALIGN(4096); . = ALIGN(PAGE_SIZE);
.syscall_stub : { .syscall_stub : {
__syscall_stub_start = .; __syscall_stub_start = .;
*(.__syscall_stub*) *(.__syscall_stub*)
......
#include <asm-generic/vmlinux.lds.h> #include <asm-generic/vmlinux.lds.h>
#include <asm/page.h>
OUTPUT_FORMAT(ELF_FORMAT) OUTPUT_FORMAT(ELF_FORMAT)
OUTPUT_ARCH(ELF_ARCH) OUTPUT_ARCH(ELF_ARCH)
...@@ -26,7 +27,7 @@ SECTIONS ...@@ -26,7 +27,7 @@ SECTIONS
INIT_TEXT INIT_TEXT
_einittext = .; _einittext = .;
} }
. = ALIGN(4096); . = ALIGN(PAGE_SIZE);
.text : .text :
{ {
...@@ -39,7 +40,7 @@ SECTIONS ...@@ -39,7 +40,7 @@ SECTIONS
*(.gnu.linkonce.t*) *(.gnu.linkonce.t*)
} }
. = ALIGN(4096); . = ALIGN(PAGE_SIZE);
.syscall_stub : { .syscall_stub : {
__syscall_stub_start = .; __syscall_stub_start = .;
*(.__syscall_stub*) *(.__syscall_stub*)
...@@ -79,7 +80,7 @@ SECTIONS ...@@ -79,7 +80,7 @@ SECTIONS
.sdata : { *(.sdata) } .sdata : { *(.sdata) }
_edata = .; _edata = .;
PROVIDE (edata = .); PROVIDE (edata = .);
. = ALIGN(0x1000); . = ALIGN(PAGE_SIZE);
.sbss : .sbss :
{ {
__bss_start = .; __bss_start = .;
......
...@@ -7,16 +7,20 @@ ...@@ -7,16 +7,20 @@
#ifndef __UM_PAGE_H #ifndef __UM_PAGE_H
#define __UM_PAGE_H #define __UM_PAGE_H
struct page; #include <linux/const.h>
#include <linux/types.h>
#include <asm/vm-flags.h>
/* PAGE_SHIFT determines the page size */ /* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12 #define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT) #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_MASK (~(PAGE_SIZE-1))
#ifndef __ASSEMBLY__
struct page;
#include <linux/types.h>
#include <asm/vm-flags.h>
/* /*
* These are used to make use of C type-checking.. * These are used to make use of C type-checking..
*/ */
...@@ -120,4 +124,5 @@ extern struct page *arch_validate(struct page *page, gfp_t mask, int order); ...@@ -120,4 +124,5 @@ extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
#include <asm-generic/memory_model.h> #include <asm-generic/memory_model.h>
#include <asm-generic/page.h> #include <asm-generic/page.h>
#endif #endif /* __ASSEMBLY__ */
#endif /* __UM_PAGE_H */
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