aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/include')
-rw-r--r--arch/um/include/as-layout.h24
-rw-r--r--arch/um/include/sysdep-i386/stub.h11
-rw-r--r--arch/um/include/sysdep-x86_64/stub.h13
3 files changed, 37 insertions, 11 deletions
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
11struct cpu_task { 33struct cpu_task {
@@ -32,3 +54,5 @@ extern int linux_main(int argc, char **argv);
32extern void (*sig_info[])(int, struct uml_pt_regs *); 54extern 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