aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/include/as-layout.h15
-rw-r--r--arch/um/include/common-offsets.h3
-rw-r--r--arch/um/include/mem_user.h4
-rw-r--r--arch/um/kernel/exec.c2
-rw-r--r--arch/um/kernel/ksyms.c3
-rw-r--r--arch/um/kernel/physmem.c10
-rw-r--r--arch/um/kernel/tlb.c2
-rw-r--r--arch/um/kernel/um_arch.c22
-rw-r--r--include/asm-um/a.out.h4
-rw-r--r--include/asm-um/fixmap.h3
-rw-r--r--include/asm-um/processor-generic.h4
11 files changed, 23 insertions, 49 deletions
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h
index 2b859e020ac6..a2008f550fee 100644
--- a/arch/um/include/as-layout.h
+++ b/arch/um/include/as-layout.h
@@ -29,9 +29,20 @@
29#define _AC(X, Y) __AC(X, Y) 29#define _AC(X, Y) __AC(X, Y)
30#endif 30#endif
31 31
32/*
33 * The "- 1"'s are to avoid gcc complaining about integer overflows
34 * and unrepresentable decimal constants. With 3-level page tables,
35 * TASK_SIZE is 0x80000000, which gets turned into its signed decimal
36 * equivalent in asm-offsets.s. gcc then complains about that being
37 * unsigned only in C90. To avoid that, UM_TASK_SIZE is defined as
38 * TASK_SIZE - 1. To compensate, we need to add the 1 back here.
39 * However, adding it back to UM_TASK_SIZE produces more gcc
40 * complaints. So, I adjust the thing being subtracted from
41 * UM_TASK_SIZE instead. Bah.
42 */
32#define STUB_CODE _AC((unsigned long), \ 43#define STUB_CODE _AC((unsigned long), \
33 UML_CONFIG_TOP_ADDR - 2 * UM_KERN_PAGE_SIZE) 44 UM_TASK_SIZE - (2 * UM_KERN_PAGE_SIZE - 1))
34#define STUB_DATA _AC((unsigned long), UML_CONFIG_TOP_ADDR - UM_KERN_PAGE_SIZE) 45#define STUB_DATA _AC((unsigned long), UM_TASK_SIZE - (UM_KERN_PAGE_SIZE - 1))
35#define STUB_START _AC(, STUB_CODE) 46#define STUB_START _AC(, STUB_CODE)
36 47
37#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index b54bd35585c2..5b67d7ced2a7 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -39,3 +39,6 @@ DEFINE(UM_HZ, HZ);
39DEFINE(UM_USEC_PER_SEC, USEC_PER_SEC); 39DEFINE(UM_USEC_PER_SEC, USEC_PER_SEC);
40DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC); 40DEFINE(UM_NSEC_PER_SEC, NSEC_PER_SEC);
41DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC); 41DEFINE(UM_NSEC_PER_USEC, NSEC_PER_USEC);
42
43/* See as-layout.h for an explanation of the "- 1". Bah. */
44DEFINE(UM_TASK_SIZE, TASK_SIZE - 1);
diff --git a/arch/um/include/mem_user.h b/arch/um/include/mem_user.h
index a54514d2cc3a..4e6707bd0a08 100644
--- a/arch/um/include/mem_user.h
+++ b/arch/um/include/mem_user.h
@@ -46,9 +46,6 @@ extern int iomem_size;
46 46
47#define ROUND_4M(n) ((((unsigned long) (n)) + (1 << 22)) & ~((1 << 22) - 1)) 47#define ROUND_4M(n) ((((unsigned long) (n)) + (1 << 22)) & ~((1 << 22) - 1))
48 48
49extern unsigned long host_task_size;
50extern unsigned long task_size;
51
52extern int init_mem_user(void); 49extern int init_mem_user(void);
53extern void setup_memory(void *entry); 50extern void setup_memory(void *entry);
54extern unsigned long find_iomem(char *driver, unsigned long *len_out); 51extern unsigned long find_iomem(char *driver, unsigned long *len_out);
@@ -62,6 +59,5 @@ extern unsigned long phys_offset(unsigned long phys);
62extern void unmap_physmem(void); 59extern void unmap_physmem(void);
63extern void map_memory(unsigned long virt, unsigned long phys, 60extern void map_memory(unsigned long virt, unsigned long phys,
64 unsigned long len, int r, int w, int x); 61 unsigned long len, int r, int w, int x);
65extern unsigned long get_kmem_end(void);
66 62
67#endif 63#endif
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 8196450451cd..bf66b5b7bc68 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -19,7 +19,7 @@
19void flush_thread(void) 19void flush_thread(void)
20{ 20{
21 void *data = NULL; 21 void *data = NULL;
22 unsigned long end = proc_mm ? task_size : STUB_START; 22 unsigned long end = proc_mm ? TASK_SIZE : STUB_START;
23 int ret; 23 int ret;
24 24
25 arch_flush_thread(&current->thread.arch); 25 arch_flush_thread(&current->thread.arch);
diff --git a/arch/um/kernel/ksyms.c b/arch/um/kernel/ksyms.c
index f0ced9840a27..187a756f3e5b 100644
--- a/arch/um/kernel/ksyms.c
+++ b/arch/um/kernel/ksyms.c
@@ -18,11 +18,8 @@ EXPORT_SYMBOL(set_signals);
18EXPORT_SYMBOL(get_signals); 18EXPORT_SYMBOL(get_signals);
19EXPORT_SYMBOL(kernel_thread); 19EXPORT_SYMBOL(kernel_thread);
20EXPORT_SYMBOL(sys_waitpid); 20EXPORT_SYMBOL(sys_waitpid);
21EXPORT_SYMBOL(task_size);
22EXPORT_SYMBOL(flush_tlb_range); 21EXPORT_SYMBOL(flush_tlb_range);
23EXPORT_SYMBOL(host_task_size);
24EXPORT_SYMBOL(arch_validate); 22EXPORT_SYMBOL(arch_validate);
25EXPORT_SYMBOL(get_kmem_end);
26 23
27EXPORT_SYMBOL(high_physmem); 24EXPORT_SYMBOL(high_physmem);
28EXPORT_SYMBOL(empty_zero_page); 25EXPORT_SYMBOL(empty_zero_page);
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index e66432f42485..9c9290005792 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -55,16 +55,6 @@ int __init init_maps(unsigned long physmem, unsigned long iomem,
55 return 0; 55 return 0;
56} 56}
57 57
58/* Changed during early boot */
59static unsigned long kmem_top = 0;
60
61unsigned long get_kmem_end(void)
62{
63 if (kmem_top == 0)
64 kmem_top = host_task_size - 1024 * 1024;
65 return kmem_top;
66}
67
68void map_memory(unsigned long virt, unsigned long phys, unsigned long len, 58void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
69 int r, int w, int x) 59 int r, int w, int x)
70{ 60{
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index 96e097879f5b..429fed2f66b2 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -511,7 +511,7 @@ void flush_tlb_mm(struct mm_struct *mm)
511 if (atomic_read(&mm->mm_users) == 0) 511 if (atomic_read(&mm->mm_users) == 0)
512 return; 512 return;
513 513
514 end = proc_mm ? task_size : STUB_START; 514 end = proc_mm ? TASK_SIZE : STUB_START;
515 fix_range(mm, 0, end, 0); 515 fix_range(mm, 0, end, 0);
516} 516}
517 517
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 1139e07b968f..9ba39ab5f4bd 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -101,8 +101,6 @@ const struct seq_operations cpuinfo_op = {
101}; 101};
102 102
103/* Set in linux_main */ 103/* Set in linux_main */
104unsigned long host_task_size;
105unsigned long task_size;
106unsigned long uml_physmem; 104unsigned long uml_physmem;
107unsigned long uml_reserved; /* Also modified in mem_init */ 105unsigned long uml_reserved; /* Also modified in mem_init */
108unsigned long start_vm; 106unsigned long start_vm;
@@ -234,20 +232,6 @@ EXPORT_SYMBOL(end_iomem);
234 232
235extern char __binary_start; 233extern char __binary_start;
236 234
237static unsigned long set_task_sizes_skas(unsigned long *task_size_out)
238{
239 /* Round up to the nearest 4M */
240 unsigned long host_task_size = ROUND_4M((unsigned long)
241 &host_task_size);
242
243 if (!skas_needs_stub)
244 *task_size_out = host_task_size;
245 else
246 *task_size_out = STUB_START & PGDIR_MASK;
247
248 return host_task_size;
249}
250
251int __init linux_main(int argc, char **argv) 235int __init linux_main(int argc, char **argv)
252{ 236{
253 unsigned long avail, diff; 237 unsigned long avail, diff;
@@ -278,8 +262,6 @@ int __init linux_main(int argc, char **argv)
278 262
279 printf("UML running in %s mode\n", mode); 263 printf("UML running in %s mode\n", mode);
280 264
281 host_task_size = set_task_sizes_skas(&task_size);
282
283 brk_start = (unsigned long) sbrk(0); 265 brk_start = (unsigned long) sbrk(0);
284 266
285 /* 267 /*
@@ -304,7 +286,7 @@ int __init linux_main(int argc, char **argv)
304 286
305 highmem = 0; 287 highmem = 0;
306 iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK; 288 iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
307 max_physmem = get_kmem_end() - uml_physmem - iomem_size - MIN_VMALLOC; 289 max_physmem = CONFIG_TOP_ADDR - uml_physmem - iomem_size - MIN_VMALLOC;
308 290
309 /* 291 /*
310 * Zones have to begin on a 1 << MAX_ORDER page boundary, 292 * Zones have to begin on a 1 << MAX_ORDER page boundary,
@@ -336,7 +318,7 @@ int __init linux_main(int argc, char **argv)
336 } 318 }
337 319
338 virtmem_size = physmem_size; 320 virtmem_size = physmem_size;
339 avail = get_kmem_end() - start_vm; 321 avail = CONFIG_TOP_ADDR - start_vm;
340 if (physmem_size > avail) 322 if (physmem_size > avail)
341 virtmem_size = avail; 323 virtmem_size = avail;
342 end_vm = start_vm + virtmem_size; 324 end_vm = start_vm + virtmem_size;
diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h
index 9281dd8eb334..f42ff14577fa 100644
--- a/include/asm-um/a.out.h
+++ b/include/asm-um/a.out.h
@@ -13,11 +13,9 @@
13 13
14extern unsigned long stacksizelim; 14extern unsigned long stacksizelim;
15 15
16extern unsigned long host_task_size;
17
18#define STACK_ROOM (stacksizelim) 16#define STACK_ROOM (stacksizelim)
19 17
20#define STACK_TOP task_size 18#define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE)
21 19
22#define STACK_TOP_MAX STACK_TOP 20#define STACK_TOP_MAX STACK_TOP
23 21
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h
index 3d3e85d30ac2..89a87c18b927 100644
--- a/include/asm-um/fixmap.h
+++ b/include/asm-um/fixmap.h
@@ -56,9 +56,8 @@ extern void __set_fixmap (enum fixed_addresses idx,
56 * the start of the fixmap, and leave one page empty 56 * the start of the fixmap, and leave one page empty
57 * at the top of mem.. 57 * at the top of mem..
58 */ 58 */
59extern unsigned long get_kmem_end(void);
60 59
61#define FIXADDR_TOP (get_kmem_end() - 0x2000) 60#define FIXADDR_TOP (CONFIG_TOP_ADDR - 2 * PAGE_SIZE)
62#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 61#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
63#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) 62#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
64 63
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index 35ab6a292d63..ecf67069941a 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -94,9 +94,7 @@ static inline void mm_copy_segments(struct mm_struct *from_mm,
94/* 94/*
95 * User space process size: 3GB (default). 95 * User space process size: 3GB (default).
96 */ 96 */
97extern unsigned long task_size; 97#define TASK_SIZE (CONFIG_TOP_ADDR & PGDIR_MASK)
98
99#define TASK_SIZE (task_size)
100 98
101/* This decides where the kernel will search for a free chunk of vm 99/* This decides where the kernel will search for a free chunk of vm
102 * space during mmap's. 100 * space during mmap's.