diff options
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/Kconfig.i386 | 14 | ||||
-rw-r--r-- | arch/um/Kconfig.x86_64 | 14 | ||||
-rw-r--r-- | arch/um/defconfig | 3 | ||||
-rw-r--r-- | arch/um/include/as-layout.h | 24 | ||||
-rw-r--r-- | arch/um/include/sysdep-i386/stub.h | 11 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/stub.h | 13 | ||||
-rw-r--r-- | arch/um/kernel/exec.c | 3 | ||||
-rw-r--r-- | arch/um/kernel/skas/clone.c | 6 | ||||
-rw-r--r-- | arch/um/kernel/skas/mmu.c | 5 | ||||
-rw-r--r-- | arch/um/kernel/skas/process.c | 2 | ||||
-rw-r--r-- | arch/um/kernel/tlb.c | 6 | ||||
-rw-r--r-- | arch/um/kernel/um_arch.c | 3 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/mem.c | 8 | ||||
-rw-r--r-- | arch/um/os-Linux/skas/process.c | 21 | ||||
-rw-r--r-- | arch/um/sys-i386/stub.S | 9 | ||||
-rw-r--r-- | arch/um/sys-i386/stub_segv.c | 4 | ||||
-rw-r--r-- | arch/um/sys-x86_64/stub.S | 9 | ||||
-rw-r--r-- | arch/um/sys-x86_64/stub_segv.c | 3 |
18 files changed, 81 insertions, 77 deletions
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386 index d6cffb27fff8..9876d80d85dd 100644 --- a/arch/um/Kconfig.i386 +++ b/arch/um/Kconfig.i386 | |||
@@ -65,20 +65,6 @@ config 3_LEVEL_PGTABLES | |||
65 | However, this it experimental on 32-bit architectures, so if unsure say | 65 | However, this it experimental on 32-bit architectures, so if unsure say |
66 | N (on x86-64 it's automatically enabled, instead, as it's safe there). | 66 | N (on x86-64 it's automatically enabled, instead, as it's safe there). |
67 | 67 | ||
68 | config STUB_CODE | ||
69 | hex | ||
70 | default 0xbfffe000 if !HOST_VMSPLIT_2G | ||
71 | default 0x7fffe000 if HOST_VMSPLIT_2G | ||
72 | |||
73 | config STUB_DATA | ||
74 | hex | ||
75 | default 0xbffff000 if !HOST_VMSPLIT_2G | ||
76 | default 0x7ffff000 if HOST_VMSPLIT_2G | ||
77 | |||
78 | config STUB_START | ||
79 | hex | ||
80 | default STUB_CODE | ||
81 | |||
82 | config ARCH_HAS_SC_SIGNALS | 68 | config ARCH_HAS_SC_SIGNALS |
83 | bool | 69 | bool |
84 | default y | 70 | default y |
diff --git a/arch/um/Kconfig.x86_64 b/arch/um/Kconfig.x86_64 index f60e9e506424..d632e9a89cc3 100644 --- a/arch/um/Kconfig.x86_64 +++ b/arch/um/Kconfig.x86_64 | |||
@@ -17,24 +17,12 @@ config SEMAPHORE_SLEEPERS | |||
17 | 17 | ||
18 | config TOP_ADDR | 18 | config TOP_ADDR |
19 | hex | 19 | hex |
20 | default 0x80000000 | 20 | default 0x7fc0000000 |
21 | 21 | ||
22 | config 3_LEVEL_PGTABLES | 22 | config 3_LEVEL_PGTABLES |
23 | bool | 23 | bool |
24 | default y | 24 | default y |
25 | 25 | ||
26 | config STUB_CODE | ||
27 | hex | ||
28 | default 0x7fbfffe000 | ||
29 | |||
30 | config STUB_DATA | ||
31 | hex | ||
32 | default 0x7fbffff000 | ||
33 | |||
34 | config STUB_START | ||
35 | hex | ||
36 | default STUB_CODE | ||
37 | |||
38 | config ARCH_HAS_SC_SIGNALS | 26 | config ARCH_HAS_SC_SIGNALS |
39 | bool | 27 | bool |
40 | default n | 28 | default n |
diff --git a/arch/um/defconfig b/arch/um/defconfig index 1cbbe980f106..f609edede065 100644 --- a/arch/um/defconfig +++ b/arch/um/defconfig | |||
@@ -59,9 +59,6 @@ CONFIG_SEMAPHORE_SLEEPERS=y | |||
59 | # CONFIG_HOST_2G_2G is not set | 59 | # CONFIG_HOST_2G_2G is not set |
60 | CONFIG_TOP_ADDR=0xc0000000 | 60 | CONFIG_TOP_ADDR=0xc0000000 |
61 | # CONFIG_3_LEVEL_PGTABLES is not set | 61 | # CONFIG_3_LEVEL_PGTABLES is not set |
62 | CONFIG_STUB_CODE=0xbfffe000 | ||
63 | CONFIG_STUB_DATA=0xbffff000 | ||
64 | CONFIG_STUB_START=0xbfffe000 | ||
65 | CONFIG_ARCH_HAS_SC_SIGNALS=y | 62 | CONFIG_ARCH_HAS_SC_SIGNALS=y |
66 | CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y | 63 | CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y |
67 | CONFIG_GENERIC_HWEIGHT=y | 64 | CONFIG_GENERIC_HWEIGHT=y |
diff --git a/arch/um/include/as-layout.h b/arch/um/include/as-layout.h index 2f16a1c7d616..a5cdf953e04a 100644 --- a/arch/um/include/as-layout.h +++ b/arch/um/include/as-layout.h | |||
@@ -6,6 +6,28 @@ | |||
6 | #ifndef __START_H__ | 6 | #ifndef __START_H__ |
7 | #define __START_H__ | 7 | #define __START_H__ |
8 | 8 | ||
9 | #include "uml-config.h" | ||
10 | #include "kern_constants.h" | ||
11 | |||
12 | /* | ||
13 | * Assembly doesn't want any casting, but C does, so define these | ||
14 | * without casts here, and define new symbols with casts inside the C | ||
15 | * section. | ||
16 | */ | ||
17 | #define ASM_STUB_CODE (UML_CONFIG_TOP_ADDR - 2 * UM_KERN_PAGE_SIZE) | ||
18 | #define ASM_STUB_DATA (UML_CONFIG_TOP_ADDR - UM_KERN_PAGE_SIZE) | ||
19 | #define ASM_STUB_START ASM_STUB_CODE | ||
20 | |||
21 | /* | ||
22 | * This file is included by the assembly stubs, which just want the | ||
23 | * definitions above. | ||
24 | */ | ||
25 | #ifndef __ASSEMBLY__ | ||
26 | |||
27 | #define STUB_CODE ((unsigned long) ASM_STUB_CODE) | ||
28 | #define STUB_DATA ((unsigned long) ASM_STUB_DATA) | ||
29 | #define STUB_START ((unsigned long) ASM_STUB_START) | ||
30 | |||
9 | #include "sysdep/ptrace.h" | 31 | #include "sysdep/ptrace.h" |
10 | 32 | ||
11 | struct cpu_task { | 33 | struct cpu_task { |
@@ -32,3 +54,5 @@ extern int linux_main(int argc, char **argv); | |||
32 | extern void (*sig_info[])(int, struct uml_pt_regs *); | 54 | extern void (*sig_info[])(int, struct uml_pt_regs *); |
33 | 55 | ||
34 | #endif | 56 | #endif |
57 | |||
58 | #endif | ||
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h index 19c85f330fc1..8c097b87fca7 100644 --- a/arch/um/include/sysdep-i386/stub.h +++ b/arch/um/include/sysdep-i386/stub.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <sys/mman.h> | 9 | #include <sys/mman.h> |
10 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
11 | #include <asm/unistd.h> | 11 | #include <asm/unistd.h> |
12 | #include "as-layout.h" | ||
12 | #include "stub-data.h" | 13 | #include "stub-data.h" |
13 | #include "kern_constants.h" | 14 | #include "kern_constants.h" |
14 | #include "uml-config.h" | 15 | #include "uml-config.h" |
@@ -89,12 +90,12 @@ static inline void remap_stack(int fd, unsigned long offset) | |||
89 | { | 90 | { |
90 | __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" | 91 | __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" |
91 | "movl %7, %%ebx ; movl %%eax, (%%ebx)" | 92 | "movl %7, %%ebx ; movl %%eax, (%%ebx)" |
92 | : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA), | 93 | : : "g" (STUB_MMAP_NR), "b" (STUB_DATA), |
93 | "c" (UM_KERN_PAGE_SIZE), | 94 | "c" (UM_KERN_PAGE_SIZE), |
94 | "d" (PROT_READ | PROT_WRITE), | 95 | "d" (PROT_READ | PROT_WRITE), |
95 | "S" (MAP_FIXED | MAP_SHARED), "D" (fd), | 96 | "S" (MAP_FIXED | MAP_SHARED), "D" (fd), |
96 | "a" (offset), | 97 | "a" (offset), |
97 | "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) | 98 | "i" (&((struct stub_data *) STUB_DATA)->err) |
98 | : "memory"); | 99 | : "memory"); |
99 | } | 100 | } |
100 | 101 | ||
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h index 92e989f81761..655f9c2de3ac 100644 --- a/arch/um/include/sysdep-x86_64/stub.h +++ b/arch/um/include/sysdep-x86_64/stub.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <sys/mman.h> | 9 | #include <sys/mman.h> |
10 | #include <asm/unistd.h> | 10 | #include <asm/unistd.h> |
11 | #include <sysdep/ptrace_user.h> | 11 | #include <sysdep/ptrace_user.h> |
12 | #include "as-layout.h" | ||
12 | #include "stub-data.h" | 13 | #include "stub-data.h" |
13 | #include "kern_constants.h" | 14 | #include "kern_constants.h" |
14 | #include "uml-config.h" | 15 | #include "uml-config.h" |
@@ -94,13 +95,13 @@ static inline void remap_stack(long fd, unsigned long offset) | |||
94 | { | 95 | { |
95 | __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; " | 96 | __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; " |
96 | "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; " | 97 | "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; " |
97 | "movq %%rax, (%%rbx)": | 98 | "movq %%rax, (%%rbx)": |
98 | : "a" (STUB_MMAP_NR), "D" (UML_CONFIG_STUB_DATA), | 99 | : "a" (STUB_MMAP_NR), "D" (STUB_DATA), |
99 | "S" (UM_KERN_PAGE_SIZE), | 100 | "S" (UM_KERN_PAGE_SIZE), |
100 | "d" (PROT_READ | PROT_WRITE), | 101 | "d" (PROT_READ | PROT_WRITE), |
101 | "g" (MAP_FIXED | MAP_SHARED), "g" (fd), | 102 | "g" (MAP_FIXED | MAP_SHARED), "g" (fd), |
102 | "g" (offset), | 103 | "g" (offset), |
103 | "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) | 104 | "i" (&((struct stub_data *) STUB_DATA)->err) |
104 | : __syscall_clobber, "r10", "r8", "r9" ); | 105 | : __syscall_clobber, "r10", "r8", "r9" ); |
105 | } | 106 | } |
106 | 107 | ||
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 7c77adecd919..8196450451cd 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include "asm/current.h" | 11 | #include "asm/current.h" |
12 | #include "asm/processor.h" | 12 | #include "asm/processor.h" |
13 | #include "asm/uaccess.h" | 13 | #include "asm/uaccess.h" |
14 | #include "as-layout.h" | ||
14 | #include "mem_user.h" | 15 | #include "mem_user.h" |
15 | #include "skas.h" | 16 | #include "skas.h" |
16 | #include "os.h" | 17 | #include "os.h" |
@@ -18,7 +19,7 @@ | |||
18 | void flush_thread(void) | 19 | void flush_thread(void) |
19 | { | 20 | { |
20 | void *data = NULL; | 21 | void *data = NULL; |
21 | unsigned long end = proc_mm ? task_size : CONFIG_STUB_START; | 22 | unsigned long end = proc_mm ? task_size : STUB_START; |
22 | int ret; | 23 | int ret; |
23 | 24 | ||
24 | arch_flush_thread(¤t->thread.arch); | 25 | arch_flush_thread(¤t->thread.arch); |
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c index 47b812b3bca8..d119f4f7d897 100644 --- a/arch/um/kernel/skas/clone.c +++ b/arch/um/kernel/skas/clone.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <sys/time.h> | 4 | #include <sys/time.h> |
5 | #include <asm/unistd.h> | 5 | #include <asm/unistd.h> |
6 | #include <asm/page.h> | 6 | #include <asm/page.h> |
7 | #include "as-layout.h" | ||
7 | #include "ptrace_user.h" | 8 | #include "ptrace_user.h" |
8 | #include "skas.h" | 9 | #include "skas.h" |
9 | #include "stub-data.h" | 10 | #include "stub-data.h" |
@@ -21,12 +22,11 @@ | |||
21 | void __attribute__ ((__section__ (".__syscall_stub"))) | 22 | void __attribute__ ((__section__ (".__syscall_stub"))) |
22 | stub_clone_handler(void) | 23 | stub_clone_handler(void) |
23 | { | 24 | { |
24 | struct stub_data *data = (struct stub_data *) UML_CONFIG_STUB_DATA; | 25 | struct stub_data *data = (struct stub_data *) STUB_DATA; |
25 | long err; | 26 | long err; |
26 | 27 | ||
27 | err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, | 28 | err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, |
28 | UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE / 2 - | 29 | STUB_DATA + UM_KERN_PAGE_SIZE / 2 - sizeof(void *)); |
29 | sizeof(void *)); | ||
30 | if(err != 0) | 30 | if(err != 0) |
31 | goto out; | 31 | goto out; |
32 | 32 | ||
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c index ae79888cf520..f859ec306cd5 100644 --- a/arch/um/kernel/skas/mmu.c +++ b/arch/um/kernel/skas/mmu.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "linux/sched.h" | 7 | #include "linux/sched.h" |
8 | #include "asm/pgalloc.h" | 8 | #include "asm/pgalloc.h" |
9 | #include "asm/pgtable.h" | 9 | #include "asm/pgtable.h" |
10 | #include "as-layout.h" | ||
10 | #include "os.h" | 11 | #include "os.h" |
11 | #include "skas.h" | 12 | #include "skas.h" |
12 | 13 | ||
@@ -83,12 +84,12 @@ int init_new_context(struct task_struct *task, struct mm_struct *mm) | |||
83 | */ | 84 | */ |
84 | mm->pgd[USER_PTRS_PER_PGD] = __pgd(0); | 85 | mm->pgd[USER_PTRS_PER_PGD] = __pgd(0); |
85 | 86 | ||
86 | ret = init_stub_pte(mm, CONFIG_STUB_CODE, | 87 | ret = init_stub_pte(mm, STUB_CODE, |
87 | (unsigned long) &__syscall_stub_start); | 88 | (unsigned long) &__syscall_stub_start); |
88 | if (ret) | 89 | if (ret) |
89 | goto out_free; | 90 | goto out_free; |
90 | 91 | ||
91 | ret = init_stub_pte(mm, CONFIG_STUB_DATA, stack); | 92 | ret = init_stub_pte(mm, STUB_DATA, stack); |
92 | if (ret) | 93 | if (ret) |
93 | goto out_free; | 94 | goto out_free; |
94 | 95 | ||
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c index 0297e63f9725..fce389c2342f 100644 --- a/arch/um/kernel/skas/process.c +++ b/arch/um/kernel/skas/process.c | |||
@@ -18,7 +18,7 @@ int new_mm(unsigned long stack) | |||
18 | return fd; | 18 | return fd; |
19 | 19 | ||
20 | if (skas_needs_stub) | 20 | if (skas_needs_stub) |
21 | map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); | 21 | map_stub_pages(fd, STUB_CODE, STUB_DATA, stack); |
22 | 22 | ||
23 | return fd; | 23 | return fd; |
24 | } | 24 | } |
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 942f20ea888a..f4a0e407eee4 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c | |||
@@ -485,8 +485,8 @@ void __flush_tlb_one(unsigned long addr) | |||
485 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, | 485 | static void fix_range(struct mm_struct *mm, unsigned long start_addr, |
486 | unsigned long end_addr, int force) | 486 | unsigned long end_addr, int force) |
487 | { | 487 | { |
488 | if (!proc_mm && (end_addr > CONFIG_STUB_START)) | 488 | if (!proc_mm && (end_addr > STUB_START)) |
489 | end_addr = CONFIG_STUB_START; | 489 | end_addr = STUB_START; |
490 | 490 | ||
491 | fix_range_common(mm, start_addr, end_addr, force); | 491 | fix_range_common(mm, start_addr, end_addr, force); |
492 | } | 492 | } |
@@ -510,7 +510,7 @@ void flush_tlb_mm(struct mm_struct *mm) | |||
510 | if (atomic_read(&mm->mm_users) == 0) | 510 | if (atomic_read(&mm->mm_users) == 0) |
511 | return; | 511 | return; |
512 | 512 | ||
513 | end = proc_mm ? task_size : CONFIG_STUB_START; | 513 | end = proc_mm ? task_size : STUB_START; |
514 | fix_range(mm, 0, end, 0); | 514 | fix_range(mm, 0, end, 0); |
515 | } | 515 | } |
516 | 516 | ||
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 1993e5e12256..f1c71393f578 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -242,7 +242,8 @@ static unsigned long set_task_sizes_skas(unsigned long *task_size_out) | |||
242 | 242 | ||
243 | if (!skas_needs_stub) | 243 | if (!skas_needs_stub) |
244 | *task_size_out = host_task_size; | 244 | *task_size_out = host_task_size; |
245 | else *task_size_out = CONFIG_STUB_START & PGDIR_MASK; | 245 | else |
246 | *task_size_out = STUB_START & PGDIR_MASK; | ||
246 | 247 | ||
247 | return host_task_size; | 248 | return host_task_size; |
248 | } | 249 | } |
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c index d58d11179bb7..484e68f9f7ae 100644 --- a/arch/um/os-Linux/skas/mem.c +++ b/arch/um/os-Linux/skas/mem.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <sys/mman.h> | 10 | #include <sys/mman.h> |
11 | #include "init.h" | 11 | #include "init.h" |
12 | #include "kern_constants.h" | 12 | #include "kern_constants.h" |
13 | #include "as-layout.h" | ||
13 | #include "mm_id.h" | 14 | #include "mm_id.h" |
14 | #include "os.h" | 15 | #include "os.h" |
15 | #include "proc_mm.h" | 16 | #include "proc_mm.h" |
@@ -40,7 +41,7 @@ static unsigned long syscall_regs[MAX_REG_NR]; | |||
40 | static int __init init_syscall_regs(void) | 41 | static int __init init_syscall_regs(void) |
41 | { | 42 | { |
42 | get_safe_registers(syscall_regs); | 43 | get_safe_registers(syscall_regs); |
43 | syscall_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + | 44 | syscall_regs[REGS_IP_INDEX] = STUB_CODE + |
44 | ((unsigned long) &batch_syscall_stub - | 45 | ((unsigned long) &batch_syscall_stub - |
45 | (unsigned long) &__syscall_stub_start); | 46 | (unsigned long) &__syscall_stub_start); |
46 | return 0; | 47 | return 0; |
@@ -93,8 +94,7 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) | |||
93 | ret = *((unsigned long *) mm_idp->stack); | 94 | ret = *((unsigned long *) mm_idp->stack); |
94 | offset = *((unsigned long *) mm_idp->stack + 1); | 95 | offset = *((unsigned long *) mm_idp->stack + 1); |
95 | if (offset) { | 96 | if (offset) { |
96 | data = (unsigned long *)(mm_idp->stack + | 97 | data = (unsigned long *)(mm_idp->stack + offset - STUB_DATA); |
97 | offset - UML_CONFIG_STUB_DATA); | ||
98 | printk(UM_KERN_ERR "do_syscall_stub : ret = %ld, offset = %ld, " | 98 | printk(UM_KERN_ERR "do_syscall_stub : ret = %ld, offset = %ld, " |
99 | "data = %p\n", ret, offset, data); | 99 | "data = %p\n", ret, offset, data); |
100 | syscall = (unsigned long *)((unsigned long)data + data[0]); | 100 | syscall = (unsigned long *)((unsigned long)data + data[0]); |
@@ -182,7 +182,7 @@ long syscall_stub_data(struct mm_id * mm_idp, | |||
182 | memcpy(stack + 1, data, data_count * sizeof(long)); | 182 | memcpy(stack + 1, data, data_count * sizeof(long)); |
183 | 183 | ||
184 | *stub_addr = (void *)(((unsigned long)(stack + 1) & | 184 | *stub_addr = (void *)(((unsigned long)(stack + 1) & |
185 | ~UM_KERN_PAGE_MASK) + UML_CONFIG_STUB_DATA); | 185 | ~UM_KERN_PAGE_MASK) + STUB_DATA); |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index 8548f126d628..e60d6e6c5a58 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -191,22 +191,23 @@ static int userspace_tramp(void *stack) | |||
191 | int fd; | 191 | int fd; |
192 | unsigned long long offset; | 192 | unsigned long long offset; |
193 | fd = phys_mapping(to_phys(&__syscall_stub_start), &offset); | 193 | fd = phys_mapping(to_phys(&__syscall_stub_start), &offset); |
194 | addr = mmap64((void *) UML_CONFIG_STUB_CODE, UM_KERN_PAGE_SIZE, | 194 | addr = mmap64((void *) STUB_CODE, UM_KERN_PAGE_SIZE, |
195 | PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset); | 195 | PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset); |
196 | if (addr == MAP_FAILED) { | 196 | if (addr == MAP_FAILED) { |
197 | printk(UM_KERN_ERR "mapping mmap stub failed, " | 197 | printk(UM_KERN_ERR "mapping mmap stub at 0x%lx failed, " |
198 | "errno = %d\n", errno); | 198 | "errno = %d\n", STUB_CODE, errno); |
199 | exit(1); | 199 | exit(1); |
200 | } | 200 | } |
201 | 201 | ||
202 | if (stack != NULL) { | 202 | if (stack != NULL) { |
203 | fd = phys_mapping(to_phys(stack), &offset); | 203 | fd = phys_mapping(to_phys(stack), &offset); |
204 | addr = mmap((void *) UML_CONFIG_STUB_DATA, | 204 | addr = mmap((void *) STUB_DATA, |
205 | UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, | 205 | UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, |
206 | MAP_FIXED | MAP_SHARED, fd, offset); | 206 | MAP_FIXED | MAP_SHARED, fd, offset); |
207 | if (addr == MAP_FAILED) { | 207 | if (addr == MAP_FAILED) { |
208 | printk(UM_KERN_ERR "mapping segfault stack " | 208 | printk(UM_KERN_ERR "mapping segfault stack " |
209 | "failed, errno = %d\n", errno); | 209 | "at 0x%lx failed, errno = %d\n", |
210 | STUB_DATA, errno); | ||
210 | exit(1); | 211 | exit(1); |
211 | } | 212 | } |
212 | } | 213 | } |
@@ -214,11 +215,11 @@ static int userspace_tramp(void *stack) | |||
214 | if (!ptrace_faultinfo && (stack != NULL)) { | 215 | if (!ptrace_faultinfo && (stack != NULL)) { |
215 | struct sigaction sa; | 216 | struct sigaction sa; |
216 | 217 | ||
217 | unsigned long v = UML_CONFIG_STUB_CODE + | 218 | unsigned long v = STUB_CODE + |
218 | (unsigned long) stub_segv_handler - | 219 | (unsigned long) stub_segv_handler - |
219 | (unsigned long) &__syscall_stub_start; | 220 | (unsigned long) &__syscall_stub_start; |
220 | 221 | ||
221 | set_sigstack((void *) UML_CONFIG_STUB_DATA, UM_KERN_PAGE_SIZE); | 222 | set_sigstack((void *) STUB_DATA, UM_KERN_PAGE_SIZE); |
222 | sigemptyset(&sa.sa_mask); | 223 | sigemptyset(&sa.sa_mask); |
223 | sigaddset(&sa.sa_mask, SIGIO); | 224 | sigaddset(&sa.sa_mask, SIGIO); |
224 | sigaddset(&sa.sa_mask, SIGWINCH); | 225 | sigaddset(&sa.sa_mask, SIGWINCH); |
@@ -382,10 +383,10 @@ static int __init init_thread_regs(void) | |||
382 | { | 383 | { |
383 | get_safe_registers(thread_regs); | 384 | get_safe_registers(thread_regs); |
384 | /* Set parent's instruction pointer to start of clone-stub */ | 385 | /* Set parent's instruction pointer to start of clone-stub */ |
385 | thread_regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + | 386 | thread_regs[REGS_IP_INDEX] = STUB_CODE + |
386 | (unsigned long) stub_clone_handler - | 387 | (unsigned long) stub_clone_handler - |
387 | (unsigned long) &__syscall_stub_start; | 388 | (unsigned long) &__syscall_stub_start; |
388 | thread_regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + UM_KERN_PAGE_SIZE - | 389 | thread_regs[REGS_SP_INDEX] = STUB_DATA + UM_KERN_PAGE_SIZE - |
389 | sizeof(void *); | 390 | sizeof(void *); |
390 | #ifdef __SIGNAL_FRAMESIZE | 391 | #ifdef __SIGNAL_FRAMESIZE |
391 | thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE; | 392 | thread_regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE; |
@@ -443,7 +444,7 @@ int copy_context_skas0(unsigned long new_stack, int pid) | |||
443 | * child's stack and check it. | 444 | * child's stack and check it. |
444 | */ | 445 | */ |
445 | wait_stub_done(pid); | 446 | wait_stub_done(pid); |
446 | if (child_data->err != UML_CONFIG_STUB_DATA) | 447 | if (child_data->err != STUB_DATA) |
447 | panic("copy_context_skas0 - stub-child reports error %ld\n", | 448 | panic("copy_context_skas0 - stub-child reports error %ld\n", |
448 | child_data->err); | 449 | child_data->err); |
449 | 450 | ||
diff --git a/arch/um/sys-i386/stub.S b/arch/um/sys-i386/stub.S index 6a70d9ab5c29..e730772c401b 100644 --- a/arch/um/sys-i386/stub.S +++ b/arch/um/sys-i386/stub.S | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "uml-config.h" | 1 | #include "uml-config.h" |
2 | #include "as-layout.h" | ||
2 | 3 | ||
3 | .globl syscall_stub | 4 | .globl syscall_stub |
4 | .section .__syscall_stub, "x" | 5 | .section .__syscall_stub, "x" |
@@ -6,7 +7,7 @@ | |||
6 | .globl batch_syscall_stub | 7 | .globl batch_syscall_stub |
7 | batch_syscall_stub: | 8 | batch_syscall_stub: |
8 | /* load pointer to first operation */ | 9 | /* load pointer to first operation */ |
9 | mov $(UML_CONFIG_STUB_DATA+8), %esp | 10 | mov $(ASM_STUB_DATA+8), %esp |
10 | 11 | ||
11 | again: | 12 | again: |
12 | /* load length of additional data */ | 13 | /* load length of additional data */ |
@@ -14,12 +15,12 @@ again: | |||
14 | 15 | ||
15 | /* if(length == 0) : end of list */ | 16 | /* if(length == 0) : end of list */ |
16 | /* write possible 0 to header */ | 17 | /* write possible 0 to header */ |
17 | mov %eax, UML_CONFIG_STUB_DATA+4 | 18 | mov %eax, ASM_STUB_DATA+4 |
18 | cmpl $0, %eax | 19 | cmpl $0, %eax |
19 | jz done | 20 | jz done |
20 | 21 | ||
21 | /* save current pointer */ | 22 | /* save current pointer */ |
22 | mov %esp, UML_CONFIG_STUB_DATA+4 | 23 | mov %esp, ASM_STUB_DATA+4 |
23 | 24 | ||
24 | /* skip additional data */ | 25 | /* skip additional data */ |
25 | add %eax, %esp | 26 | add %eax, %esp |
@@ -45,7 +46,7 @@ again: | |||
45 | 46 | ||
46 | done: | 47 | done: |
47 | /* save return value */ | 48 | /* save return value */ |
48 | mov %eax, UML_CONFIG_STUB_DATA | 49 | mov %eax, ASM_STUB_DATA |
49 | 50 | ||
50 | /* stop */ | 51 | /* stop */ |
51 | int3 | 52 | int3 |
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c index 2355dc19c46c..b3999cb76bfd 100644 --- a/arch/um/sys-i386/stub_segv.c +++ b/arch/um/sys-i386/stub_segv.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <signal.h> | 6 | #include <signal.h> |
7 | #include <sys/select.h> /* The only way I can see to get sigset_t */ | 7 | #include <sys/select.h> /* The only way I can see to get sigset_t */ |
8 | #include <asm/unistd.h> | 8 | #include <asm/unistd.h> |
9 | #include "as-layout.h" | ||
9 | #include "uml-config.h" | 10 | #include "uml-config.h" |
10 | #include "sysdep/stub.h" | 11 | #include "sysdep/stub.h" |
11 | #include "sysdep/sigcontext.h" | 12 | #include "sysdep/sigcontext.h" |
@@ -17,8 +18,7 @@ stub_segv_handler(int sig) | |||
17 | struct sigcontext *sc = (struct sigcontext *) (&sig + 1); | 18 | struct sigcontext *sc = (struct sigcontext *) (&sig + 1); |
18 | int pid; | 19 | int pid; |
19 | 20 | ||
20 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), | 21 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA), sc); |
21 | sc); | ||
22 | 22 | ||
23 | pid = stub_syscall0(__NR_getpid); | 23 | pid = stub_syscall0(__NR_getpid); |
24 | stub_syscall2(__NR_kill, pid, SIGUSR1); | 24 | stub_syscall2(__NR_kill, pid, SIGUSR1); |
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S index 03c279735784..4afe204a6af7 100644 --- a/arch/um/sys-x86_64/stub.S +++ b/arch/um/sys-x86_64/stub.S | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "uml-config.h" | 1 | #include "uml-config.h" |
2 | #include "as-layout.h" | ||
2 | 3 | ||
3 | .globl syscall_stub | 4 | .globl syscall_stub |
4 | .section .__syscall_stub, "x" | 5 | .section .__syscall_stub, "x" |
@@ -7,18 +8,18 @@ syscall_stub: | |||
7 | /* We don't have 64-bit constants, so this constructs the address | 8 | /* We don't have 64-bit constants, so this constructs the address |
8 | * we need. | 9 | * we need. |
9 | */ | 10 | */ |
10 | movq $(UML_CONFIG_STUB_DATA >> 32), %rbx | 11 | movq $(ASM_STUB_DATA >> 32), %rbx |
11 | salq $32, %rbx | 12 | salq $32, %rbx |
12 | movq $(UML_CONFIG_STUB_DATA & 0xffffffff), %rcx | 13 | movq $(ASM_STUB_DATA & 0xffffffff), %rcx |
13 | or %rcx, %rbx | 14 | or %rcx, %rbx |
14 | movq %rax, (%rbx) | 15 | movq %rax, (%rbx) |
15 | int3 | 16 | int3 |
16 | 17 | ||
17 | .globl batch_syscall_stub | 18 | .globl batch_syscall_stub |
18 | batch_syscall_stub: | 19 | batch_syscall_stub: |
19 | mov $(UML_CONFIG_STUB_DATA >> 32), %rbx | 20 | mov $(ASM_STUB_DATA >> 32), %rbx |
20 | sal $32, %rbx | 21 | sal $32, %rbx |
21 | mov $(UML_CONFIG_STUB_DATA & 0xffffffff), %rax | 22 | mov $(ASM_STUB_DATA & 0xffffffff), %rax |
22 | or %rax, %rbx | 23 | or %rax, %rbx |
23 | /* load pointer to first operation */ | 24 | /* load pointer to first operation */ |
24 | mov %rbx, %rsp | 25 | mov %rbx, %rsp |
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c index 652fa34c2cd3..3afb590f0072 100644 --- a/arch/um/sys-x86_64/stub_segv.c +++ b/arch/um/sys-x86_64/stub_segv.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <stddef.h> | 6 | #include <stddef.h> |
7 | #include <signal.h> | 7 | #include <signal.h> |
8 | #include <asm/unistd.h> | 8 | #include <asm/unistd.h> |
9 | #include "as-layout.h" | ||
9 | #include "uml-config.h" | 10 | #include "uml-config.h" |
10 | #include "sysdep/sigcontext.h" | 11 | #include "sysdep/sigcontext.h" |
11 | #include "sysdep/faultinfo.h" | 12 | #include "sysdep/faultinfo.h" |
@@ -33,7 +34,7 @@ stub_segv_handler(int sig) | |||
33 | int pid; | 34 | int pid; |
34 | 35 | ||
35 | __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); | 36 | __asm__ __volatile__("movq %%rdx, %0" : "=g" (uc) :); |
36 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA), | 37 | GET_FAULTINFO_FROM_SC(*((struct faultinfo *) STUB_DATA), |
37 | &uc->uc_mcontext); | 38 | &uc->uc_mcontext); |
38 | 39 | ||
39 | pid = stub_syscall0(__NR_getpid); | 40 | pid = stub_syscall0(__NR_getpid); |