aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-28 11:54:49 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-28 11:54:49 -0400
commitd1a76187a5be4f89c6cb19d800cb5fb7aac735c5 (patch)
tree2fac3ffbfffc7560eeef8364b541d0d7a0057920 /arch/um/include
parentc7e78cff6b7518212247fb20b1dc6411540dc9af (diff)
parent0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff)
Merge commit 'v2.6.28-rc2' into core/locking
Conflicts: arch/um/include/asm/system.h
Diffstat (limited to 'arch/um/include')
-rw-r--r--arch/um/include/asm/a.out-core.h27
-rw-r--r--arch/um/include/asm/apic.h4
-rw-r--r--arch/um/include/asm/auxvec.h4
-rw-r--r--arch/um/include/asm/bugs.h6
-rw-r--r--arch/um/include/asm/cache.h17
-rw-r--r--arch/um/include/asm/checksum.h6
-rw-r--r--arch/um/include/asm/common.lds.S130
-rw-r--r--arch/um/include/asm/cputime.h6
-rw-r--r--arch/um/include/asm/current.h13
-rw-r--r--arch/um/include/asm/delay.h20
-rw-r--r--arch/um/include/asm/desc.h16
-rw-r--r--arch/um/include/asm/device.h7
-rw-r--r--arch/um/include/asm/dma-mapping.h128
-rw-r--r--arch/um/include/asm/dma.h10
-rw-r--r--arch/um/include/asm/emergency-restart.h6
-rw-r--r--arch/um/include/asm/fixmap.h99
-rw-r--r--arch/um/include/asm/futex.h6
-rw-r--r--arch/um/include/asm/hardirq.h25
-rw-r--r--arch/um/include/asm/hw_irq.h7
-rw-r--r--arch/um/include/asm/io.h57
-rw-r--r--arch/um/include/asm/irq.h23
-rw-r--r--arch/um/include/asm/irq_regs.h1
-rw-r--r--arch/um/include/asm/irq_vectors.h (renamed from arch/um/include/sysdep-ia64/syscalls.h)6
-rw-r--r--arch/um/include/asm/irqflags.h6
-rw-r--r--arch/um/include/asm/kdebug.h1
-rw-r--r--arch/um/include/asm/kmap_types.h29
-rw-r--r--arch/um/include/asm/mmu.h (renamed from arch/um/include/sysdep-ia64/sigcontext.h)8
-rw-r--r--arch/um/include/asm/mmu_context.h54
-rw-r--r--arch/um/include/asm/mutex.h9
-rw-r--r--arch/um/include/asm/page.h122
-rw-r--r--arch/um/include/asm/page_offset.h1
-rw-r--r--arch/um/include/asm/param.h20
-rw-r--r--arch/um/include/asm/pci.h7
-rw-r--r--arch/um/include/asm/pda.h (renamed from arch/um/include/sysdep-ia64/ptrace.h)19
-rw-r--r--arch/um/include/asm/pgalloc.h72
-rw-r--r--arch/um/include/asm/pgtable-2level.h53
-rw-r--r--arch/um/include/asm/pgtable-3level.h146
-rw-r--r--arch/um/include/asm/pgtable.h366
-rw-r--r--arch/um/include/asm/processor-generic.h136
-rw-r--r--arch/um/include/asm/ptrace-generic.h55
-rw-r--r--arch/um/include/asm/required-features.h9
-rw-r--r--arch/um/include/asm/sections.h7
-rw-r--r--arch/um/include/asm/segment.h10
-rw-r--r--arch/um/include/asm/setup.h10
-rw-r--r--arch/um/include/asm/smp.h33
-rw-r--r--arch/um/include/asm/suspend.h4
-rw-r--r--arch/um/include/asm/system.h35
-rw-r--r--arch/um/include/asm/thread_info.h83
-rw-r--r--arch/um/include/asm/timex.h13
-rw-r--r--arch/um/include/asm/tlb.h127
-rw-r--r--arch/um/include/asm/tlbflush.h31
-rw-r--r--arch/um/include/asm/topology.h6
-rw-r--r--arch/um/include/asm/uaccess.h99
-rw-r--r--arch/um/include/asm/xor.h6
-rw-r--r--arch/um/include/shared/aio.h (renamed from arch/um/include/aio.h)0
-rw-r--r--arch/um/include/shared/arch.h (renamed from arch/um/include/arch.h)0
-rw-r--r--arch/um/include/shared/as-layout.h (renamed from arch/um/include/as-layout.h)1
-rw-r--r--arch/um/include/shared/chan_kern.h (renamed from arch/um/include/chan_kern.h)0
-rw-r--r--arch/um/include/shared/chan_user.h (renamed from arch/um/include/chan_user.h)0
-rw-r--r--arch/um/include/shared/common-offsets.h (renamed from arch/um/include/common-offsets.h)13
-rw-r--r--arch/um/include/shared/elf_user.h (renamed from arch/um/include/elf_user.h)0
-rw-r--r--arch/um/include/shared/frame_kern.h (renamed from arch/um/include/frame_kern.h)0
-rw-r--r--arch/um/include/shared/init.h (renamed from arch/um/include/init.h)0
-rw-r--r--arch/um/include/shared/initrd.h (renamed from arch/um/include/initrd.h)0
-rw-r--r--arch/um/include/shared/irq_kern.h (renamed from arch/um/include/irq_kern.h)0
-rw-r--r--arch/um/include/shared/irq_user.h (renamed from arch/um/include/irq_user.h)0
-rw-r--r--arch/um/include/shared/kern.h (renamed from arch/um/include/kern.h)0
-rw-r--r--arch/um/include/shared/kern_util.h (renamed from arch/um/include/kern_util.h)0
-rw-r--r--arch/um/include/shared/ldt.h37
-rw-r--r--arch/um/include/shared/line.h (renamed from arch/um/include/line.h)0
-rw-r--r--arch/um/include/shared/longjmp.h (renamed from arch/um/include/longjmp.h)0
-rw-r--r--arch/um/include/shared/mconsole.h (renamed from arch/um/include/mconsole.h)0
-rw-r--r--arch/um/include/shared/mconsole_kern.h (renamed from arch/um/include/mconsole_kern.h)0
-rw-r--r--arch/um/include/shared/mem.h (renamed from arch/um/include/mem.h)0
-rw-r--r--arch/um/include/shared/mem_kern.h (renamed from arch/um/include/mem_kern.h)0
-rw-r--r--arch/um/include/shared/mem_user.h (renamed from arch/um/include/mem_user.h)0
-rw-r--r--arch/um/include/shared/net_kern.h (renamed from arch/um/include/net_kern.h)0
-rw-r--r--arch/um/include/shared/net_user.h (renamed from arch/um/include/net_user.h)0
-rw-r--r--arch/um/include/shared/os.h (renamed from arch/um/include/os.h)1
-rw-r--r--arch/um/include/shared/process.h (renamed from arch/um/include/process.h)0
-rw-r--r--arch/um/include/shared/ptrace_user.h (renamed from arch/um/include/ptrace_user.h)0
-rw-r--r--arch/um/include/shared/registers.h (renamed from arch/um/include/registers.h)0
-rw-r--r--arch/um/include/shared/sigio.h (renamed from arch/um/include/sigio.h)0
-rw-r--r--arch/um/include/shared/skas/mm_id.h (renamed from arch/um/include/skas/mm_id.h)0
-rw-r--r--arch/um/include/shared/skas/proc_mm.h (renamed from arch/um/include/skas/proc_mm.h)0
-rw-r--r--arch/um/include/shared/skas/skas.h (renamed from arch/um/include/skas/skas.h)0
-rw-r--r--arch/um/include/shared/skas/stub-data.h (renamed from arch/um/include/skas/stub-data.h)0
-rw-r--r--arch/um/include/shared/skas_ptrace.h (renamed from arch/um/include/skas_ptrace.h)0
-rw-r--r--arch/um/include/shared/skas_ptregs.h (renamed from arch/um/include/skas_ptregs.h)0
-rw-r--r--arch/um/include/shared/syscall.h (renamed from arch/um/include/syscall.h)0
-rw-r--r--arch/um/include/shared/sysrq.h (renamed from arch/um/include/sysrq.h)0
-rw-r--r--arch/um/include/shared/task.h (renamed from arch/um/include/task.h)0
-rw-r--r--arch/um/include/shared/tlb.h (renamed from arch/um/include/tlb.h)0
-rw-r--r--arch/um/include/shared/ubd_user.h (renamed from arch/um/include/ubd_user.h)0
-rw-r--r--arch/um/include/shared/um_malloc.h (renamed from arch/um/include/um_malloc.h)0
-rw-r--r--arch/um/include/shared/um_mmu.h (renamed from arch/um/include/um_mmu.h)3
-rw-r--r--arch/um/include/shared/um_uaccess.h (renamed from arch/um/include/um_uaccess.h)0
-rw-r--r--arch/um/include/shared/user.h (renamed from arch/um/include/user.h)2
-rw-r--r--arch/um/include/sigcontext.h25
-rw-r--r--arch/um/include/sysdep-i386/archsetjmp.h22
-rw-r--r--arch/um/include/sysdep-i386/barrier.h9
-rw-r--r--arch/um/include/sysdep-i386/checksum.h211
-rw-r--r--arch/um/include/sysdep-i386/faultinfo.h29
-rw-r--r--arch/um/include/sysdep-i386/kernel-offsets.h21
-rw-r--r--arch/um/include/sysdep-i386/ptrace.h171
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h50
-rw-r--r--arch/um/include/sysdep-i386/sc.h44
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h26
-rw-r--r--arch/um/include/sysdep-i386/skas_ptrace.h22
-rw-r--r--arch/um/include/sysdep-i386/stub.h102
-rw-r--r--arch/um/include/sysdep-i386/syscalls.h26
-rw-r--r--arch/um/include/sysdep-i386/tls.h32
-rw-r--r--arch/um/include/sysdep-ia64/skas_ptrace.h22
-rw-r--r--arch/um/include/sysdep-ppc/ptrace.h103
-rw-r--r--arch/um/include/sysdep-ppc/sigcontext.h62
-rw-r--r--arch/um/include/sysdep-ppc/skas_ptrace.h22
-rw-r--r--arch/um/include/sysdep-ppc/syscalls.h53
-rw-r--r--arch/um/include/sysdep-x86_64/archsetjmp.h24
-rw-r--r--arch/um/include/sysdep-x86_64/barrier.h7
-rw-r--r--arch/um/include/sysdep-x86_64/checksum.h144
-rw-r--r--arch/um/include/sysdep-x86_64/faultinfo.h29
-rw-r--r--arch/um/include/sysdep-x86_64/kernel-offsets.h23
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h240
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace_user.h77
-rw-r--r--arch/um/include/sysdep-x86_64/sc.h45
-rw-r--r--arch/um/include/sysdep-x86_64/sigcontext.h27
-rw-r--r--arch/um/include/sysdep-x86_64/skas_ptrace.h22
-rw-r--r--arch/um/include/sysdep-x86_64/stub.h108
-rw-r--r--arch/um/include/sysdep-x86_64/syscalls.h33
-rw-r--r--arch/um/include/sysdep-x86_64/tls.h29
130 files changed, 2240 insertions, 1878 deletions
diff --git a/arch/um/include/asm/a.out-core.h b/arch/um/include/asm/a.out-core.h
new file mode 100644
index 000000000000..995643b18309
--- /dev/null
+++ b/arch/um/include/asm/a.out-core.h
@@ -0,0 +1,27 @@
1/* a.out coredump register dumper
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef __UM_A_OUT_CORE_H
13#define __UM_A_OUT_CORE_H
14
15#ifdef __KERNEL__
16
17#include <linux/user.h>
18
19/*
20 * fill in the user structure for an a.out core dump
21 */
22static inline void aout_dump_thread(struct pt_regs *regs, struct user *u)
23{
24}
25
26#endif /* __KERNEL__ */
27#endif /* __UM_A_OUT_CORE_H */
diff --git a/arch/um/include/asm/apic.h b/arch/um/include/asm/apic.h
new file mode 100644
index 000000000000..876dee84ab11
--- /dev/null
+++ b/arch/um/include/asm/apic.h
@@ -0,0 +1,4 @@
1#ifndef __UM_APIC_H
2#define __UM_APIC_H
3
4#endif
diff --git a/arch/um/include/asm/auxvec.h b/arch/um/include/asm/auxvec.h
new file mode 100644
index 000000000000..1e5e1c2fc9b1
--- /dev/null
+++ b/arch/um/include/asm/auxvec.h
@@ -0,0 +1,4 @@
1#ifndef __UM_AUXVEC_H
2#define __UM_AUXVEC_H
3
4#endif
diff --git a/arch/um/include/asm/bugs.h b/arch/um/include/asm/bugs.h
new file mode 100644
index 000000000000..6a72e240d5fc
--- /dev/null
+++ b/arch/um/include/asm/bugs.h
@@ -0,0 +1,6 @@
1#ifndef __UM_BUGS_H
2#define __UM_BUGS_H
3
4void check_bugs(void);
5
6#endif
diff --git a/arch/um/include/asm/cache.h b/arch/um/include/asm/cache.h
new file mode 100644
index 000000000000..19e1bdd67416
--- /dev/null
+++ b/arch/um/include/asm/cache.h
@@ -0,0 +1,17 @@
1#ifndef __UM_CACHE_H
2#define __UM_CACHE_H
3
4
5#if defined(CONFIG_UML_X86) && !defined(CONFIG_64BIT)
6# define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
7#elif defined(CONFIG_UML_X86) /* 64-bit */
8# define L1_CACHE_SHIFT 6 /* Should be 7 on Intel */
9#else
10/* XXX: this was taken from x86, now it's completely random. Luckily only
11 * affects SMP padding. */
12# define L1_CACHE_SHIFT 5
13#endif
14
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#endif
diff --git a/arch/um/include/asm/checksum.h b/arch/um/include/asm/checksum.h
new file mode 100644
index 000000000000..5b501361e361
--- /dev/null
+++ b/arch/um/include/asm/checksum.h
@@ -0,0 +1,6 @@
1#ifndef __UM_CHECKSUM_H
2#define __UM_CHECKSUM_H
3
4#include "sysdep/checksum.h"
5
6#endif
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
new file mode 100644
index 000000000000..cb0248616d49
--- /dev/null
+++ b/arch/um/include/asm/common.lds.S
@@ -0,0 +1,130 @@
1#include <asm-generic/vmlinux.lds.h>
2
3 .fini : { *(.fini) } =0x9090
4 _etext = .;
5 PROVIDE (etext = .);
6
7 . = ALIGN(4096);
8 _sdata = .;
9 PROVIDE (sdata = .);
10
11 RODATA
12
13 .unprotected : { *(.unprotected) }
14 . = ALIGN(4096);
15 PROVIDE (_unprotected_end = .);
16
17 . = ALIGN(4096);
18 .note : { *(.note.*) }
19 __ex_table : {
20 __start___ex_table = .;
21 *(__ex_table)
22 __stop___ex_table = .;
23 }
24
25 BUG_TABLE
26
27 .uml.setup.init : {
28 __uml_setup_start = .;
29 *(.uml.setup.init)
30 __uml_setup_end = .;
31 }
32
33 .uml.help.init : {
34 __uml_help_start = .;
35 *(.uml.help.init)
36 __uml_help_end = .;
37 }
38
39 .uml.postsetup.init : {
40 __uml_postsetup_start = .;
41 *(.uml.postsetup.init)
42 __uml_postsetup_end = .;
43 }
44
45 .init.setup : {
46 __setup_start = .;
47 *(.init.setup)
48 __setup_end = .;
49 }
50
51 . = ALIGN(32);
52 .data.percpu : {
53 __per_cpu_start = . ;
54 *(.data.percpu)
55 __per_cpu_end = . ;
56 }
57
58 .initcall.init : {
59 __initcall_start = .;
60 INITCALLS
61 __initcall_end = .;
62 }
63
64 .con_initcall.init : {
65 __con_initcall_start = .;
66 *(.con_initcall.init)
67 __con_initcall_end = .;
68 }
69
70 .uml.initcall.init : {
71 __uml_initcall_start = .;
72 *(.uml.initcall.init)
73 __uml_initcall_end = .;
74 }
75 __init_end = .;
76
77 SECURITY_INIT
78
79 .exitcall : {
80 __exitcall_begin = .;
81 *(.exitcall.exit)
82 __exitcall_end = .;
83 }
84
85 .uml.exitcall : {
86 __uml_exitcall_begin = .;
87 *(.uml.exitcall.exit)
88 __uml_exitcall_end = .;
89 }
90
91 . = ALIGN(4);
92 .altinstructions : {
93 __alt_instructions = .;
94 *(.altinstructions)
95 __alt_instructions_end = .;
96 }
97 .altinstr_replacement : { *(.altinstr_replacement) }
98 /* .exit.text is discard at runtime, not link time, to deal with references
99 from .altinstructions and .eh_frame */
100 .exit.text : { *(.exit.text) }
101 .exit.data : { *(.exit.data) }
102
103 .preinit_array : {
104 __preinit_array_start = .;
105 *(.preinit_array)
106 __preinit_array_end = .;
107 }
108 .init_array : {
109 __init_array_start = .;
110 *(.init_array)
111 __init_array_end = .;
112 }
113 .fini_array : {
114 __fini_array_start = .;
115 *(.fini_array)
116 __fini_array_end = .;
117 }
118
119 . = ALIGN(4096);
120 .init.ramfs : {
121 __initramfs_start = .;
122 *(.init.ramfs)
123 __initramfs_end = .;
124 }
125
126 /* Sections to be discarded */
127 /DISCARD/ : {
128 *(.exitcall.exit)
129 }
130
diff --git a/arch/um/include/asm/cputime.h b/arch/um/include/asm/cputime.h
new file mode 100644
index 000000000000..c84acbadfa2f
--- /dev/null
+++ b/arch/um/include/asm/cputime.h
@@ -0,0 +1,6 @@
1#ifndef __UM_CPUTIME_H
2#define __UM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __UM_CPUTIME_H */
diff --git a/arch/um/include/asm/current.h b/arch/um/include/asm/current.h
new file mode 100644
index 000000000000..c2191d9aa03d
--- /dev/null
+++ b/arch/um/include/asm/current.h
@@ -0,0 +1,13 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_CURRENT_H
7#define __UM_CURRENT_H
8
9#include "linux/thread_info.h"
10
11#define current (current_thread_info()->task)
12
13#endif
diff --git a/arch/um/include/asm/delay.h b/arch/um/include/asm/delay.h
new file mode 100644
index 000000000000..c71e32b6741e
--- /dev/null
+++ b/arch/um/include/asm/delay.h
@@ -0,0 +1,20 @@
1#ifndef __UM_DELAY_H
2#define __UM_DELAY_H
3
4#define MILLION 1000000
5
6/* Undefined on purpose */
7extern void __bad_udelay(void);
8
9extern void __udelay(unsigned long usecs);
10extern void __delay(unsigned long loops);
11
12#define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
13 __bad_udelay() : __udelay(n))
14
15/* It appears that ndelay is not used at all for UML, and has never been
16 * implemented. */
17extern void __unimplemented_ndelay(void);
18#define ndelay(n) __unimplemented_ndelay()
19
20#endif
diff --git a/arch/um/include/asm/desc.h b/arch/um/include/asm/desc.h
new file mode 100644
index 000000000000..4ec34a51b62c
--- /dev/null
+++ b/arch/um/include/asm/desc.h
@@ -0,0 +1,16 @@
1#ifndef __UM_DESC_H
2#define __UM_DESC_H
3
4/* Taken from asm-i386/desc.h, it's the only thing we need. The rest wouldn't
5 * compile, and has never been used. */
6#define LDT_empty(info) (\
7 (info)->base_addr == 0 && \
8 (info)->limit == 0 && \
9 (info)->contents == 0 && \
10 (info)->read_exec_only == 1 && \
11 (info)->seg_32bit == 0 && \
12 (info)->limit_in_pages == 0 && \
13 (info)->seg_not_present == 1 && \
14 (info)->useable == 0 )
15
16#endif
diff --git a/arch/um/include/asm/device.h b/arch/um/include/asm/device.h
new file mode 100644
index 000000000000..d8f9872b0e2d
--- /dev/null
+++ b/arch/um/include/asm/device.h
@@ -0,0 +1,7 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/arch/um/include/asm/dma-mapping.h b/arch/um/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..90fc708b320e
--- /dev/null
+++ b/arch/um/include/asm/dma-mapping.h
@@ -0,0 +1,128 @@
1#ifndef _ASM_DMA_MAPPING_H
2#define _ASM_DMA_MAPPING_H
3
4#include <asm/scatterlist.h>
5
6static inline int
7dma_supported(struct device *dev, u64 mask)
8{
9 BUG();
10 return(0);
11}
12
13static inline int
14dma_set_mask(struct device *dev, u64 dma_mask)
15{
16 BUG();
17 return(0);
18}
19
20static inline void *
21dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
22 gfp_t flag)
23{
24 BUG();
25 return((void *) 0);
26}
27
28static inline void
29dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
30 dma_addr_t dma_handle)
31{
32 BUG();
33}
34
35static inline dma_addr_t
36dma_map_single(struct device *dev, void *cpu_addr, size_t size,
37 enum dma_data_direction direction)
38{
39 BUG();
40 return(0);
41}
42
43static inline void
44dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
45 enum dma_data_direction direction)
46{
47 BUG();
48}
49
50static inline dma_addr_t
51dma_map_page(struct device *dev, struct page *page,
52 unsigned long offset, size_t size,
53 enum dma_data_direction direction)
54{
55 BUG();
56 return(0);
57}
58
59static inline void
60dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
61 enum dma_data_direction direction)
62{
63 BUG();
64}
65
66static inline int
67dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
68 enum dma_data_direction direction)
69{
70 BUG();
71 return(0);
72}
73
74static inline void
75dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
76 enum dma_data_direction direction)
77{
78 BUG();
79}
80
81static inline void
82dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size,
83 enum dma_data_direction direction)
84{
85 BUG();
86}
87
88static inline void
89dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
90 enum dma_data_direction direction)
91{
92 BUG();
93}
94
95#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
96#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
97#define dma_is_consistent(d, h) (1)
98
99static inline int
100dma_get_cache_alignment(void)
101{
102 BUG();
103 return(0);
104}
105
106static inline void
107dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
108 unsigned long offset, size_t size,
109 enum dma_data_direction direction)
110{
111 BUG();
112}
113
114static inline void
115dma_cache_sync(struct device *dev, void *vaddr, size_t size,
116 enum dma_data_direction direction)
117{
118 BUG();
119}
120
121static inline int
122dma_mapping_error(struct device *dev, dma_addr_t dma_handle)
123{
124 BUG();
125 return 0;
126}
127
128#endif
diff --git a/arch/um/include/asm/dma.h b/arch/um/include/asm/dma.h
new file mode 100644
index 000000000000..9f6139a8a525
--- /dev/null
+++ b/arch/um/include/asm/dma.h
@@ -0,0 +1,10 @@
1#ifndef __UM_DMA_H
2#define __UM_DMA_H
3
4#include "asm/io.h"
5
6extern unsigned long uml_physmem;
7
8#define MAX_DMA_ADDRESS (uml_physmem)
9
10#endif
diff --git a/arch/um/include/asm/emergency-restart.h b/arch/um/include/asm/emergency-restart.h
new file mode 100644
index 000000000000..108d8c48e42e
--- /dev/null
+++ b/arch/um/include/asm/emergency-restart.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/um/include/asm/fixmap.h b/arch/um/include/asm/fixmap.h
new file mode 100644
index 000000000000..69c0252345f1
--- /dev/null
+++ b/arch/um/include/asm/fixmap.h
@@ -0,0 +1,99 @@
1#ifndef __UM_FIXMAP_H
2#define __UM_FIXMAP_H
3
4#include <asm/processor.h>
5#include <asm/system.h>
6#include <asm/kmap_types.h>
7#include <asm/archparam.h>
8#include <asm/page.h>
9#include <linux/threads.h>
10
11/*
12 * Here we define all the compile-time 'special' virtual
13 * addresses. The point is to have a constant address at
14 * compile time, but to set the physical address only
15 * in the boot process. We allocate these special addresses
16 * from the end of virtual memory (0xfffff000) backwards.
17 * Also this lets us do fail-safe vmalloc(), we
18 * can guarantee that these special addresses and
19 * vmalloc()-ed addresses never overlap.
20 *
21 * these 'compile-time allocated' memory buffers are
22 * fixed-size 4k pages. (or larger if used with an increment
23 * highger than 1) use fixmap_set(idx,phys) to associate
24 * physical memory with fixmap indices.
25 *
26 * TLB entries of such buffers will not be flushed across
27 * task switches.
28 */
29
30/*
31 * on UP currently we will have no trace of the fixmap mechanizm,
32 * no page table allocations, etc. This might change in the
33 * future, say framebuffers for the console driver(s) could be
34 * fix-mapped?
35 */
36enum fixed_addresses {
37#ifdef CONFIG_HIGHMEM
38 FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
39 FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
40#endif
41 __end_of_fixed_addresses
42};
43
44extern void __set_fixmap (enum fixed_addresses idx,
45 unsigned long phys, pgprot_t flags);
46
47#define set_fixmap(idx, phys) \
48 __set_fixmap(idx, phys, PAGE_KERNEL)
49/*
50 * Some hardware wants to get fixmapped without caching.
51 */
52#define set_fixmap_nocache(idx, phys) \
53 __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)
54/*
55 * used by vmalloc.c.
56 *
57 * Leave one empty page between vmalloc'ed areas and
58 * the start of the fixmap, and leave one page empty
59 * at the top of mem..
60 */
61
62#define FIXADDR_TOP (TASK_SIZE - 2 * PAGE_SIZE)
63#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
64#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
65
66#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
67#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
68
69extern void __this_fixmap_does_not_exist(void);
70
71/*
72 * 'index to address' translation. If anyone tries to use the idx
73 * directly without tranlation, we catch the bug with a NULL-deference
74 * kernel oops. Illegal ranges of incoming indices are caught too.
75 */
76static inline unsigned long fix_to_virt(const unsigned int idx)
77{
78 /*
79 * this branch gets completely eliminated after inlining,
80 * except when someone tries to use fixaddr indices in an
81 * illegal way. (such as mixing up address types or using
82 * out-of-range indices).
83 *
84 * If it doesn't get removed, the linker will complain
85 * loudly with a reasonably clear error message..
86 */
87 if (idx >= __end_of_fixed_addresses)
88 __this_fixmap_does_not_exist();
89
90 return __fix_to_virt(idx);
91}
92
93static inline unsigned long virt_to_fix(const unsigned long vaddr)
94{
95 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
96 return __virt_to_fix(vaddr);
97}
98
99#endif
diff --git a/arch/um/include/asm/futex.h b/arch/um/include/asm/futex.h
new file mode 100644
index 000000000000..6a332a9f099c
--- /dev/null
+++ b/arch/um/include/asm/futex.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#include <asm-generic/futex.h>
5
6#endif
diff --git a/arch/um/include/asm/hardirq.h b/arch/um/include/asm/hardirq.h
new file mode 100644
index 000000000000..313ebb8a2566
--- /dev/null
+++ b/arch/um/include/asm/hardirq.h
@@ -0,0 +1,25 @@
1/* (c) 2004 cw@f00f.org, GPLv2 blah blah */
2
3#ifndef __ASM_UM_HARDIRQ_H
4#define __ASM_UM_HARDIRQ_H
5
6#include <linux/threads.h>
7#include <linux/irq.h>
8
9/* NOTE: When SMP works again we might want to make this
10 * ____cacheline_aligned or maybe use per_cpu state? --cw */
11typedef struct {
12 unsigned int __softirq_pending;
13} irq_cpustat_t;
14
15#include <linux/irq_cpustat.h>
16
17/* As this would be very strange for UML to get we BUG() after the
18 * printk. */
19static inline void ack_bad_irq(unsigned int irq)
20{
21 printk(KERN_ERR "unexpected IRQ %02x\n", irq);
22 BUG();
23}
24
25#endif /* __ASM_UM_HARDIRQ_H */
diff --git a/arch/um/include/asm/hw_irq.h b/arch/um/include/asm/hw_irq.h
new file mode 100644
index 000000000000..1cf84cf5f21a
--- /dev/null
+++ b/arch/um/include/asm/hw_irq.h
@@ -0,0 +1,7 @@
1#ifndef _ASM_UM_HW_IRQ_H
2#define _ASM_UM_HW_IRQ_H
3
4#include "asm/irq.h"
5#include "asm/archparam.h"
6
7#endif
diff --git a/arch/um/include/asm/io.h b/arch/um/include/asm/io.h
new file mode 100644
index 000000000000..44e8b8c772ae
--- /dev/null
+++ b/arch/um/include/asm/io.h
@@ -0,0 +1,57 @@
1#ifndef __UM_IO_H
2#define __UM_IO_H
3
4#include "asm/page.h"
5
6#define IO_SPACE_LIMIT 0xdeadbeef /* Sure hope nothing uses this */
7
8static inline int inb(unsigned long i) { return(0); }
9static inline void outb(char c, unsigned long i) { }
10
11/*
12 * Change virtual addresses to physical addresses and vv.
13 * These are pretty trivial
14 */
15static inline unsigned long virt_to_phys(volatile void * address)
16{
17 return __pa((void *) address);
18}
19
20static inline void * phys_to_virt(unsigned long address)
21{
22 return __va(address);
23}
24
25/*
26 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
27 * access
28 */
29#define xlate_dev_mem_ptr(p) __va(p)
30
31/*
32 * Convert a virtual cached pointer to an uncached pointer
33 */
34#define xlate_dev_kmem_ptr(p) p
35
36static inline void writeb(unsigned char b, volatile void __iomem *addr)
37{
38 *(volatile unsigned char __force *) addr = b;
39}
40static inline void writew(unsigned short b, volatile void __iomem *addr)
41{
42 *(volatile unsigned short __force *) addr = b;
43}
44static inline void writel(unsigned int b, volatile void __iomem *addr)
45{
46 *(volatile unsigned int __force *) addr = b;
47}
48static inline void writeq(unsigned int b, volatile void __iomem *addr)
49{
50 *(volatile unsigned long long __force *) addr = b;
51}
52#define __raw_writeb writeb
53#define __raw_writew writew
54#define __raw_writel writel
55#define __raw_writeq writeq
56
57#endif
diff --git a/arch/um/include/asm/irq.h b/arch/um/include/asm/irq.h
new file mode 100644
index 000000000000..4a2037f8204b
--- /dev/null
+++ b/arch/um/include/asm/irq.h
@@ -0,0 +1,23 @@
1#ifndef __UM_IRQ_H
2#define __UM_IRQ_H
3
4#define TIMER_IRQ 0
5#define UMN_IRQ 1
6#define CONSOLE_IRQ 2
7#define CONSOLE_WRITE_IRQ 3
8#define UBD_IRQ 4
9#define UM_ETH_IRQ 5
10#define SSL_IRQ 6
11#define SSL_WRITE_IRQ 7
12#define ACCEPT_IRQ 8
13#define MCONSOLE_IRQ 9
14#define WINCH_IRQ 10
15#define SIGIO_WRITE_IRQ 11
16#define TELNETD_IRQ 12
17#define XTERM_IRQ 13
18#define RANDOM_IRQ 14
19
20#define LAST_IRQ RANDOM_IRQ
21#define NR_IRQS (LAST_IRQ + 1)
22
23#endif
diff --git a/arch/um/include/asm/irq_regs.h b/arch/um/include/asm/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/arch/um/include/asm/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/arch/um/include/sysdep-ia64/syscalls.h b/arch/um/include/asm/irq_vectors.h
index 4a1f46ef1ebc..62ddba6fc733 100644
--- a/arch/um/include/sysdep-ia64/syscalls.h
+++ b/arch/um/include/asm/irq_vectors.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __SYSDEP_IA64_SYSCALLS_H 6#ifndef __UM_IRQ_VECTORS_H
7#define __SYSDEP_IA64_SYSCALLS_H 7#define __UM_IRQ_VECTORS_H
8 8
9#endif 9#endif
10 10
diff --git a/arch/um/include/asm/irqflags.h b/arch/um/include/asm/irqflags.h
new file mode 100644
index 000000000000..659b9abdfdba
--- /dev/null
+++ b/arch/um/include/asm/irqflags.h
@@ -0,0 +1,6 @@
1#ifndef __UM_IRQFLAGS_H
2#define __UM_IRQFLAGS_H
3
4/* Empty for now */
5
6#endif
diff --git a/arch/um/include/asm/kdebug.h b/arch/um/include/asm/kdebug.h
new file mode 100644
index 000000000000..6ece1b037665
--- /dev/null
+++ b/arch/um/include/asm/kdebug.h
@@ -0,0 +1 @@
#include <asm-generic/kdebug.h>
diff --git a/arch/um/include/asm/kmap_types.h b/arch/um/include/asm/kmap_types.h
new file mode 100644
index 000000000000..6c03acdb4405
--- /dev/null
+++ b/arch/um/include/asm/kmap_types.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_KMAP_TYPES_H
7#define __UM_KMAP_TYPES_H
8
9/* No more #include "asm/arch/kmap_types.h" ! */
10
11enum km_type {
12 KM_BOUNCE_READ,
13 KM_SKB_SUNRPC_DATA,
14 KM_SKB_DATA_SOFTIRQ,
15 KM_USER0,
16 KM_USER1,
17 KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
18 KM_BIO_SRC_IRQ,
19 KM_BIO_DST_IRQ,
20 KM_PTE0,
21 KM_PTE1,
22 KM_IRQ0,
23 KM_IRQ1,
24 KM_SOFTIRQ0,
25 KM_SOFTIRQ1,
26 KM_TYPE_NR
27};
28
29#endif
diff --git a/arch/um/include/sysdep-ia64/sigcontext.h b/arch/um/include/asm/mmu.h
index f15fb25260ba..2cf35c21d694 100644
--- a/arch/um/include/sysdep-ia64/sigcontext.h
+++ b/arch/um/include/asm/mmu.h
@@ -1,10 +1,12 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#ifndef __SYSDEP_IA64_SIGCONTEXT_H 6#ifndef __MMU_H
7#define __SYSDEP_IA64_SIGCONTEXT_H 7#define __MMU_H
8
9#include "um_mmu.h"
8 10
9#endif 11#endif
10 12
diff --git a/arch/um/include/asm/mmu_context.h b/arch/um/include/asm/mmu_context.h
new file mode 100644
index 000000000000..54f42e8b0105
--- /dev/null
+++ b/arch/um/include/asm/mmu_context.h
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_MMU_CONTEXT_H
7#define __UM_MMU_CONTEXT_H
8
9#include "linux/sched.h"
10#include "um_mmu.h"
11
12extern void arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm);
13extern void arch_exit_mmap(struct mm_struct *mm);
14
15#define get_mmu_context(task) do ; while(0)
16#define activate_context(tsk) do ; while(0)
17
18#define deactivate_mm(tsk,mm) do { } while (0)
19
20extern void force_flush_all(void);
21
22static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
23{
24 /*
25 * This is called by fs/exec.c and sys_unshare()
26 * when the new ->mm is used for the first time.
27 */
28 __switch_mm(&new->context.id);
29 arch_dup_mmap(old, new);
30}
31
32static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
33 struct task_struct *tsk)
34{
35 unsigned cpu = smp_processor_id();
36
37 if(prev != next){
38 cpu_clear(cpu, prev->cpu_vm_mask);
39 cpu_set(cpu, next->cpu_vm_mask);
40 if(next != &init_mm)
41 __switch_mm(&next->context.id);
42 }
43}
44
45static inline void enter_lazy_tlb(struct mm_struct *mm,
46 struct task_struct *tsk)
47{
48}
49
50extern int init_new_context(struct task_struct *task, struct mm_struct *mm);
51
52extern void destroy_context(struct mm_struct *mm);
53
54#endif
diff --git a/arch/um/include/asm/mutex.h b/arch/um/include/asm/mutex.h
new file mode 100644
index 000000000000..458c1f7fbc18
--- /dev/null
+++ b/arch/um/include/asm/mutex.h
@@ -0,0 +1,9 @@
1/*
2 * Pull in the generic implementation for the mutex fastpath.
3 *
4 * TODO: implement optimized primitives instead, or leave the generic
5 * implementation in place, or pick the atomic_xchg() based generic
6 * implementation. (see asm-generic/mutex-xchg.h for details)
7 */
8
9#include <asm-generic/mutex-dec.h>
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h
new file mode 100644
index 000000000000..55f28a0bae6d
--- /dev/null
+++ b/arch/um/include/asm/page.h
@@ -0,0 +1,122 @@
1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PAGE_H
8#define __UM_PAGE_H
9
10#include <linux/const.h>
11
12/* PAGE_SHIFT determines the page size */
13#define PAGE_SHIFT 12
14#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
15#define PAGE_MASK (~(PAGE_SIZE-1))
16
17#ifndef __ASSEMBLY__
18
19struct page;
20
21#include <linux/types.h>
22#include <sysdep/vm-flags.h>
23
24/*
25 * These are used to make use of C type-checking..
26 */
27
28#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
29#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
30
31#define clear_user_page(page, vaddr, pg) clear_page(page)
32#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
33
34#if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64BIT)
35
36typedef struct { unsigned long pte_low, pte_high; } pte_t;
37typedef struct { unsigned long pmd; } pmd_t;
38typedef struct { unsigned long pgd; } pgd_t;
39#define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32))
40
41#define pte_get_bits(pte, bits) ((pte).pte_low & (bits))
42#define pte_set_bits(pte, bits) ((pte).pte_low |= (bits))
43#define pte_clear_bits(pte, bits) ((pte).pte_low &= ~(bits))
44#define pte_copy(to, from) ({ (to).pte_high = (from).pte_high; \
45 smp_wmb(); \
46 (to).pte_low = (from).pte_low; })
47#define pte_is_zero(pte) (!((pte).pte_low & ~_PAGE_NEWPAGE) && !(pte).pte_high)
48#define pte_set_val(pte, phys, prot) \
49 ({ (pte).pte_high = (phys) >> 32; \
50 (pte).pte_low = (phys) | pgprot_val(prot); })
51
52#define pmd_val(x) ((x).pmd)
53#define __pmd(x) ((pmd_t) { (x) } )
54
55typedef unsigned long long pfn_t;
56typedef unsigned long long phys_t;
57
58#else
59
60typedef struct { unsigned long pte; } pte_t;
61typedef struct { unsigned long pgd; } pgd_t;
62
63#ifdef CONFIG_3_LEVEL_PGTABLES
64typedef struct { unsigned long pmd; } pmd_t;
65#define pmd_val(x) ((x).pmd)
66#define __pmd(x) ((pmd_t) { (x) } )
67#endif
68
69#define pte_val(x) ((x).pte)
70
71
72#define pte_get_bits(p, bits) ((p).pte & (bits))
73#define pte_set_bits(p, bits) ((p).pte |= (bits))
74#define pte_clear_bits(p, bits) ((p).pte &= ~(bits))
75#define pte_copy(to, from) ((to).pte = (from).pte)
76#define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE))
77#define pte_set_val(p, phys, prot) (p).pte = (phys | pgprot_val(prot))
78
79typedef unsigned long pfn_t;
80typedef unsigned long phys_t;
81
82#endif
83
84typedef struct { unsigned long pgprot; } pgprot_t;
85
86typedef struct page *pgtable_t;
87
88#define pgd_val(x) ((x).pgd)
89#define pgprot_val(x) ((x).pgprot)
90
91#define __pte(x) ((pte_t) { (x) } )
92#define __pgd(x) ((pgd_t) { (x) } )
93#define __pgprot(x) ((pgprot_t) { (x) } )
94
95extern unsigned long uml_physmem;
96
97#define PAGE_OFFSET (uml_physmem)
98#define KERNELBASE PAGE_OFFSET
99
100#define __va_space (8*1024*1024)
101
102#include "mem.h"
103
104/* Cast to unsigned long before casting to void * to avoid a warning from
105 * mmap_kmem about cutting a long long down to a void *. Not sure that
106 * casting is the right thing, but 32-bit UML can't have 64-bit virtual
107 * addresses
108 */
109#define __pa(virt) to_phys((void *) (unsigned long) (virt))
110#define __va(phys) to_virt((unsigned long) (phys))
111
112#define phys_to_pfn(p) ((pfn_t) ((p) >> PAGE_SHIFT))
113#define pfn_to_phys(pfn) ((phys_t) ((pfn) << PAGE_SHIFT))
114
115#define pfn_valid(pfn) ((pfn) < max_mapnr)
116#define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
117
118#include <asm-generic/memory_model.h>
119#include <asm-generic/page.h>
120
121#endif /* __ASSEMBLY__ */
122#endif /* __UM_PAGE_H */
diff --git a/arch/um/include/asm/page_offset.h b/arch/um/include/asm/page_offset.h
new file mode 100644
index 000000000000..1c168dfbf359
--- /dev/null
+++ b/arch/um/include/asm/page_offset.h
@@ -0,0 +1 @@
#define PAGE_OFFSET_RAW (uml_physmem)
diff --git a/arch/um/include/asm/param.h b/arch/um/include/asm/param.h
new file mode 100644
index 000000000000..e44f4e60d16d
--- /dev/null
+++ b/arch/um/include/asm/param.h
@@ -0,0 +1,20 @@
1#ifndef _UM_PARAM_H
2#define _UM_PARAM_H
3
4#define EXEC_PAGESIZE 4096
5
6#ifndef NOGROUP
7#define NOGROUP (-1)
8#endif
9
10#define MAXHOSTNAMELEN 64 /* max length of hostname */
11
12#ifdef __KERNEL__
13#define HZ CONFIG_HZ
14#define USER_HZ 100 /* .. some user interfaces are in "ticks" */
15#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
16#else
17#define HZ 100
18#endif
19
20#endif
diff --git a/arch/um/include/asm/pci.h b/arch/um/include/asm/pci.h
new file mode 100644
index 000000000000..59923199cdc3
--- /dev/null
+++ b/arch/um/include/asm/pci.h
@@ -0,0 +1,7 @@
1#ifndef __UM_PCI_H
2#define __UM_PCI_H
3
4#define PCI_DMA_BUS_IS_PHYS (1)
5#define pcibios_scan_all_fns(a, b) 0
6
7#endif
diff --git a/arch/um/include/sysdep-ia64/ptrace.h b/arch/um/include/asm/pda.h
index 42dd8fb6f2f9..0d8bf33ffd42 100644
--- a/arch/um/include/sysdep-ia64/ptrace.h
+++ b/arch/um/include/asm/pda.h
@@ -1,16 +1,21 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright 2003 PathScale, Inc.
3 *
3 * Licensed under the GPL 4 * Licensed under the GPL
4 */ 5 */
5 6
6#ifndef __SYSDEP_IA64_PTRACE_H 7#ifndef __UM_PDA_X86_64_H
7#define __SYSDEP_IA64_PTRACE_H 8#define __UM_PDA_X86_64_H
8 9
9struct sys_pt_regs { 10/* XXX */
10 int foo; 11struct foo {
12 unsigned int __softirq_pending;
13 unsigned int __nmi_count;
11}; 14};
12 15
13#define EMPTY_REGS { 0 } 16extern struct foo me;
17
18#define read_pda(me) (&me)
14 19
15#endif 20#endif
16 21
diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h
new file mode 100644
index 000000000000..9062a6e72241
--- /dev/null
+++ b/arch/um/include/asm/pgalloc.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
5 * Licensed under the GPL
6 */
7
8#ifndef __UM_PGALLOC_H
9#define __UM_PGALLOC_H
10
11#include "linux/mm.h"
12#include "asm/fixmap.h"
13
14#define pmd_populate_kernel(mm, pmd, pte) \
15 set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
16
17#define pmd_populate(mm, pmd, pte) \
18 set_pmd(pmd, __pmd(_PAGE_TABLE + \
19 ((unsigned long long)page_to_pfn(pte) << \
20 (unsigned long long) PAGE_SHIFT)))
21#define pmd_pgtable(pmd) pmd_page(pmd)
22
23/*
24 * Allocate and free page tables.
25 */
26extern pgd_t *pgd_alloc(struct mm_struct *);
27extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
28
29extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
30extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
31
32static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
33{
34 free_page((unsigned long) pte);
35}
36
37static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
38{
39 pgtable_page_dtor(pte);
40 __free_page(pte);
41}
42
43#define __pte_free_tlb(tlb,pte) \
44do { \
45 pgtable_page_dtor(pte); \
46 tlb_remove_page((tlb),(pte)); \
47} while (0)
48
49#ifdef CONFIG_3_LEVEL_PGTABLES
50
51static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
52{
53 free_page((unsigned long)pmd);
54}
55
56#define __pmd_free_tlb(tlb,x) tlb_remove_page((tlb),virt_to_page(x))
57#endif
58
59#define check_pgt_cache() do { } while (0)
60
61#endif
62
63/*
64 * Overrides for Emacs so that we follow Linus's tabbing style.
65 * Emacs will notice this stuff at the end of the file and automatically
66 * adjust the settings for this buffer only. This must remain at the end
67 * of the file.
68 * ---------------------------------------------------------------------------
69 * Local variables:
70 * c-file-style: "linux"
71 * End:
72 */
diff --git a/arch/um/include/asm/pgtable-2level.h b/arch/um/include/asm/pgtable-2level.h
new file mode 100644
index 000000000000..f534b73e753e
--- /dev/null
+++ b/arch/um/include/asm/pgtable-2level.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgtable.h
5 * Licensed under the GPL
6 */
7
8#ifndef __UM_PGTABLE_2LEVEL_H
9#define __UM_PGTABLE_2LEVEL_H
10
11#include <asm-generic/pgtable-nopmd.h>
12
13/* PGDIR_SHIFT determines what a third-level page table entry can map */
14
15#define PGDIR_SHIFT 22
16#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
17#define PGDIR_MASK (~(PGDIR_SIZE-1))
18
19/*
20 * entries per page directory level: the i386 is two-level, so
21 * we don't really have any PMD directory physically.
22 */
23#define PTRS_PER_PTE 1024
24#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
25#define PTRS_PER_PGD 1024
26#define FIRST_USER_ADDRESS 0
27
28#define pte_ERROR(e) \
29 printk("%s:%d: bad pte %p(%08lx).\n", __FILE__, __LINE__, &(e), \
30 pte_val(e))
31#define pgd_ERROR(e) \
32 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), \
33 pgd_val(e))
34
35static inline int pgd_newpage(pgd_t pgd) { return 0; }
36static inline void pgd_mkuptodate(pgd_t pgd) { }
37
38#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
39
40#define pte_pfn(x) phys_to_pfn(pte_val(x))
41#define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
42#define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
43
44/*
45 * Bits 0 through 4 are taken
46 */
47#define PTE_FILE_MAX_BITS 27
48
49#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
50
51#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
52
53#endif
diff --git a/arch/um/include/asm/pgtable-3level.h b/arch/um/include/asm/pgtable-3level.h
new file mode 100644
index 000000000000..0446f456b428
--- /dev/null
+++ b/arch/um/include/asm/pgtable-3level.h
@@ -0,0 +1,146 @@
1/*
2 * Copyright 2003 PathScale Inc
3 * Derived from include/asm-i386/pgtable.h
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_PGTABLE_3LEVEL_H
8#define __UM_PGTABLE_3LEVEL_H
9
10#include <asm-generic/pgtable-nopud.h>
11
12/* PGDIR_SHIFT determines what a third-level page table entry can map */
13
14#ifdef CONFIG_64BIT
15#define PGDIR_SHIFT 30
16#else
17#define PGDIR_SHIFT 31
18#endif
19#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
20#define PGDIR_MASK (~(PGDIR_SIZE-1))
21
22/* PMD_SHIFT determines the size of the area a second-level page table can
23 * map
24 */
25
26#define PMD_SHIFT 21
27#define PMD_SIZE (1UL << PMD_SHIFT)
28#define PMD_MASK (~(PMD_SIZE-1))
29
30/*
31 * entries per page directory level
32 */
33
34#define PTRS_PER_PTE 512
35#ifdef CONFIG_64BIT
36#define PTRS_PER_PMD 512
37#define PTRS_PER_PGD 512
38#else
39#define PTRS_PER_PMD 1024
40#define PTRS_PER_PGD 1024
41#endif
42
43#define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE)
44#define FIRST_USER_ADDRESS 0
45
46#define pte_ERROR(e) \
47 printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), \
48 pte_val(e))
49#define pmd_ERROR(e) \
50 printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), \
51 pmd_val(e))
52#define pgd_ERROR(e) \
53 printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), \
54 pgd_val(e))
55
56#define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE))
57#define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
58#define pud_present(x) (pud_val(x) & _PAGE_PRESENT)
59#define pud_populate(mm, pud, pmd) \
60 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
61
62#ifdef CONFIG_64BIT
63#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval))
64#else
65#define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
66#endif
67
68static inline int pgd_newpage(pgd_t pgd)
69{
70 return(pgd_val(pgd) & _PAGE_NEWPAGE);
71}
72
73static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
74
75#ifdef CONFIG_64BIT
76#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
77#else
78#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
79#endif
80
81struct mm_struct;
82extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
83
84static inline void pud_clear (pud_t *pud)
85{
86 set_pud(pud, __pud(_PAGE_NEWPAGE));
87}
88
89#define pud_page(pud) phys_to_page(pud_val(pud) & PAGE_MASK)
90#define pud_page_vaddr(pud) ((unsigned long) __va(pud_val(pud) & PAGE_MASK))
91
92/* Find an entry in the second-level page table.. */
93#define pmd_offset(pud, address) ((pmd_t *) pud_page_vaddr(*(pud)) + \
94 pmd_index(address))
95
96static inline unsigned long pte_pfn(pte_t pte)
97{
98 return phys_to_pfn(pte_val(pte));
99}
100
101static inline pte_t pfn_pte(pfn_t page_nr, pgprot_t pgprot)
102{
103 pte_t pte;
104 phys_t phys = pfn_to_phys(page_nr);
105
106 pte_set_val(pte, phys, pgprot);
107 return pte;
108}
109
110static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot)
111{
112 return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot));
113}
114
115/*
116 * Bits 0 through 3 are taken in the low part of the pte,
117 * put the 32 bits of offset into the high part.
118 */
119#define PTE_FILE_MAX_BITS 32
120
121#ifdef CONFIG_64BIT
122
123#define pte_to_pgoff(p) ((p).pte >> 32)
124
125#define pgoff_to_pte(off) ((pte_t) { ((off) << 32) | _PAGE_FILE })
126
127#else
128
129#define pte_to_pgoff(pte) ((pte).pte_high)
130
131#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
132
133#endif
134
135#endif
136
137/*
138 * Overrides for Emacs so that we follow Linus's tabbing style.
139 * Emacs will notice this stuff at the end of the file and automatically
140 * adjust the settings for this buffer only. This must remain at the end
141 * of the file.
142 * ---------------------------------------------------------------------------
143 * Local variables:
144 * c-file-style: "linux"
145 * End:
146 */
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
new file mode 100644
index 000000000000..58da2480a7f4
--- /dev/null
+++ b/arch/um/include/asm/pgtable.h
@@ -0,0 +1,366 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Copyright 2003 PathScale, Inc.
4 * Derived from include/asm-i386/pgtable.h
5 * Licensed under the GPL
6 */
7
8#ifndef __UM_PGTABLE_H
9#define __UM_PGTABLE_H
10
11#include <asm/fixmap.h>
12
13#define _PAGE_PRESENT 0x001
14#define _PAGE_NEWPAGE 0x002
15#define _PAGE_NEWPROT 0x004
16#define _PAGE_RW 0x020
17#define _PAGE_USER 0x040
18#define _PAGE_ACCESSED 0x080
19#define _PAGE_DIRTY 0x100
20/* If _PAGE_PRESENT is clear, we use these: */
21#define _PAGE_FILE 0x008 /* nonlinear file mapping, saved PTE; unset:swap */
22#define _PAGE_PROTNONE 0x010 /* if the user mapped it with PROT_NONE;
23 pte_present gives true */
24
25#ifdef CONFIG_3_LEVEL_PGTABLES
26#include "asm/pgtable-3level.h"
27#else
28#include "asm/pgtable-2level.h"
29#endif
30
31extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
32
33/* zero page used for uninitialized stuff */
34extern unsigned long *empty_zero_page;
35
36#define pgtable_cache_init() do ; while (0)
37
38/* Just any arbitrary offset to the start of the vmalloc VM area: the
39 * current 8MB value just means that there will be a 8MB "hole" after the
40 * physical memory until the kernel virtual memory starts. That means that
41 * any out-of-bounds memory accesses will hopefully be caught.
42 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
43 * area for the same reason. ;)
44 */
45
46extern unsigned long end_iomem;
47
48#define VMALLOC_OFFSET (__va_space)
49#define VMALLOC_START ((end_iomem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
50#define PKMAP_BASE ((FIXADDR_START - LAST_PKMAP * PAGE_SIZE) & PMD_MASK)
51#ifdef CONFIG_HIGHMEM
52# define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE)
53#else
54# define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE)
55#endif
56
57#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
58#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
59#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
60
61#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED)
62#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)
63#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
64#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
65#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
66
67/*
68 * The i386 can't do page protection for execute, and considers that the same
69 * are read.
70 * Also, write permissions imply read permissions. This is the closest we can
71 * get..
72 */
73#define __P000 PAGE_NONE
74#define __P001 PAGE_READONLY
75#define __P010 PAGE_COPY
76#define __P011 PAGE_COPY
77#define __P100 PAGE_READONLY
78#define __P101 PAGE_READONLY
79#define __P110 PAGE_COPY
80#define __P111 PAGE_COPY
81
82#define __S000 PAGE_NONE
83#define __S001 PAGE_READONLY
84#define __S010 PAGE_SHARED
85#define __S011 PAGE_SHARED
86#define __S100 PAGE_READONLY
87#define __S101 PAGE_READONLY
88#define __S110 PAGE_SHARED
89#define __S111 PAGE_SHARED
90
91/*
92 * ZERO_PAGE is a global shared page that is always zero: used
93 * for zero-mapped memory areas etc..
94 */
95#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
96
97#define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE))
98
99#define pmd_none(x) (!((unsigned long)pmd_val(x) & ~_PAGE_NEWPAGE))
100#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
101
102#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
103#define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0)
104
105#define pmd_newpage(x) (pmd_val(x) & _PAGE_NEWPAGE)
106#define pmd_mkuptodate(x) (pmd_val(x) &= ~_PAGE_NEWPAGE)
107
108#define pud_newpage(x) (pud_val(x) & _PAGE_NEWPAGE)
109#define pud_mkuptodate(x) (pud_val(x) &= ~_PAGE_NEWPAGE)
110
111#define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK)
112
113#define pte_page(x) pfn_to_page(pte_pfn(x))
114
115#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE))
116
117/*
118 * =================================
119 * Flags checking section.
120 * =================================
121 */
122
123static inline int pte_none(pte_t pte)
124{
125 return pte_is_zero(pte);
126}
127
128/*
129 * The following only work if pte_present() is true.
130 * Undefined behaviour if not..
131 */
132static inline int pte_read(pte_t pte)
133{
134 return((pte_get_bits(pte, _PAGE_USER)) &&
135 !(pte_get_bits(pte, _PAGE_PROTNONE)));
136}
137
138static inline int pte_exec(pte_t pte){
139 return((pte_get_bits(pte, _PAGE_USER)) &&
140 !(pte_get_bits(pte, _PAGE_PROTNONE)));
141}
142
143static inline int pte_write(pte_t pte)
144{
145 return((pte_get_bits(pte, _PAGE_RW)) &&
146 !(pte_get_bits(pte, _PAGE_PROTNONE)));
147}
148
149/*
150 * The following only works if pte_present() is not true.
151 */
152static inline int pte_file(pte_t pte)
153{
154 return pte_get_bits(pte, _PAGE_FILE);
155}
156
157static inline int pte_dirty(pte_t pte)
158{
159 return pte_get_bits(pte, _PAGE_DIRTY);
160}
161
162static inline int pte_young(pte_t pte)
163{
164 return pte_get_bits(pte, _PAGE_ACCESSED);
165}
166
167static inline int pte_newpage(pte_t pte)
168{
169 return pte_get_bits(pte, _PAGE_NEWPAGE);
170}
171
172static inline int pte_newprot(pte_t pte)
173{
174 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT)));
175}
176
177static inline int pte_special(pte_t pte)
178{
179 return 0;
180}
181
182/*
183 * =================================
184 * Flags setting section.
185 * =================================
186 */
187
188static inline pte_t pte_mknewprot(pte_t pte)
189{
190 pte_set_bits(pte, _PAGE_NEWPROT);
191 return(pte);
192}
193
194static inline pte_t pte_mkclean(pte_t pte)
195{
196 pte_clear_bits(pte, _PAGE_DIRTY);
197 return(pte);
198}
199
200static inline pte_t pte_mkold(pte_t pte)
201{
202 pte_clear_bits(pte, _PAGE_ACCESSED);
203 return(pte);
204}
205
206static inline pte_t pte_wrprotect(pte_t pte)
207{
208 pte_clear_bits(pte, _PAGE_RW);
209 return(pte_mknewprot(pte));
210}
211
212static inline pte_t pte_mkread(pte_t pte)
213{
214 pte_set_bits(pte, _PAGE_USER);
215 return(pte_mknewprot(pte));
216}
217
218static inline pte_t pte_mkdirty(pte_t pte)
219{
220 pte_set_bits(pte, _PAGE_DIRTY);
221 return(pte);
222}
223
224static inline pte_t pte_mkyoung(pte_t pte)
225{
226 pte_set_bits(pte, _PAGE_ACCESSED);
227 return(pte);
228}
229
230static inline pte_t pte_mkwrite(pte_t pte)
231{
232 pte_set_bits(pte, _PAGE_RW);
233 return(pte_mknewprot(pte));
234}
235
236static inline pte_t pte_mkuptodate(pte_t pte)
237{
238 pte_clear_bits(pte, _PAGE_NEWPAGE);
239 if(pte_present(pte))
240 pte_clear_bits(pte, _PAGE_NEWPROT);
241 return(pte);
242}
243
244static inline pte_t pte_mknewpage(pte_t pte)
245{
246 pte_set_bits(pte, _PAGE_NEWPAGE);
247 return(pte);
248}
249
250static inline pte_t pte_mkspecial(pte_t pte)
251{
252 return(pte);
253}
254
255static inline void set_pte(pte_t *pteptr, pte_t pteval)
256{
257 pte_copy(*pteptr, pteval);
258
259 /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
260 * fix_range knows to unmap it. _PAGE_NEWPROT is specific to
261 * mapped pages.
262 */
263
264 *pteptr = pte_mknewpage(*pteptr);
265 if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
266}
267#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
268
269/*
270 * Conversion functions: convert a page and protection to a page entry,
271 * and a page entry and page directory to the page they refer to.
272 */
273
274#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
275#define __virt_to_page(virt) phys_to_page(__pa(virt))
276#define page_to_phys(page) pfn_to_phys((pfn_t) page_to_pfn(page))
277#define virt_to_page(addr) __virt_to_page((const unsigned long) addr)
278
279#define mk_pte(page, pgprot) \
280 ({ pte_t pte; \
281 \
282 pte_set_val(pte, page_to_phys(page), (pgprot)); \
283 if (pte_present(pte)) \
284 pte_mknewprot(pte_mknewpage(pte)); \
285 pte;})
286
287static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
288{
289 pte_set_val(pte, (pte_val(pte) & _PAGE_CHG_MASK), newprot);
290 return pte;
291}
292
293/*
294 * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
295 *
296 * this macro returns the index of the entry in the pgd page which would
297 * control the given virtual address
298 */
299#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
300
301/*
302 * pgd_offset() returns a (pgd_t *)
303 * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
304 */
305#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
306
307/*
308 * a shortcut which implies the use of the kernel's pgd, instead
309 * of a process's
310 */
311#define pgd_offset_k(address) pgd_offset(&init_mm, address)
312
313/*
314 * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
315 *
316 * this macro returns the index of the entry in the pmd page which would
317 * control the given virtual address
318 */
319#define pmd_page_vaddr(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
320#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
321
322#define pmd_page_vaddr(pmd) \
323 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
324
325/*
326 * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
327 *
328 * this macro returns the index of the entry in the pte page which would
329 * control the given virtual address
330 */
331#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
332#define pte_offset_kernel(dir, address) \
333 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
334#define pte_offset_map(dir, address) \
335 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
336#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
337#define pte_unmap(pte) do { } while (0)
338#define pte_unmap_nested(pte) do { } while (0)
339
340struct mm_struct;
341extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
342
343#define update_mmu_cache(vma,address,pte) do ; while (0)
344
345/* Encode and de-code a swap entry */
346#define __swp_type(x) (((x).val >> 4) & 0x3f)
347#define __swp_offset(x) ((x).val >> 11)
348
349#define __swp_entry(type, offset) \
350 ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
351#define __pte_to_swp_entry(pte) \
352 ((swp_entry_t) { pte_val(pte_mkuptodate(pte)) })
353#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
354
355#define kern_addr_valid(addr) (1)
356
357#include <asm-generic/pgtable.h>
358
359/* Clear a kernel PTE and flush it from the TLB */
360#define kpte_clear_flush(ptep, vaddr) \
361do { \
362 pte_clear(&init_mm, (vaddr), (ptep)); \
363 __flush_tlb_one((vaddr)); \
364} while (0)
365
366#endif
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
new file mode 100644
index 000000000000..bed668824b5f
--- /dev/null
+++ b/arch/um/include/asm/processor-generic.h
@@ -0,0 +1,136 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_PROCESSOR_GENERIC_H
7#define __UM_PROCESSOR_GENERIC_H
8
9struct pt_regs;
10
11struct task_struct;
12
13#include "asm/ptrace.h"
14#include "registers.h"
15#include "sysdep/archsetjmp.h"
16
17struct mm_struct;
18
19struct thread_struct {
20 struct task_struct *saved_task;
21 /*
22 * This flag is set to 1 before calling do_fork (and analyzed in
23 * copy_thread) to mark that we are begin called from userspace (fork /
24 * vfork / clone), and reset to 0 after. It is left to 0 when called
25 * from kernelspace (i.e. kernel_thread() or fork_idle(),
26 * as of 2.6.11).
27 */
28 int forking;
29 struct pt_regs regs;
30 int singlestep_syscall;
31 void *fault_addr;
32 jmp_buf *fault_catcher;
33 struct task_struct *prev_sched;
34 unsigned long temp_stack;
35 jmp_buf *exec_buf;
36 struct arch_thread arch;
37 jmp_buf switch_buf;
38 int mm_count;
39 struct {
40 int op;
41 union {
42 struct {
43 int pid;
44 } fork, exec;
45 struct {
46 int (*proc)(void *);
47 void *arg;
48 } thread;
49 struct {
50 void (*proc)(void *);
51 void *arg;
52 } cb;
53 } u;
54 } request;
55};
56
57#define INIT_THREAD \
58{ \
59 .forking = 0, \
60 .regs = EMPTY_REGS, \
61 .fault_addr = NULL, \
62 .prev_sched = NULL, \
63 .temp_stack = 0, \
64 .exec_buf = NULL, \
65 .arch = INIT_ARCH_THREAD, \
66 .request = { 0 } \
67}
68
69extern struct task_struct *alloc_task_struct(void);
70
71static inline void release_thread(struct task_struct *task)
72{
73}
74
75extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
76
77static inline void prepare_to_copy(struct task_struct *tsk)
78{
79}
80
81
82extern unsigned long thread_saved_pc(struct task_struct *t);
83
84static inline void mm_copy_segments(struct mm_struct *from_mm,
85 struct mm_struct *new_mm)
86{
87}
88
89#define init_stack (init_thread_union.stack)
90
91/*
92 * User space process size: 3GB (default).
93 */
94extern unsigned long task_size;
95
96#define TASK_SIZE (task_size)
97
98#undef STACK_TOP
99#undef STACK_TOP_MAX
100
101extern unsigned long stacksizelim;
102
103#define STACK_ROOM (stacksizelim)
104#define STACK_TOP (TASK_SIZE - 2 * PAGE_SIZE)
105#define STACK_TOP_MAX STACK_TOP
106
107/* This decides where the kernel will search for a free chunk of vm
108 * space during mmap's.
109 */
110#define TASK_UNMAPPED_BASE (0x40000000)
111
112extern void start_thread(struct pt_regs *regs, unsigned long entry,
113 unsigned long stack);
114
115struct cpuinfo_um {
116 unsigned long loops_per_jiffy;
117 int ipi_pipe[2];
118};
119
120extern struct cpuinfo_um boot_cpu_data;
121
122#define my_cpu_data cpu_data[smp_processor_id()]
123
124#ifdef CONFIG_SMP
125extern struct cpuinfo_um cpu_data[];
126#define current_cpu_data cpu_data[smp_processor_id()]
127#else
128#define cpu_data (&boot_cpu_data)
129#define current_cpu_data boot_cpu_data
130#endif
131
132
133#define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
134extern unsigned long get_wchan(struct task_struct *p);
135
136#endif
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h
new file mode 100644
index 000000000000..6c8899013c92
--- /dev/null
+++ b/arch/um/include/asm/ptrace-generic.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_PTRACE_GENERIC_H
7#define __UM_PTRACE_GENERIC_H
8
9#ifndef __ASSEMBLY__
10
11#include <asm/ptrace-abi.h>
12#include <asm/user.h>
13#include "sysdep/ptrace.h"
14
15struct pt_regs {
16 struct uml_pt_regs regs;
17};
18
19#define EMPTY_REGS { .regs = EMPTY_UML_PT_REGS }
20
21#define PT_REGS_IP(r) UPT_IP(&(r)->regs)
22#define PT_REGS_SP(r) UPT_SP(&(r)->regs)
23
24#define PT_REG(r, reg) UPT_REG(&(r)->regs, reg)
25#define PT_REGS_SET(r, reg, val) UPT_SET(&(r)->regs, reg, val)
26
27#define PT_REGS_SET_SYSCALL_RETURN(r, res) \
28 UPT_SET_SYSCALL_RETURN(&(r)->regs, res)
29#define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs)
30
31#define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs)
32
33#define PT_REGS_SC(r) UPT_SC(&(r)->regs)
34
35#define instruction_pointer(regs) PT_REGS_IP(regs)
36
37struct task_struct;
38
39extern long subarch_ptrace(struct task_struct *child, long request, long addr,
40 long data);
41extern unsigned long getreg(struct task_struct *child, int regno);
42extern int putreg(struct task_struct *child, int regno, unsigned long value);
43extern int get_fpregs(struct user_i387_struct __user *buf,
44 struct task_struct *child);
45extern int set_fpregs(struct user_i387_struct __user *buf,
46 struct task_struct *child);
47
48extern void show_regs(struct pt_regs *regs);
49
50extern int arch_copy_tls(struct task_struct *new);
51extern void clear_flushed_tls(struct task_struct *task);
52
53#endif
54
55#endif
diff --git a/arch/um/include/asm/required-features.h b/arch/um/include/asm/required-features.h
new file mode 100644
index 000000000000..dfb967b2d2f3
--- /dev/null
+++ b/arch/um/include/asm/required-features.h
@@ -0,0 +1,9 @@
1#ifndef __UM_REQUIRED_FEATURES_H
2#define __UM_REQUIRED_FEATURES_H
3
4/*
5 * Nothing to see, just need something for the i386 and x86_64 asm
6 * headers to include.
7 */
8
9#endif
diff --git a/arch/um/include/asm/sections.h b/arch/um/include/asm/sections.h
new file mode 100644
index 000000000000..6b0231eefea8
--- /dev/null
+++ b/arch/um/include/asm/sections.h
@@ -0,0 +1,7 @@
1#ifndef _UM_SECTIONS_H
2#define _UM_SECTIONS_H
3
4/* nothing to see, move along */
5#include <asm-generic/sections.h>
6
7#endif
diff --git a/arch/um/include/asm/segment.h b/arch/um/include/asm/segment.h
new file mode 100644
index 000000000000..45183fcd10b6
--- /dev/null
+++ b/arch/um/include/asm/segment.h
@@ -0,0 +1,10 @@
1#ifndef __UM_SEGMENT_H
2#define __UM_SEGMENT_H
3
4extern int host_gdt_entry_tls_min;
5
6#define GDT_ENTRY_TLS_ENTRIES 3
7#define GDT_ENTRY_TLS_MIN host_gdt_entry_tls_min
8#define GDT_ENTRY_TLS_MAX (GDT_ENTRY_TLS_MIN + GDT_ENTRY_TLS_ENTRIES - 1)
9
10#endif
diff --git a/arch/um/include/asm/setup.h b/arch/um/include/asm/setup.h
new file mode 100644
index 000000000000..99f086301f4c
--- /dev/null
+++ b/arch/um/include/asm/setup.h
@@ -0,0 +1,10 @@
1#ifndef SETUP_H_INCLUDED
2#define SETUP_H_INCLUDED
3
4/* POSIX mandated with _POSIX_ARG_MAX that we can rely on 4096 chars in the
5 * command line, so this choice is ok.
6 */
7
8#define COMMAND_LINE_SIZE 4096
9
10#endif /* SETUP_H_INCLUDED */
diff --git a/arch/um/include/asm/smp.h b/arch/um/include/asm/smp.h
new file mode 100644
index 000000000000..f27a96313174
--- /dev/null
+++ b/arch/um/include/asm/smp.h
@@ -0,0 +1,33 @@
1#ifndef __UM_SMP_H
2#define __UM_SMP_H
3
4#ifdef CONFIG_SMP
5
6#include "linux/bitops.h"
7#include "asm/current.h"
8#include "linux/cpumask.h"
9
10#define raw_smp_processor_id() (current_thread->cpu)
11
12#define cpu_logical_map(n) (n)
13#define cpu_number_map(n) (n)
14#define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */
15extern int hard_smp_processor_id(void);
16#define NO_PROC_ID -1
17
18extern int ncpus;
19
20
21static inline void smp_cpus_done(unsigned int maxcpus)
22{
23}
24
25extern struct task_struct *idle_threads[NR_CPUS];
26
27#else
28
29#define hard_smp_processor_id() 0
30
31#endif
32
33#endif
diff --git a/arch/um/include/asm/suspend.h b/arch/um/include/asm/suspend.h
new file mode 100644
index 000000000000..f4e8e007f468
--- /dev/null
+++ b/arch/um/include/asm/suspend.h
@@ -0,0 +1,4 @@
1#ifndef __UM_SUSPEND_H
2#define __UM_SUSPEND_H
3
4#endif
diff --git a/arch/um/include/asm/system.h b/arch/um/include/asm/system.h
new file mode 100644
index 000000000000..ae5f94d6317d
--- /dev/null
+++ b/arch/um/include/asm/system.h
@@ -0,0 +1,35 @@
1#ifndef __UM_SYSTEM_GENERIC_H
2#define __UM_SYSTEM_GENERIC_H
3
4#include "sysdep/system.h"
5
6extern void *switch_to(void *prev, void *next, void *last);
7
8extern int get_signals(void);
9extern int set_signals(int enable);
10extern int get_signals(void);
11extern void block_signals(void);
12extern void unblock_signals(void);
13
14#define raw_local_save_flags(flags) do { typecheck(unsigned long, flags); \
15 (flags) = get_signals(); } while(0)
16#define raw_local_irq_restore(flags) do { typecheck(unsigned long, flags); \
17 set_signals(flags); } while(0)
18
19#define raw_local_irq_save(flags) do { raw_local_save_flags(flags); \
20 raw_local_irq_disable(); } while(0)
21
22#define raw_local_irq_enable() unblock_signals()
23#define raw_local_irq_disable() block_signals()
24
25#define irqs_disabled() \
26({ \
27 unsigned long flags; \
28 raw_local_save_flags(flags); \
29 (flags == 0); \
30})
31
32extern void *_switch_to(void *prev, void *next, void *last);
33#define switch_to(prev, next, last) prev = _switch_to(prev, next, last)
34
35#endif
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h
new file mode 100644
index 000000000000..62274ab9471f
--- /dev/null
+++ b/arch/um/include/asm/thread_info.h
@@ -0,0 +1,83 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_THREAD_INFO_H
7#define __UM_THREAD_INFO_H
8
9#ifndef __ASSEMBLY__
10
11#include <asm/types.h>
12#include <asm/page.h>
13#include <asm/uaccess.h>
14
15struct thread_info {
16 struct task_struct *task; /* main task structure */
17 struct exec_domain *exec_domain; /* execution domain */
18 unsigned long flags; /* low level flags */
19 __u32 cpu; /* current CPU */
20 int preempt_count; /* 0 => preemptable,
21 <0 => BUG */
22 mm_segment_t addr_limit; /* thread address space:
23 0-0xBFFFFFFF for user
24 0-0xFFFFFFFF for kernel */
25 struct restart_block restart_block;
26 struct thread_info *real_thread; /* Points to non-IRQ stack */
27};
28
29#define INIT_THREAD_INFO(tsk) \
30{ \
31 .task = &tsk, \
32 .exec_domain = &default_exec_domain, \
33 .flags = 0, \
34 .cpu = 0, \
35 .preempt_count = 1, \
36 .addr_limit = KERNEL_DS, \
37 .restart_block = { \
38 .fn = do_no_restart_syscall, \
39 }, \
40 .real_thread = NULL, \
41}
42
43#define init_thread_info (init_thread_union.thread_info)
44#define init_stack (init_thread_union.stack)
45
46#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
47/* how to get the thread information struct from C */
48static inline struct thread_info *current_thread_info(void)
49{
50 struct thread_info *ti;
51 unsigned long mask = THREAD_SIZE - 1;
52 ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
53 return ti;
54}
55
56#define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
57
58#endif
59
60#define PREEMPT_ACTIVE 0x10000000
61
62#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
63#define TIF_SIGPENDING 1 /* signal pending */
64#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
65#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
66 * TIF_NEED_RESCHED
67 */
68#define TIF_RESTART_BLOCK 4
69#define TIF_MEMDIE 5
70#define TIF_SYSCALL_AUDIT 6
71#define TIF_RESTORE_SIGMASK 7
72#define TIF_FREEZE 16 /* is freezing for suspend */
73
74#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
75#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
76#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
77#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
78#define _TIF_MEMDIE (1 << TIF_MEMDIE)
79#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
80#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
81#define _TIF_FREEZE (1 << TIF_FREEZE)
82
83#endif
diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h
new file mode 100644
index 000000000000..0f4ada08f748
--- /dev/null
+++ b/arch/um/include/asm/timex.h
@@ -0,0 +1,13 @@
1#ifndef __UM_TIMEX_H
2#define __UM_TIMEX_H
3
4typedef unsigned long cycles_t;
5
6static inline cycles_t get_cycles (void)
7{
8 return 0;
9}
10
11#define CLOCK_TICK_RATE (HZ)
12
13#endif
diff --git a/arch/um/include/asm/tlb.h b/arch/um/include/asm/tlb.h
new file mode 100644
index 000000000000..5240fa1c5e08
--- /dev/null
+++ b/arch/um/include/asm/tlb.h
@@ -0,0 +1,127 @@
1#ifndef __UM_TLB_H
2#define __UM_TLB_H
3
4#include <linux/pagemap.h>
5#include <linux/swap.h>
6#include <asm/percpu.h>
7#include <asm/pgalloc.h>
8#include <asm/tlbflush.h>
9
10#define tlb_start_vma(tlb, vma) do { } while (0)
11#define tlb_end_vma(tlb, vma) do { } while (0)
12#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
13
14/* struct mmu_gather is an opaque type used by the mm code for passing around
15 * any data needed by arch specific code for tlb_remove_page.
16 */
17struct mmu_gather {
18 struct mm_struct *mm;
19 unsigned int need_flush; /* Really unmapped some ptes? */
20 unsigned long start;
21 unsigned long end;
22 unsigned int fullmm; /* non-zero means full mm flush */
23};
24
25/* Users of the generic TLB shootdown code must declare this storage space. */
26DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
27
28static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
29 unsigned long address)
30{
31 if (tlb->start > address)
32 tlb->start = address;
33 if (tlb->end < address + PAGE_SIZE)
34 tlb->end = address + PAGE_SIZE;
35}
36
37static inline void init_tlb_gather(struct mmu_gather *tlb)
38{
39 tlb->need_flush = 0;
40
41 tlb->start = TASK_SIZE;
42 tlb->end = 0;
43
44 if (tlb->fullmm) {
45 tlb->start = 0;
46 tlb->end = TASK_SIZE;
47 }
48}
49
50/* tlb_gather_mmu
51 * Return a pointer to an initialized struct mmu_gather.
52 */
53static inline struct mmu_gather *
54tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
55{
56 struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
57
58 tlb->mm = mm;
59 tlb->fullmm = full_mm_flush;
60
61 init_tlb_gather(tlb);
62
63 return tlb;
64}
65
66extern void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
67 unsigned long end);
68
69static inline void
70tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
71{
72 if (!tlb->need_flush)
73 return;
74
75 flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end);
76 init_tlb_gather(tlb);
77}
78
79/* tlb_finish_mmu
80 * Called at the end of the shootdown operation to free up any resources
81 * that were required.
82 */
83static inline void
84tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
85{
86 tlb_flush_mmu(tlb, start, end);
87
88 /* keep the page table cache within bounds */
89 check_pgt_cache();
90
91 put_cpu_var(mmu_gathers);
92}
93
94/* tlb_remove_page
95 * Must perform the equivalent to __free_pte(pte_get_and_clear(ptep)),
96 * while handling the additional races in SMP caused by other CPUs
97 * caching valid mappings in their TLBs.
98 */
99static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
100{
101 tlb->need_flush = 1;
102 free_page_and_swap_cache(page);
103 return;
104}
105
106/**
107 * tlb_remove_tlb_entry - remember a pte unmapping for later tlb invalidation.
108 *
109 * Record the fact that pte's were really umapped in ->need_flush, so we can
110 * later optimise away the tlb invalidate. This helps when userspace is
111 * unmapping already-unmapped pages, which happens quite a lot.
112 */
113#define tlb_remove_tlb_entry(tlb, ptep, address) \
114 do { \
115 tlb->need_flush = 1; \
116 __tlb_remove_tlb_entry(tlb, ptep, address); \
117 } while (0)
118
119#define pte_free_tlb(tlb, ptep) __pte_free_tlb(tlb, ptep)
120
121#define pud_free_tlb(tlb, pudp) __pud_free_tlb(tlb, pudp)
122
123#define pmd_free_tlb(tlb, pmdp) __pmd_free_tlb(tlb, pmdp)
124
125#define tlb_migrate_finish(mm) do {} while (0)
126
127#endif
diff --git a/arch/um/include/asm/tlbflush.h b/arch/um/include/asm/tlbflush.h
new file mode 100644
index 000000000000..614f2c091178
--- /dev/null
+++ b/arch/um/include/asm/tlbflush.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_TLBFLUSH_H
7#define __UM_TLBFLUSH_H
8
9#include <linux/mm.h>
10
11/*
12 * TLB flushing:
13 *
14 * - flush_tlb() flushes the current mm struct TLBs
15 * - flush_tlb_all() flushes all processes TLBs
16 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
17 * - flush_tlb_page(vma, vmaddr) flushes one page
18 * - flush_tlb_kernel_vm() flushes the kernel vm area
19 * - flush_tlb_range(vma, start, end) flushes a range of pages
20 */
21
22extern void flush_tlb_all(void);
23extern void flush_tlb_mm(struct mm_struct *mm);
24extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
25 unsigned long end);
26extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long address);
27extern void flush_tlb_kernel_vm(void);
28extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
29extern void __flush_tlb_one(unsigned long addr);
30
31#endif
diff --git a/arch/um/include/asm/topology.h b/arch/um/include/asm/topology.h
new file mode 100644
index 000000000000..0905e4f21d42
--- /dev/null
+++ b/arch/um/include/asm/topology.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_UM_TOPOLOGY_H
2#define _ASM_UM_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif
diff --git a/arch/um/include/asm/uaccess.h b/arch/um/include/asm/uaccess.h
new file mode 100644
index 000000000000..b9a895d6fa1d
--- /dev/null
+++ b/arch/um/include/asm/uaccess.h
@@ -0,0 +1,99 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UM_UACCESS_H
7#define __UM_UACCESS_H
8
9#include <asm/errno.h>
10#include <asm/processor.h>
11
12/* thread_info has a mm_segment_t in it, so put the definition up here */
13typedef struct {
14 unsigned long seg;
15} mm_segment_t;
16
17#include "linux/thread_info.h"
18
19#define VERIFY_READ 0
20#define VERIFY_WRITE 1
21
22/*
23 * The fs value determines whether argument validity checking should be
24 * performed or not. If get_fs() == USER_DS, checking is performed, with
25 * get_fs() == KERNEL_DS, checking is bypassed.
26 *
27 * For historical reasons, these macros are grossly misnamed.
28 */
29
30#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
31
32#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
33#define USER_DS MAKE_MM_SEG(TASK_SIZE)
34
35#define get_ds() (KERNEL_DS)
36#define get_fs() (current_thread_info()->addr_limit)
37#define set_fs(x) (current_thread_info()->addr_limit = (x))
38
39#define segment_eq(a, b) ((a).seg == (b).seg)
40
41#include "um_uaccess.h"
42
43#define __copy_from_user(to, from, n) copy_from_user(to, from, n)
44
45#define __copy_to_user(to, from, n) copy_to_user(to, from, n)
46
47#define __copy_to_user_inatomic __copy_to_user
48#define __copy_from_user_inatomic __copy_from_user
49
50#define __get_user(x, ptr) \
51({ \
52 const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \
53 __typeof__(x) __private_val; \
54 int __private_ret = -EFAULT; \
55 (x) = (__typeof__(*(__private_ptr)))0; \
56 if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\
57 sizeof(*(__private_ptr))) == 0) { \
58 (x) = (__typeof__(*(__private_ptr))) __private_val; \
59 __private_ret = 0; \
60 } \
61 __private_ret; \
62})
63
64#define get_user(x, ptr) \
65({ \
66 const __typeof__((*(ptr))) __user *private_ptr = (ptr); \
67 (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \
68 __get_user(x, private_ptr) : ((x) = (__typeof__(*ptr))0, -EFAULT)); \
69})
70
71#define __put_user(x, ptr) \
72({ \
73 __typeof__(*(ptr)) __user *__private_ptr = ptr; \
74 __typeof__(*(__private_ptr)) __private_val; \
75 int __private_ret = -EFAULT; \
76 __private_val = (__typeof__(*(__private_ptr))) (x); \
77 if (__copy_to_user((__private_ptr), &__private_val, \
78 sizeof(*(__private_ptr))) == 0) { \
79 __private_ret = 0; \
80 } \
81 __private_ret; \
82})
83
84#define put_user(x, ptr) \
85({ \
86 __typeof__(*(ptr)) __user *private_ptr = (ptr); \
87 (access_ok(VERIFY_WRITE, private_ptr, sizeof(*private_ptr)) ? \
88 __put_user(x, private_ptr) : -EFAULT); \
89})
90
91#define strlen_user(str) strnlen_user(str, ~0U >> 1)
92
93struct exception_table_entry
94{
95 unsigned long insn;
96 unsigned long fixup;
97};
98
99#endif
diff --git a/arch/um/include/asm/xor.h b/arch/um/include/asm/xor.h
new file mode 100644
index 000000000000..a19db3e17241
--- /dev/null
+++ b/arch/um/include/asm/xor.h
@@ -0,0 +1,6 @@
1#ifndef __UM_XOR_H
2#define __UM_XOR_H
3
4#include "asm-generic/xor.h"
5
6#endif
diff --git a/arch/um/include/aio.h b/arch/um/include/shared/aio.h
index 423bae9153f8..423bae9153f8 100644
--- a/arch/um/include/aio.h
+++ b/arch/um/include/shared/aio.h
diff --git a/arch/um/include/arch.h b/arch/um/include/shared/arch.h
index 2de92a08a76b..2de92a08a76b 100644
--- a/arch/um/include/arch.h
+++ b/arch/um/include/shared/arch.h
diff --git a/arch/um/include/as-layout.h b/arch/um/include/shared/as-layout.h
index 58e852dfb0ce..a92b678503cf 100644
--- a/arch/um/include/as-layout.h
+++ b/arch/um/include/shared/as-layout.h
@@ -6,7 +6,6 @@
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" 9#include "kern_constants.h"
11 10
12/* 11/*
diff --git a/arch/um/include/chan_kern.h b/arch/um/include/shared/chan_kern.h
index 1e651457e049..1e651457e049 100644
--- a/arch/um/include/chan_kern.h
+++ b/arch/um/include/shared/chan_kern.h
diff --git a/arch/um/include/chan_user.h b/arch/um/include/shared/chan_user.h
index 9b9ced85b703..9b9ced85b703 100644
--- a/arch/um/include/chan_user.h
+++ b/arch/um/include/shared/chan_user.h
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/shared/common-offsets.h
index b54bd35585c2..72009c7e3210 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/shared/common-offsets.h
@@ -39,3 +39,16 @@ 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#ifdef CONFIG_PRINTK
44DEFINE(UML_CONFIG_PRINTK, CONFIG_PRINTK);
45#endif
46#ifdef CONFIG_NO_HZ
47DEFINE(UML_CONFIG_NO_HZ, CONFIG_NO_HZ);
48#endif
49#ifdef CONFIG_UML_X86
50DEFINE(UML_CONFIG_UML_X86, CONFIG_UML_X86);
51#endif
52#ifdef CONFIG_64BIT
53DEFINE(UML_CONFIG_64BIT, CONFIG_64BIT);
54#endif
diff --git a/arch/um/include/elf_user.h b/arch/um/include/shared/elf_user.h
index 53516b637272..53516b637272 100644
--- a/arch/um/include/elf_user.h
+++ b/arch/um/include/shared/elf_user.h
diff --git a/arch/um/include/frame_kern.h b/arch/um/include/shared/frame_kern.h
index ce9514f57211..ce9514f57211 100644
--- a/arch/um/include/frame_kern.h
+++ b/arch/um/include/shared/frame_kern.h
diff --git a/arch/um/include/init.h b/arch/um/include/shared/init.h
index 37dd097c16c0..37dd097c16c0 100644
--- a/arch/um/include/init.h
+++ b/arch/um/include/shared/init.h
diff --git a/arch/um/include/initrd.h b/arch/um/include/shared/initrd.h
index 439b9a814985..439b9a814985 100644
--- a/arch/um/include/initrd.h
+++ b/arch/um/include/shared/initrd.h
diff --git a/arch/um/include/irq_kern.h b/arch/um/include/shared/irq_kern.h
index fba3895274f9..fba3895274f9 100644
--- a/arch/um/include/irq_kern.h
+++ b/arch/um/include/shared/irq_kern.h
diff --git a/arch/um/include/irq_user.h b/arch/um/include/shared/irq_user.h
index c6c784df2673..c6c784df2673 100644
--- a/arch/um/include/irq_user.h
+++ b/arch/um/include/shared/irq_user.h
diff --git a/arch/um/include/kern.h b/arch/um/include/shared/kern.h
index 4ce3fc650e57..4ce3fc650e57 100644
--- a/arch/um/include/kern.h
+++ b/arch/um/include/shared/kern.h
diff --git a/arch/um/include/kern_util.h b/arch/um/include/shared/kern_util.h
index 3c341222d252..3c341222d252 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/shared/kern_util.h
diff --git a/arch/um/include/shared/ldt.h b/arch/um/include/shared/ldt.h
new file mode 100644
index 000000000000..a7f999a58774
--- /dev/null
+++ b/arch/um/include/shared/ldt.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_H
9#define __ASM_LDT_H
10
11#include <linux/mutex.h>
12#include <sysdep/host_ldt.h>
13
14extern void ldt_host_info(void);
15
16#define LDT_PAGES_MAX \
17 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
18#define LDT_ENTRIES_PER_PAGE \
19 (PAGE_SIZE/LDT_ENTRY_SIZE)
20#define LDT_DIRECT_ENTRIES \
21 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
22
23struct ldt_entry {
24 __u32 a;
25 __u32 b;
26};
27
28typedef struct uml_ldt {
29 int entry_count;
30 struct mutex lock;
31 union {
32 struct ldt_entry * pages[LDT_PAGES_MAX];
33 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
34 } u;
35} uml_ldt_t;
36
37#endif
diff --git a/arch/um/include/line.h b/arch/um/include/shared/line.h
index 311a0d3d93af..311a0d3d93af 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/shared/line.h
diff --git a/arch/um/include/longjmp.h b/arch/um/include/shared/longjmp.h
index e860bc5848e0..e860bc5848e0 100644
--- a/arch/um/include/longjmp.h
+++ b/arch/um/include/shared/longjmp.h
diff --git a/arch/um/include/mconsole.h b/arch/um/include/shared/mconsole.h
index c139ae1d6826..c139ae1d6826 100644
--- a/arch/um/include/mconsole.h
+++ b/arch/um/include/shared/mconsole.h
diff --git a/arch/um/include/mconsole_kern.h b/arch/um/include/shared/mconsole_kern.h
index d2fe07e78958..d2fe07e78958 100644
--- a/arch/um/include/mconsole_kern.h
+++ b/arch/um/include/shared/mconsole_kern.h
diff --git a/arch/um/include/mem.h b/arch/um/include/shared/mem.h
index 5cd40e99e8d5..5cd40e99e8d5 100644
--- a/arch/um/include/mem.h
+++ b/arch/um/include/shared/mem.h
diff --git a/arch/um/include/mem_kern.h b/arch/um/include/shared/mem_kern.h
index cb7e196d366b..cb7e196d366b 100644
--- a/arch/um/include/mem_kern.h
+++ b/arch/um/include/shared/mem_kern.h
diff --git a/arch/um/include/mem_user.h b/arch/um/include/shared/mem_user.h
index 46384acd547b..46384acd547b 100644
--- a/arch/um/include/mem_user.h
+++ b/arch/um/include/shared/mem_user.h
diff --git a/arch/um/include/net_kern.h b/arch/um/include/shared/net_kern.h
index d843c7924a7c..d843c7924a7c 100644
--- a/arch/um/include/net_kern.h
+++ b/arch/um/include/shared/net_kern.h
diff --git a/arch/um/include/net_user.h b/arch/um/include/shared/net_user.h
index 63bee158cd8e..63bee158cd8e 100644
--- a/arch/um/include/net_user.h
+++ b/arch/um/include/shared/net_user.h
diff --git a/arch/um/include/os.h b/arch/um/include/shared/os.h
index db5be46e3e18..cd40fddcf99d 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/shared/os.h
@@ -11,7 +11,6 @@
11#include "longjmp.h" 11#include "longjmp.h"
12#include "mm_id.h" 12#include "mm_id.h"
13#include "sysdep/tls.h" 13#include "sysdep/tls.h"
14#include "../os/include/file.h"
15 14
16#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR)) 15#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR))
17 16
diff --git a/arch/um/include/process.h b/arch/um/include/shared/process.h
index bb873a51262e..bb873a51262e 100644
--- a/arch/um/include/process.h
+++ b/arch/um/include/shared/process.h
diff --git a/arch/um/include/ptrace_user.h b/arch/um/include/shared/ptrace_user.h
index 4bce6e012889..4bce6e012889 100644
--- a/arch/um/include/ptrace_user.h
+++ b/arch/um/include/shared/ptrace_user.h
diff --git a/arch/um/include/registers.h b/arch/um/include/shared/registers.h
index b0b4589e0ebc..b0b4589e0ebc 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/shared/registers.h
diff --git a/arch/um/include/sigio.h b/arch/um/include/shared/sigio.h
index 434f1a9ae4b3..434f1a9ae4b3 100644
--- a/arch/um/include/sigio.h
+++ b/arch/um/include/shared/sigio.h
diff --git a/arch/um/include/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
index 48dd0989ddaa..48dd0989ddaa 100644
--- a/arch/um/include/skas/mm_id.h
+++ b/arch/um/include/shared/skas/mm_id.h
diff --git a/arch/um/include/skas/proc_mm.h b/arch/um/include/shared/skas/proc_mm.h
index 902809209603..902809209603 100644
--- a/arch/um/include/skas/proc_mm.h
+++ b/arch/um/include/shared/skas/proc_mm.h
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/shared/skas/skas.h
index 64d2c7443306..64d2c7443306 100644
--- a/arch/um/include/skas/skas.h
+++ b/arch/um/include/shared/skas/skas.h
diff --git a/arch/um/include/skas/stub-data.h b/arch/um/include/shared/skas/stub-data.h
index f6ed92c3727d..f6ed92c3727d 100644
--- a/arch/um/include/skas/stub-data.h
+++ b/arch/um/include/shared/skas/stub-data.h
diff --git a/arch/um/include/skas_ptrace.h b/arch/um/include/shared/skas_ptrace.h
index 3d31bbacd016..3d31bbacd016 100644
--- a/arch/um/include/skas_ptrace.h
+++ b/arch/um/include/shared/skas_ptrace.h
diff --git a/arch/um/include/skas_ptregs.h b/arch/um/include/shared/skas_ptregs.h
index 73db19e9c077..73db19e9c077 100644
--- a/arch/um/include/skas_ptregs.h
+++ b/arch/um/include/shared/skas_ptregs.h
diff --git a/arch/um/include/syscall.h b/arch/um/include/shared/syscall.h
index dda1df901a08..dda1df901a08 100644
--- a/arch/um/include/syscall.h
+++ b/arch/um/include/shared/syscall.h
diff --git a/arch/um/include/sysrq.h b/arch/um/include/shared/sysrq.h
index c8d332b56b98..c8d332b56b98 100644
--- a/arch/um/include/sysrq.h
+++ b/arch/um/include/shared/sysrq.h
diff --git a/arch/um/include/task.h b/arch/um/include/shared/task.h
index 3fe726b3cf48..3fe726b3cf48 100644
--- a/arch/um/include/task.h
+++ b/arch/um/include/shared/task.h
diff --git a/arch/um/include/tlb.h b/arch/um/include/shared/tlb.h
index ecd2265b301b..ecd2265b301b 100644
--- a/arch/um/include/tlb.h
+++ b/arch/um/include/shared/tlb.h
diff --git a/arch/um/include/ubd_user.h b/arch/um/include/shared/ubd_user.h
index bb66517f0739..bb66517f0739 100644
--- a/arch/um/include/ubd_user.h
+++ b/arch/um/include/shared/ubd_user.h
diff --git a/arch/um/include/um_malloc.h b/arch/um/include/shared/um_malloc.h
index c554d706d106..c554d706d106 100644
--- a/arch/um/include/um_malloc.h
+++ b/arch/um/include/shared/um_malloc.h
diff --git a/arch/um/include/um_mmu.h b/arch/um/include/shared/um_mmu.h
index f575ff91f2a0..b1a7e47d1027 100644
--- a/arch/um/include/um_mmu.h
+++ b/arch/um/include/shared/um_mmu.h
@@ -6,9 +6,8 @@
6#ifndef __ARCH_UM_MMU_H 6#ifndef __ARCH_UM_MMU_H
7#define __ARCH_UM_MMU_H 7#define __ARCH_UM_MMU_H
8 8
9#include "uml-config.h"
10#include "mm_id.h" 9#include "mm_id.h"
11#include "asm/ldt.h" 10#include "ldt.h"
12 11
13typedef struct mm_context { 12typedef struct mm_context {
14 struct mm_id id; 13 struct mm_id id;
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/shared/um_uaccess.h
index 45c04999d670..45c04999d670 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/shared/um_uaccess.h
diff --git a/arch/um/include/user.h b/arch/um/include/shared/user.h
index 1723fac6f40d..293f7c794faa 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/shared/user.h
@@ -6,7 +6,7 @@
6#ifndef __USER_H__ 6#ifndef __USER_H__
7#define __USER_H__ 7#define __USER_H__
8 8
9#include "uml-config.h" 9#include "kern_constants.h"
10 10
11/* 11/*
12 * The usual definition - copied here because the kernel provides its own, 12 * The usual definition - copied here because the kernel provides its own,
diff --git a/arch/um/include/sigcontext.h b/arch/um/include/sigcontext.h
deleted file mode 100644
index 59816ca7a8df..000000000000
--- a/arch/um/include/sigcontext.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UML_SIGCONTEXT_H__
7#define __UML_SIGCONTEXT_H__
8
9#include "sysdep/sigcontext.h"
10
11extern int sc_size(void *data);
12extern void sc_to_sc(void *to_ptr, void *from_ptr);
13
14#endif
15
16/*
17 * Overrides for Emacs so that we follow Linus's tabbing style.
18 * Emacs will notice this stuff at the end of the file and automatically
19 * adjust the settings for this buffer only. This must remain at the end
20 * of the file.
21 * ---------------------------------------------------------------------------
22 * Local variables:
23 * c-file-style: "linux"
24 * End:
25 */
diff --git a/arch/um/include/sysdep-i386/archsetjmp.h b/arch/um/include/sysdep-i386/archsetjmp.h
deleted file mode 100644
index 0f312085ce1d..000000000000
--- a/arch/um/include/sysdep-i386/archsetjmp.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/um/include/sysdep-i386/archsetjmp.h
3 */
4
5#ifndef _KLIBC_ARCHSETJMP_H
6#define _KLIBC_ARCHSETJMP_H
7
8struct __jmp_buf {
9 unsigned int __ebx;
10 unsigned int __esp;
11 unsigned int __ebp;
12 unsigned int __esi;
13 unsigned int __edi;
14 unsigned int __eip;
15};
16
17typedef struct __jmp_buf jmp_buf[1];
18
19#define JB_IP __eip
20#define JB_SP __esp
21
22#endif /* _SETJMP_H */
diff --git a/arch/um/include/sysdep-i386/barrier.h b/arch/um/include/sysdep-i386/barrier.h
deleted file mode 100644
index b58d52c5b2f4..000000000000
--- a/arch/um/include/sysdep-i386/barrier.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __SYSDEP_I386_BARRIER_H
2#define __SYSDEP_I386_BARRIER_H
3
4/* Copied from include/asm-i386 for use by userspace. i386 has the option
5 * of using mfence, but I'm just using this, which works everywhere, for now.
6 */
7#define mb() asm volatile("lock; addl $0,0(%esp)")
8
9#endif
diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h
deleted file mode 100644
index 0cb4645cbeb8..000000000000
--- a/arch/um/include/sysdep-i386/checksum.h
+++ /dev/null
@@ -1,211 +0,0 @@
1/*
2 * Licensed under the GPL
3 */
4
5#ifndef __UM_SYSDEP_CHECKSUM_H
6#define __UM_SYSDEP_CHECKSUM_H
7
8#include "linux/in6.h"
9#include "linux/string.h"
10
11/*
12 * computes the checksum of a memory block at buff, length len,
13 * and adds in "sum" (32-bit)
14 *
15 * returns a 32-bit number suitable for feeding into itself
16 * or csum_tcpudp_magic
17 *
18 * this function must be called with even lengths, except
19 * for the last fragment, which may be odd
20 *
21 * it's best to have buff aligned on a 32-bit boundary
22 */
23__wsum csum_partial(const void *buff, int len, __wsum sum);
24
25/*
26 * Note: when you get a NULL pointer exception here this means someone
27 * passed in an incorrect kernel address to one of these functions.
28 *
29 * If you use these functions directly please don't forget the
30 * access_ok().
31 */
32
33static __inline__
34__wsum csum_partial_copy_nocheck(const void *src, void *dst,
35 int len, __wsum sum)
36{
37 memcpy(dst, src, len);
38 return csum_partial(dst, len, sum);
39}
40
41/*
42 * the same as csum_partial, but copies from src while it
43 * checksums, and handles user-space pointer exceptions correctly, when needed.
44 *
45 * here even more important to align src and dst on a 32-bit (or even
46 * better 64-bit) boundary
47 */
48
49static __inline__
50__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
51 int len, __wsum sum, int *err_ptr)
52{
53 if (copy_from_user(dst, src, len)) {
54 *err_ptr = -EFAULT;
55 return (__force __wsum)-1;
56 }
57
58 return csum_partial(dst, len, sum);
59}
60
61/*
62 * This is a version of ip_compute_csum() optimized for IP headers,
63 * which always checksum on 4 octet boundaries.
64 *
65 * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
66 * Arnt Gulbrandsen.
67 */
68static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
69{
70 unsigned int sum;
71
72 __asm__ __volatile__(
73 "movl (%1), %0 ;\n"
74 "subl $4, %2 ;\n"
75 "jbe 2f ;\n"
76 "addl 4(%1), %0 ;\n"
77 "adcl 8(%1), %0 ;\n"
78 "adcl 12(%1), %0 ;\n"
79"1: adcl 16(%1), %0 ;\n"
80 "lea 4(%1), %1 ;\n"
81 "decl %2 ;\n"
82 "jne 1b ;\n"
83 "adcl $0, %0 ;\n"
84 "movl %0, %2 ;\n"
85 "shrl $16, %0 ;\n"
86 "addw %w2, %w0 ;\n"
87 "adcl $0, %0 ;\n"
88 "notl %0 ;\n"
89"2: ;\n"
90 /* Since the input registers which are loaded with iph and ipl
91 are modified, we must also specify them as outputs, or gcc
92 will assume they contain their original values. */
93 : "=r" (sum), "=r" (iph), "=r" (ihl)
94 : "1" (iph), "2" (ihl)
95 : "memory");
96 return (__force __sum16)sum;
97}
98
99/*
100 * Fold a partial checksum
101 */
102
103static inline __sum16 csum_fold(__wsum sum)
104{
105 __asm__(
106 "addl %1, %0 ;\n"
107 "adcl $0xffff, %0 ;\n"
108 : "=r" (sum)
109 : "r" ((__force u32)sum << 16),
110 "0" ((__force u32)sum & 0xffff0000)
111 );
112 return (__force __sum16)(~(__force u32)sum >> 16);
113}
114
115static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 unsigned short len,
117 unsigned short proto,
118 __wsum sum)
119{
120 __asm__(
121 "addl %1, %0 ;\n"
122 "adcl %2, %0 ;\n"
123 "adcl %3, %0 ;\n"
124 "adcl $0, %0 ;\n"
125 : "=r" (sum)
126 : "g" (daddr), "g"(saddr), "g"((len + proto) << 8), "0"(sum));
127 return sum;
128}
129
130/*
131 * computes the checksum of the TCP/UDP pseudo-header
132 * returns a 16-bit checksum, already complemented
133 */
134static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
135 unsigned short len,
136 unsigned short proto,
137 __wsum sum)
138{
139 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
140}
141
142/*
143 * this routine is used for miscellaneous IP-like checksums, mainly
144 * in icmp.c
145 */
146
147static inline __sum16 ip_compute_csum(const void *buff, int len)
148{
149 return csum_fold (csum_partial(buff, len, 0));
150}
151
152#define _HAVE_ARCH_IPV6_CSUM
153static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
154 const struct in6_addr *daddr,
155 __u32 len, unsigned short proto,
156 __wsum sum)
157{
158 __asm__(
159 "addl 0(%1), %0 ;\n"
160 "adcl 4(%1), %0 ;\n"
161 "adcl 8(%1), %0 ;\n"
162 "adcl 12(%1), %0 ;\n"
163 "adcl 0(%2), %0 ;\n"
164 "adcl 4(%2), %0 ;\n"
165 "adcl 8(%2), %0 ;\n"
166 "adcl 12(%2), %0 ;\n"
167 "adcl %3, %0 ;\n"
168 "adcl %4, %0 ;\n"
169 "adcl $0, %0 ;\n"
170 : "=&r" (sum)
171 : "r" (saddr), "r" (daddr),
172 "r"(htonl(len)), "r"(htonl(proto)), "0"(sum));
173
174 return csum_fold(sum);
175}
176
177/*
178 * Copy and checksum to user
179 */
180#define HAVE_CSUM_COPY_USER
181static __inline__ __wsum csum_and_copy_to_user(const void *src,
182 void __user *dst,
183 int len, __wsum sum, int *err_ptr)
184{
185 if (access_ok(VERIFY_WRITE, dst, len)) {
186 if (copy_to_user(dst, src, len)) {
187 *err_ptr = -EFAULT;
188 return (__force __wsum)-1;
189 }
190
191 return csum_partial(src, len, sum);
192 }
193
194 if (len)
195 *err_ptr = -EFAULT;
196
197 return (__force __wsum)-1; /* invalid checksum */
198}
199
200#endif
201
202/*
203 * Overrides for Emacs so that we follow Linus's tabbing style.
204 * Emacs will notice this stuff at the end of the file and automatically
205 * adjust the settings for this buffer only. This must remain at the end
206 * of the file.
207 * ---------------------------------------------------------------------------
208 * Local variables:
209 * c-file-style: "linux"
210 * End:
211 */
diff --git a/arch/um/include/sysdep-i386/faultinfo.h b/arch/um/include/sysdep-i386/faultinfo.h
deleted file mode 100644
index db437cc373bc..000000000000
--- a/arch/um/include/sysdep-i386/faultinfo.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
4 * Licensed under the GPL
5 */
6
7#ifndef __FAULTINFO_I386_H
8#define __FAULTINFO_I386_H
9
10/* this structure contains the full arch-specific faultinfo
11 * from the traps.
12 * On i386, ptrace_faultinfo unfortunately doesn't provide
13 * all the info, since trap_no is missing.
14 * All common elements are defined at the same position in
15 * both structures, thus making it easy to copy the
16 * contents without knowledge about the structure elements.
17 */
18struct faultinfo {
19 int error_code; /* in ptrace_faultinfo misleadingly called is_write */
20 unsigned long cr2; /* in ptrace_faultinfo called addr */
21 int trap_no; /* missing in ptrace_faultinfo */
22};
23
24#define FAULT_WRITE(fi) ((fi).error_code & 2)
25#define FAULT_ADDRESS(fi) ((fi).cr2)
26
27#define PTRACE_FULL_FAULTINFO 0
28
29#endif
diff --git a/arch/um/include/sysdep-i386/kernel-offsets.h b/arch/um/include/sysdep-i386/kernel-offsets.h
deleted file mode 100644
index 5868526b5eef..000000000000
--- a/arch/um/include/sysdep-i386/kernel-offsets.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#include <linux/stddef.h>
2#include <linux/sched.h>
3#include <linux/elf.h>
4#include <linux/crypto.h>
5#include <asm/mman.h>
6
7#define DEFINE(sym, val) \
8 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
9
10#define STR(x) #x
11#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : )
12
13#define BLANK() asm volatile("\n->" : : )
14
15#define OFFSET(sym, str, mem) \
16 DEFINE(sym, offsetof(struct str, mem));
17
18void foo(void)
19{
20#include <common-offsets.h>
21}
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/include/sysdep-i386/ptrace.h
deleted file mode 100644
index 11c08969d134..000000000000
--- a/arch/um/include/sysdep-i386/ptrace.h
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_I386_PTRACE_H
7#define __SYSDEP_I386_PTRACE_H
8
9#include "uml-config.h"
10#include "user_constants.h"
11#include "sysdep/faultinfo.h"
12
13#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
14#define MAX_REG_OFFSET (UM_FRAME_SIZE)
15
16static inline void update_debugregs(int seq) {}
17
18/* syscall emulation path in ptrace */
19
20#ifndef PTRACE_SYSEMU
21#define PTRACE_SYSEMU 31
22#endif
23
24void set_using_sysemu(int value);
25int get_using_sysemu(void);
26extern int sysemu_supported;
27
28#include "skas_ptregs.h"
29
30#define REGS_IP(r) ((r)[HOST_IP])
31#define REGS_SP(r) ((r)[HOST_SP])
32#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
33#define REGS_EAX(r) ((r)[HOST_EAX])
34#define REGS_EBX(r) ((r)[HOST_EBX])
35#define REGS_ECX(r) ((r)[HOST_ECX])
36#define REGS_EDX(r) ((r)[HOST_EDX])
37#define REGS_ESI(r) ((r)[HOST_ESI])
38#define REGS_EDI(r) ((r)[HOST_EDI])
39#define REGS_EBP(r) ((r)[HOST_EBP])
40#define REGS_CS(r) ((r)[HOST_CS])
41#define REGS_SS(r) ((r)[HOST_SS])
42#define REGS_DS(r) ((r)[HOST_DS])
43#define REGS_ES(r) ((r)[HOST_ES])
44#define REGS_FS(r) ((r)[HOST_FS])
45#define REGS_GS(r) ((r)[HOST_GS])
46
47#define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res)
48
49#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
50
51#ifndef PTRACE_SYSEMU_SINGLESTEP
52#define PTRACE_SYSEMU_SINGLESTEP 32
53#endif
54
55struct uml_pt_regs {
56 unsigned long gp[MAX_REG_NR];
57 struct faultinfo faultinfo;
58 long syscall;
59 int is_user;
60};
61
62#define EMPTY_UML_PT_REGS { }
63
64#define UPT_IP(r) REGS_IP((r)->gp)
65#define UPT_SP(r) REGS_SP((r)->gp)
66#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
67#define UPT_EAX(r) REGS_EAX((r)->gp)
68#define UPT_EBX(r) REGS_EBX((r)->gp)
69#define UPT_ECX(r) REGS_ECX((r)->gp)
70#define UPT_EDX(r) REGS_EDX((r)->gp)
71#define UPT_ESI(r) REGS_ESI((r)->gp)
72#define UPT_EDI(r) REGS_EDI((r)->gp)
73#define UPT_EBP(r) REGS_EBP((r)->gp)
74#define UPT_ORIG_EAX(r) ((r)->syscall)
75#define UPT_CS(r) REGS_CS((r)->gp)
76#define UPT_SS(r) REGS_SS((r)->gp)
77#define UPT_DS(r) REGS_DS((r)->gp)
78#define UPT_ES(r) REGS_ES((r)->gp)
79#define UPT_FS(r) REGS_FS((r)->gp)
80#define UPT_GS(r) REGS_GS((r)->gp)
81
82#define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
83#define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
84#define UPT_SYSCALL_ARG3(r) UPT_EDX(r)
85#define UPT_SYSCALL_ARG4(r) UPT_ESI(r)
86#define UPT_SYSCALL_ARG5(r) UPT_EDI(r)
87#define UPT_SYSCALL_ARG6(r) UPT_EBP(r)
88
89extern int user_context(unsigned long sp);
90
91#define UPT_IS_USER(r) ((r)->is_user)
92
93struct syscall_args {
94 unsigned long args[6];
95};
96
97#define SYSCALL_ARGS(r) ((struct syscall_args) \
98 { .args = { UPT_SYSCALL_ARG1(r), \
99 UPT_SYSCALL_ARG2(r), \
100 UPT_SYSCALL_ARG3(r), \
101 UPT_SYSCALL_ARG4(r), \
102 UPT_SYSCALL_ARG5(r), \
103 UPT_SYSCALL_ARG6(r) } } )
104
105#define UPT_REG(regs, reg) \
106 ({ unsigned long val; \
107 switch(reg){ \
108 case EIP: val = UPT_IP(regs); break; \
109 case UESP: val = UPT_SP(regs); break; \
110 case EAX: val = UPT_EAX(regs); break; \
111 case EBX: val = UPT_EBX(regs); break; \
112 case ECX: val = UPT_ECX(regs); break; \
113 case EDX: val = UPT_EDX(regs); break; \
114 case ESI: val = UPT_ESI(regs); break; \
115 case EDI: val = UPT_EDI(regs); break; \
116 case EBP: val = UPT_EBP(regs); break; \
117 case ORIG_EAX: val = UPT_ORIG_EAX(regs); break; \
118 case CS: val = UPT_CS(regs); break; \
119 case SS: val = UPT_SS(regs); break; \
120 case DS: val = UPT_DS(regs); break; \
121 case ES: val = UPT_ES(regs); break; \
122 case FS: val = UPT_FS(regs); break; \
123 case GS: val = UPT_GS(regs); break; \
124 case EFL: val = UPT_EFLAGS(regs); break; \
125 default : \
126 panic("Bad register in UPT_REG : %d\n", reg); \
127 val = -1; \
128 } \
129 val; \
130 })
131
132#define UPT_SET(regs, reg, val) \
133 do { \
134 switch(reg){ \
135 case EIP: UPT_IP(regs) = val; break; \
136 case UESP: UPT_SP(regs) = val; break; \
137 case EAX: UPT_EAX(regs) = val; break; \
138 case EBX: UPT_EBX(regs) = val; break; \
139 case ECX: UPT_ECX(regs) = val; break; \
140 case EDX: UPT_EDX(regs) = val; break; \
141 case ESI: UPT_ESI(regs) = val; break; \
142 case EDI: UPT_EDI(regs) = val; break; \
143 case EBP: UPT_EBP(regs) = val; break; \
144 case ORIG_EAX: UPT_ORIG_EAX(regs) = val; break; \
145 case CS: UPT_CS(regs) = val; break; \
146 case SS: UPT_SS(regs) = val; break; \
147 case DS: UPT_DS(regs) = val; break; \
148 case ES: UPT_ES(regs) = val; break; \
149 case FS: UPT_FS(regs) = val; break; \
150 case GS: UPT_GS(regs) = val; break; \
151 case EFL: UPT_EFLAGS(regs) = val; break; \
152 default : \
153 panic("Bad register in UPT_SET : %d\n", reg); \
154 break; \
155 } \
156 } while (0)
157
158#define UPT_SET_SYSCALL_RETURN(r, res) \
159 REGS_SET_SYSCALL_RETURN((r)->regs, (res))
160
161#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
162
163#define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
164#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
165#define UPT_SYSCALL_RET(r) UPT_EAX(r)
166
167#define UPT_FAULTINFO(r) (&(r)->faultinfo)
168
169extern void arch_init_registers(int pid);
170
171#endif
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
deleted file mode 100644
index ef56247e4143..000000000000
--- a/arch/um/include/sysdep-i386/ptrace_user.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_I386_PTRACE_USER_H__
7#define __SYSDEP_I386_PTRACE_USER_H__
8
9#include <sys/ptrace.h>
10#include <linux/ptrace.h>
11#include <asm/ptrace.h>
12#include "user_constants.h"
13
14#define PT_OFFSET(r) ((r) * sizeof(long))
15
16#define PT_SYSCALL_NR(regs) ((regs)[ORIG_EAX])
17#define PT_SYSCALL_NR_OFFSET PT_OFFSET(ORIG_EAX)
18
19#define PT_SYSCALL_ARG1_OFFSET PT_OFFSET(EBX)
20#define PT_SYSCALL_ARG2_OFFSET PT_OFFSET(ECX)
21#define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX)
22#define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI)
23#define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI)
24#define PT_SYSCALL_ARG6_OFFSET PT_OFFSET(EBP)
25
26#define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX)
27
28#define REGS_SYSCALL_NR EAX /* This is used before a system call */
29#define REGS_SYSCALL_ARG1 EBX
30#define REGS_SYSCALL_ARG2 ECX
31#define REGS_SYSCALL_ARG3 EDX
32#define REGS_SYSCALL_ARG4 ESI
33#define REGS_SYSCALL_ARG5 EDI
34#define REGS_SYSCALL_ARG6 EBP
35
36#define REGS_IP_INDEX EIP
37#define REGS_SP_INDEX UESP
38
39#define PT_IP_OFFSET PT_OFFSET(EIP)
40#define PT_IP(regs) ((regs)[EIP])
41#define PT_SP_OFFSET PT_OFFSET(UESP)
42#define PT_SP(regs) ((regs)[UESP])
43
44#define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE)
45
46#ifndef FRAME_SIZE
47#define FRAME_SIZE (17)
48#endif
49
50#endif
diff --git a/arch/um/include/sysdep-i386/sc.h b/arch/um/include/sysdep-i386/sc.h
deleted file mode 100644
index c57d1780ad37..000000000000
--- a/arch/um/include/sysdep-i386/sc.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef __SYSDEP_I386_SC_H
2#define __SYSDEP_I386_SC_H
3
4#include <user_constants.h>
5
6#define SC_OFFSET(sc, field) \
7 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
8#define SC_FP_OFFSET(sc, field) \
9 *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field]))
10#define SC_FP_OFFSET_PTR(sc, field, type) \
11 ((type *) &(((char *) (SC_FPSTATE(sc)))[HOST_##field]))
12
13#define SC_IP(sc) SC_OFFSET(sc, SC_IP)
14#define SC_SP(sc) SC_OFFSET(sc, SC_SP)
15#define SC_FS(sc) SC_OFFSET(sc, SC_FS)
16#define SC_GS(sc) SC_OFFSET(sc, SC_GS)
17#define SC_DS(sc) SC_OFFSET(sc, SC_DS)
18#define SC_ES(sc) SC_OFFSET(sc, SC_ES)
19#define SC_SS(sc) SC_OFFSET(sc, SC_SS)
20#define SC_CS(sc) SC_OFFSET(sc, SC_CS)
21#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS)
22#define SC_EAX(sc) SC_OFFSET(sc, SC_EAX)
23#define SC_EBX(sc) SC_OFFSET(sc, SC_EBX)
24#define SC_ECX(sc) SC_OFFSET(sc, SC_ECX)
25#define SC_EDX(sc) SC_OFFSET(sc, SC_EDX)
26#define SC_EDI(sc) SC_OFFSET(sc, SC_EDI)
27#define SC_ESI(sc) SC_OFFSET(sc, SC_ESI)
28#define SC_EBP(sc) SC_OFFSET(sc, SC_EBP)
29#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
30#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
31#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
32#define SC_FPSTATE(sc) SC_OFFSET(sc, SC_FPSTATE)
33#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK)
34#define SC_FP_CW(sc) SC_FP_OFFSET(sc, SC_FP_CW)
35#define SC_FP_SW(sc) SC_FP_OFFSET(sc, SC_FP_SW)
36#define SC_FP_TAG(sc) SC_FP_OFFSET(sc, SC_FP_TAG)
37#define SC_FP_IPOFF(sc) SC_FP_OFFSET(sc, SC_FP_IPOFF)
38#define SC_FP_CSSEL(sc) SC_FP_OFFSET(sc, SC_FP_CSSEL)
39#define SC_FP_DATAOFF(sc) SC_FP_OFFSET(sc, SC_FP_DATAOFF)
40#define SC_FP_DATASEL(sc) SC_FP_OFFSET(sc, SC_FP_DATASEL)
41#define SC_FP_ST(sc) SC_FP_OFFSET_PTR(sc, SC_FP_ST, struct _fpstate)
42#define SC_FXSR_ENV(sc) SC_FP_OFFSET_PTR(sc, SC_FXSR_ENV, void)
43
44#endif
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
deleted file mode 100644
index f583c87111a0..000000000000
--- a/arch/um/include/sysdep-i386/sigcontext.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYS_SIGCONTEXT_I386_H
7#define __SYS_SIGCONTEXT_I386_H
8
9#include "sysdep/sc.h"
10
11#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
12
13#define GET_FAULTINFO_FROM_SC(fi, sc) \
14 { \
15 (fi).cr2 = SC_CR2(sc); \
16 (fi).error_code = SC_ERR(sc); \
17 (fi).trap_no = SC_TRAPNO(sc); \
18 }
19
20/* This is Page Fault */
21#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
22
23/* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */
24#define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo)
25
26#endif
diff --git a/arch/um/include/sysdep-i386/skas_ptrace.h b/arch/um/include/sysdep-i386/skas_ptrace.h
deleted file mode 100644
index e27b8a791773..000000000000
--- a/arch/um/include/sysdep-i386/skas_ptrace.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_I386_SKAS_PTRACE_H
7#define __SYSDEP_I386_SKAS_PTRACE_H
8
9struct ptrace_faultinfo {
10 int is_write;
11 unsigned long addr;
12};
13
14struct ptrace_ldt {
15 int func;
16 void *ptr;
17 unsigned long bytecount;
18};
19
20#define PTRACE_LDT 54
21
22#endif
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h
deleted file mode 100644
index 8c097b87fca7..000000000000
--- a/arch/um/include/sysdep-i386/stub.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H
8
9#include <sys/mman.h>
10#include <asm/ptrace.h>
11#include <asm/unistd.h>
12#include "as-layout.h"
13#include "stub-data.h"
14#include "kern_constants.h"
15#include "uml-config.h"
16
17extern void stub_segv_handler(int sig);
18extern void stub_clone_handler(void);
19
20#define STUB_SYSCALL_RET EAX
21#define STUB_MMAP_NR __NR_mmap2
22#define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
23
24static inline long stub_syscall0(long syscall)
25{
26 long ret;
27
28 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall));
29
30 return ret;
31}
32
33static inline long stub_syscall1(long syscall, long arg1)
34{
35 long ret;
36
37 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1));
38
39 return ret;
40}
41
42static inline long stub_syscall2(long syscall, long arg1, long arg2)
43{
44 long ret;
45
46 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
47 "c" (arg2));
48
49 return ret;
50}
51
52static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
53{
54 long ret;
55
56 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
57 "c" (arg2), "d" (arg3));
58
59 return ret;
60}
61
62static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
63 long arg4)
64{
65 long ret;
66
67 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
68 "c" (arg2), "d" (arg3), "S" (arg4));
69
70 return ret;
71}
72
73static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
74 long arg4, long arg5)
75{
76 long ret;
77
78 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
79 "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5));
80
81 return ret;
82}
83
84static inline void trap_myself(void)
85{
86 __asm("int3");
87}
88
89static inline void remap_stack(int fd, unsigned long offset)
90{
91 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
92 "movl %7, %%ebx ; movl %%eax, (%%ebx)"
93 : : "g" (STUB_MMAP_NR), "b" (STUB_DATA),
94 "c" (UM_KERN_PAGE_SIZE),
95 "d" (PROT_READ | PROT_WRITE),
96 "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
97 "a" (offset),
98 "i" (&((struct stub_data *) STUB_DATA)->err)
99 : "memory");
100}
101
102#endif
diff --git a/arch/um/include/sysdep-i386/syscalls.h b/arch/um/include/sysdep-i386/syscalls.h
deleted file mode 100644
index 905698197e35..000000000000
--- a/arch/um/include/sysdep-i386/syscalls.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#include "asm/unistd.h"
7#include "sysdep/ptrace.h"
8
9typedef long syscall_handler_t(struct pt_regs);
10
11/* Not declared on x86, incompatible declarations on x86_64, so these have
12 * to go here rather than in sys_call_table.c
13 */
14extern syscall_handler_t sys_rt_sigaction;
15
16extern syscall_handler_t old_mmap_i386;
17
18extern syscall_handler_t *sys_call_table[];
19
20#define EXECUTE_SYSCALL(syscall, regs) \
21 ((long (*)(struct syscall_args)) \
22 (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
23
24extern long sys_mmap2(unsigned long addr, unsigned long len,
25 unsigned long prot, unsigned long flags,
26 unsigned long fd, unsigned long pgoff);
diff --git a/arch/um/include/sysdep-i386/tls.h b/arch/um/include/sysdep-i386/tls.h
deleted file mode 100644
index 918fd3c5ff9c..000000000000
--- a/arch/um/include/sysdep-i386/tls.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _SYSDEP_TLS_H
2#define _SYSDEP_TLS_H
3
4# ifndef __KERNEL__
5
6/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
7 * may be named user_desc (but in 2.4 and in header matching its API was named
8 * modify_ldt_ldt_s). */
9
10typedef struct um_dup_user_desc {
11 unsigned int entry_number;
12 unsigned int base_addr;
13 unsigned int limit;
14 unsigned int seg_32bit:1;
15 unsigned int contents:2;
16 unsigned int read_exec_only:1;
17 unsigned int limit_in_pages:1;
18 unsigned int seg_not_present:1;
19 unsigned int useable:1;
20} user_desc_t;
21
22# else /* __KERNEL__ */
23
24# include <asm/ldt.h>
25typedef struct user_desc user_desc_t;
26
27# endif /* __KERNEL__ */
28
29#define GDT_ENTRY_TLS_MIN_I386 6
30#define GDT_ENTRY_TLS_MIN_X86_64 12
31
32#endif /* _SYSDEP_TLS_H */
diff --git a/arch/um/include/sysdep-ia64/skas_ptrace.h b/arch/um/include/sysdep-ia64/skas_ptrace.h
deleted file mode 100644
index 25a38e715702..000000000000
--- a/arch/um/include/sysdep-ia64/skas_ptrace.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_IA64_SKAS_PTRACE_H
7#define __SYSDEP_IA64_SKAS_PTRACE_H
8
9struct ptrace_faultinfo {
10 int is_write;
11 unsigned long addr;
12};
13
14struct ptrace_ldt {
15 int func;
16 void *ptr;
17 unsigned long bytecount;
18};
19
20#define PTRACE_LDT 54
21
22#endif
diff --git a/arch/um/include/sysdep-ppc/ptrace.h b/arch/um/include/sysdep-ppc/ptrace.h
deleted file mode 100644
index df2397dba3e5..000000000000
--- a/arch/um/include/sysdep-ppc/ptrace.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * Licensed under the GPL
3 */
4
5#ifndef __SYS_PTRACE_PPC_H
6#define __SYS_PTRACE_PPC_H
7
8#include "linux/types.h"
9
10/* the following taken from <asm-ppc/ptrace.h> */
11
12#ifdef CONFIG_PPC64
13#define PPC_REG unsigned long /*long*/
14#else
15#define PPC_REG unsigned long
16#endif
17struct sys_pt_regs_s {
18 PPC_REG gpr[32];
19 PPC_REG nip;
20 PPC_REG msr;
21 PPC_REG orig_gpr3; /* Used for restarting system calls */
22 PPC_REG ctr;
23 PPC_REG link;
24 PPC_REG xer;
25 PPC_REG ccr;
26 PPC_REG mq; /* 601 only (not used at present) */
27 /* Used on APUS to hold IPL value. */
28 PPC_REG trap; /* Reason for being here */
29 PPC_REG dar; /* Fault registers */
30 PPC_REG dsisr;
31 PPC_REG result; /* Result of a system call */
32};
33
34#define NUM_REGS (sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG))
35
36struct sys_pt_regs {
37 PPC_REG regs[sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG)];
38};
39
40#define UM_MAX_REG (PT_FPR0)
41#define UM_MAX_REG_OFFSET (UM_MAX_REG * sizeof(PPC_REG))
42
43#define EMPTY_REGS { { [ 0 ... NUM_REGS - 1] = 0 } }
44
45#define UM_REG(r, n) ((r)->regs[n])
46
47#define UM_SYSCALL_RET(r) UM_REG(r, PT_R3)
48#define UM_SP(r) UM_REG(r, PT_R1)
49#define UM_IP(r) UM_REG(r, PT_NIP)
50#define UM_ELF_ZERO(r) UM_REG(r, PT_FPSCR)
51#define UM_SYSCALL_NR(r) UM_REG(r, PT_R0)
52#define UM_SYSCALL_ARG1(r) UM_REG(r, PT_ORIG_R3)
53#define UM_SYSCALL_ARG2(r) UM_REG(r, PT_R4)
54#define UM_SYSCALL_ARG3(r) UM_REG(r, PT_R5)
55#define UM_SYSCALL_ARG4(r) UM_REG(r, PT_R6)
56#define UM_SYSCALL_ARG5(r) UM_REG(r, PT_R7)
57#define UM_SYSCALL_ARG6(r) UM_REG(r, PT_R8)
58
59#define UM_SYSCALL_NR_OFFSET (PT_R0 * sizeof(PPC_REG))
60#define UM_SYSCALL_RET_OFFSET (PT_R3 * sizeof(PPC_REG))
61#define UM_SYSCALL_ARG1_OFFSET (PT_R3 * sizeof(PPC_REG))
62#define UM_SYSCALL_ARG2_OFFSET (PT_R4 * sizeof(PPC_REG))
63#define UM_SYSCALL_ARG3_OFFSET (PT_R5 * sizeof(PPC_REG))
64#define UM_SYSCALL_ARG4_OFFSET (PT_R6 * sizeof(PPC_REG))
65#define UM_SYSCALL_ARG5_OFFSET (PT_R7 * sizeof(PPC_REG))
66#define UM_SYSCALL_ARG6_OFFSET (PT_R8 * sizeof(PPC_REG))
67#define UM_SP_OFFSET (PT_R1 * sizeof(PPC_REG))
68#define UM_IP_OFFSET (PT_NIP * sizeof(PPC_REG))
69#define UM_ELF_ZERO_OFFSET (PT_R3 * sizeof(PPC_REG))
70
71#define UM_SET_SYSCALL_RETURN(_regs, result) \
72do { \
73 if (result < 0) { \
74 (_regs)->regs[PT_CCR] |= 0x10000000; \
75 UM_SYSCALL_RET((_regs)) = -result; \
76 } else { \
77 UM_SYSCALL_RET((_regs)) = result; \
78 } \
79} while(0)
80
81extern void shove_aux_table(unsigned long sp);
82#define UM_FIX_EXEC_STACK(sp) shove_aux_table(sp);
83
84/* These aren't actually defined. The undefs are just to make sure
85 * everyone's clear on the concept.
86 */
87#undef UML_HAVE_GETREGS
88#undef UML_HAVE_GETFPREGS
89#undef UML_HAVE_SETREGS
90#undef UML_HAVE_SETFPREGS
91
92#endif
93
94/*
95 * Overrides for Emacs so that we follow Linus's tabbing style.
96 * Emacs will notice this stuff at the end of the file and automatically
97 * adjust the settings for this buffer only. This must remain at the end
98 * of the file.
99 * ---------------------------------------------------------------------------
100 * Local variables:
101 * c-file-style: "linux"
102 * End:
103 */
diff --git a/arch/um/include/sysdep-ppc/sigcontext.h b/arch/um/include/sysdep-ppc/sigcontext.h
deleted file mode 100644
index f20d965de9c7..000000000000
--- a/arch/um/include/sysdep-ppc/sigcontext.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYS_SIGCONTEXT_PPC_H
7#define __SYS_SIGCONTEXT_PPC_H
8
9#define DSISR_WRITE 0x02000000
10
11#define SC_FAULT_ADDR(sc) ({ \
12 struct sigcontext *_sc = (sc); \
13 long retval = -1; \
14 switch (_sc->regs->trap) { \
15 case 0x300: \
16 /* data exception */ \
17 retval = _sc->regs->dar; \
18 break; \
19 case 0x400: \
20 /* instruction exception */ \
21 retval = _sc->regs->nip; \
22 break; \
23 default: \
24 panic("SC_FAULT_ADDR: unhandled trap type\n"); \
25 } \
26 retval; \
27 })
28
29#define SC_FAULT_WRITE(sc) ({ \
30 struct sigcontext *_sc = (sc); \
31 long retval = -1; \
32 switch (_sc->regs->trap) { \
33 case 0x300: \
34 /* data exception */ \
35 retval = !!(_sc->regs->dsisr & DSISR_WRITE); \
36 break; \
37 case 0x400: \
38 /* instruction exception: not a write */ \
39 retval = 0; \
40 break; \
41 default: \
42 panic("SC_FAULT_ADDR: unhandled trap type\n"); \
43 } \
44 retval; \
45 })
46
47#define SC_IP(sc) ((sc)->regs->nip)
48#define SC_SP(sc) ((sc)->regs->gpr[1])
49#define SEGV_IS_FIXABLE(sc) (1)
50
51#endif
52
53/*
54 * Overrides for Emacs so that we follow Linus's tabbing style.
55 * Emacs will notice this stuff at the end of the file and automatically
56 * adjust the settings for this buffer only. This must remain at the end
57 * of the file.
58 * ---------------------------------------------------------------------------
59 * Local variables:
60 * c-file-style: "linux"
61 * End:
62 */
diff --git a/arch/um/include/sysdep-ppc/skas_ptrace.h b/arch/um/include/sysdep-ppc/skas_ptrace.h
deleted file mode 100644
index d9fbbac10de0..000000000000
--- a/arch/um/include/sysdep-ppc/skas_ptrace.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_PPC_SKAS_PTRACE_H
7#define __SYSDEP_PPC_SKAS_PTRACE_H
8
9struct ptrace_faultinfo {
10 int is_write;
11 unsigned long addr;
12};
13
14struct ptrace_ldt {
15 int func;
16 void *ptr;
17 unsigned long bytecount;
18};
19
20#define PTRACE_LDT 54
21
22#endif
diff --git a/arch/um/include/sysdep-ppc/syscalls.h b/arch/um/include/sysdep-ppc/syscalls.h
deleted file mode 100644
index 679df351e19b..000000000000
--- a/arch/um/include/sysdep-ppc/syscalls.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6typedef long syscall_handler_t(unsigned long arg1, unsigned long arg2,
7 unsigned long arg3, unsigned long arg4,
8 unsigned long arg5, unsigned long arg6);
9
10#define EXECUTE_SYSCALL(syscall, regs) \
11 (*sys_call_table[syscall])(UM_SYSCALL_ARG1(&regs), \
12 UM_SYSCALL_ARG2(&regs), \
13 UM_SYSCALL_ARG3(&regs), \
14 UM_SYSCALL_ARG4(&regs), \
15 UM_SYSCALL_ARG5(&regs), \
16 UM_SYSCALL_ARG6(&regs))
17
18extern syscall_handler_t sys_mincore;
19extern syscall_handler_t sys_madvise;
20
21/* old_mmap needs the correct prototype since syscall_kern.c includes
22 * this file.
23 */
24int old_mmap(unsigned long addr, unsigned long len,
25 unsigned long prot, unsigned long flags,
26 unsigned long fd, unsigned long offset);
27
28#define ARCH_SYSCALLS \
29 [ __NR_modify_ldt ] = sys_ni_syscall, \
30 [ __NR_pciconfig_read ] = sys_ni_syscall, \
31 [ __NR_pciconfig_write ] = sys_ni_syscall, \
32 [ __NR_pciconfig_iobase ] = sys_ni_syscall, \
33 [ __NR_pivot_root ] = sys_ni_syscall, \
34 [ __NR_multiplexer ] = sys_ni_syscall, \
35 [ __NR_mmap ] = old_mmap, \
36 [ __NR_madvise ] = sys_madvise, \
37 [ __NR_mincore ] = sys_mincore, \
38 [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
39 [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \
40 [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64,
41
42#define LAST_ARCH_SYSCALL __NR_fadvise64
43
44/*
45 * Overrides for Emacs so that we follow Linus's tabbing style.
46 * Emacs will notice this stuff at the end of the file and automatically
47 * adjust the settings for this buffer only. This must remain at the end
48 * of the file.
49 * ---------------------------------------------------------------------------
50 * Local variables:
51 * c-file-style: "linux"
52 * End:
53 */
diff --git a/arch/um/include/sysdep-x86_64/archsetjmp.h b/arch/um/include/sysdep-x86_64/archsetjmp.h
deleted file mode 100644
index 2af8f12ca161..000000000000
--- a/arch/um/include/sysdep-x86_64/archsetjmp.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * arch/um/include/sysdep-x86_64/archsetjmp.h
3 */
4
5#ifndef _KLIBC_ARCHSETJMP_H
6#define _KLIBC_ARCHSETJMP_H
7
8struct __jmp_buf {
9 unsigned long __rbx;
10 unsigned long __rsp;
11 unsigned long __rbp;
12 unsigned long __r12;
13 unsigned long __r13;
14 unsigned long __r14;
15 unsigned long __r15;
16 unsigned long __rip;
17};
18
19typedef struct __jmp_buf jmp_buf[1];
20
21#define JB_IP __rip
22#define JB_SP __rsp
23
24#endif /* _SETJMP_H */
diff --git a/arch/um/include/sysdep-x86_64/barrier.h b/arch/um/include/sysdep-x86_64/barrier.h
deleted file mode 100644
index 7b610befdc8f..000000000000
--- a/arch/um/include/sysdep-x86_64/barrier.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __SYSDEP_X86_64_BARRIER_H
2#define __SYSDEP_X86_64_BARRIER_H
3
4/* Copied from include/asm-x86_64 for use by userspace. */
5#define mb() asm volatile("mfence":::"memory")
6
7#endif
diff --git a/arch/um/include/sysdep-x86_64/checksum.h b/arch/um/include/sysdep-x86_64/checksum.h
deleted file mode 100644
index a5be9031ea85..000000000000
--- a/arch/um/include/sysdep-x86_64/checksum.h
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 * Licensed under the GPL
3 */
4
5#ifndef __UM_SYSDEP_CHECKSUM_H
6#define __UM_SYSDEP_CHECKSUM_H
7
8#include "linux/string.h"
9#include "linux/in6.h"
10#include "asm/uaccess.h"
11
12extern __wsum csum_partial(const void *buff, int len, __wsum sum);
13
14/*
15 * Note: when you get a NULL pointer exception here this means someone
16 * passed in an incorrect kernel address to one of these functions.
17 *
18 * If you use these functions directly please don't forget the
19 * access_ok().
20 */
21
22static __inline__
23__wsum csum_partial_copy_nocheck(const void *src, void *dst,
24 int len, __wsum sum)
25{
26 memcpy(dst, src, len);
27 return(csum_partial(dst, len, sum));
28}
29
30static __inline__
31__wsum csum_partial_copy_from_user(const void __user *src,
32 void *dst, int len, __wsum sum,
33 int *err_ptr)
34{
35 if (copy_from_user(dst, src, len)) {
36 *err_ptr = -EFAULT;
37 return (__force __wsum)-1;
38 }
39 return csum_partial(dst, len, sum);
40}
41
42/**
43 * csum_fold - Fold and invert a 32bit checksum.
44 * sum: 32bit unfolded sum
45 *
46 * Fold a 32bit running checksum to 16bit and invert it. This is usually
47 * the last step before putting a checksum into a packet.
48 * Make sure not to mix with 64bit checksums.
49 */
50static inline __sum16 csum_fold(__wsum sum)
51{
52 __asm__(
53 " addl %1,%0\n"
54 " adcl $0xffff,%0"
55 : "=r" (sum)
56 : "r" ((__force u32)sum << 16),
57 "0" ((__force u32)sum & 0xffff0000)
58 );
59 return (__force __sum16)(~(__force u32)sum >> 16);
60}
61
62/**
63 * csum_tcpup_nofold - Compute an IPv4 pseudo header checksum.
64 * @saddr: source address
65 * @daddr: destination address
66 * @len: length of packet
67 * @proto: ip protocol of packet
68 * @sum: initial sum to be added in (32bit unfolded)
69 *
70 * Returns the pseudo header checksum the input data. Result is
71 * 32bit unfolded.
72 */
73static inline __wsum
74csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
75 unsigned short proto, __wsum sum)
76{
77 asm(" addl %1, %0\n"
78 " adcl %2, %0\n"
79 " adcl %3, %0\n"
80 " adcl $0, %0\n"
81 : "=r" (sum)
82 : "g" (daddr), "g" (saddr), "g" ((len + proto) << 8), "0" (sum));
83 return sum;
84}
85
86/*
87 * computes the checksum of the TCP/UDP pseudo-header
88 * returns a 16-bit checksum, already complemented
89 */
90static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
91 unsigned short len,
92 unsigned short proto,
93 __wsum sum)
94{
95 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
96}
97
98/**
99 * ip_fast_csum - Compute the IPv4 header checksum efficiently.
100 * iph: ipv4 header
101 * ihl: length of header / 4
102 */
103static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
104{
105 unsigned int sum;
106
107 asm( " movl (%1), %0\n"
108 " subl $4, %2\n"
109 " jbe 2f\n"
110 " addl 4(%1), %0\n"
111 " adcl 8(%1), %0\n"
112 " adcl 12(%1), %0\n"
113 "1: adcl 16(%1), %0\n"
114 " lea 4(%1), %1\n"
115 " decl %2\n"
116 " jne 1b\n"
117 " adcl $0, %0\n"
118 " movl %0, %2\n"
119 " shrl $16, %0\n"
120 " addw %w2, %w0\n"
121 " adcl $0, %0\n"
122 " notl %0\n"
123 "2:"
124 /* Since the input registers which are loaded with iph and ipl
125 are modified, we must also specify them as outputs, or gcc
126 will assume they contain their original values. */
127 : "=r" (sum), "=r" (iph), "=r" (ihl)
128 : "1" (iph), "2" (ihl)
129 : "memory");
130 return (__force __sum16)sum;
131}
132
133static inline unsigned add32_with_carry(unsigned a, unsigned b)
134{
135 asm("addl %2,%0\n\t"
136 "adcl $0,%0"
137 : "=r" (a)
138 : "0" (a), "r" (b));
139 return a;
140}
141
142extern __sum16 ip_compute_csum(const void *buff, int len);
143
144#endif
diff --git a/arch/um/include/sysdep-x86_64/faultinfo.h b/arch/um/include/sysdep-x86_64/faultinfo.h
deleted file mode 100644
index cb917b0d5660..000000000000
--- a/arch/um/include/sysdep-x86_64/faultinfo.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
4 * Licensed under the GPL
5 */
6
7#ifndef __FAULTINFO_X86_64_H
8#define __FAULTINFO_X86_64_H
9
10/* this structure contains the full arch-specific faultinfo
11 * from the traps.
12 * On i386, ptrace_faultinfo unfortunately doesn't provide
13 * all the info, since trap_no is missing.
14 * All common elements are defined at the same position in
15 * both structures, thus making it easy to copy the
16 * contents without knowledge about the structure elements.
17 */
18struct faultinfo {
19 int error_code; /* in ptrace_faultinfo misleadingly called is_write */
20 unsigned long cr2; /* in ptrace_faultinfo called addr */
21 int trap_no; /* missing in ptrace_faultinfo */
22};
23
24#define FAULT_WRITE(fi) ((fi).error_code & 2)
25#define FAULT_ADDRESS(fi) ((fi).cr2)
26
27#define PTRACE_FULL_FAULTINFO 1
28
29#endif
diff --git a/arch/um/include/sysdep-x86_64/kernel-offsets.h b/arch/um/include/sysdep-x86_64/kernel-offsets.h
deleted file mode 100644
index a307237b7964..000000000000
--- a/arch/um/include/sysdep-x86_64/kernel-offsets.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#include <linux/stddef.h>
2#include <linux/sched.h>
3#include <linux/time.h>
4#include <linux/elf.h>
5#include <linux/crypto.h>
6#include <asm/page.h>
7#include <asm/mman.h>
8
9#define DEFINE(sym, val) \
10 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
11
12#define DEFINE_STR1(x) #x
13#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : )
14
15#define BLANK() asm volatile("\n->" : : )
16
17#define OFFSET(sym, str, mem) \
18 DEFINE(sym, offsetof(struct str, mem));
19
20void foo(void)
21{
22#include <common-offsets.h>
23}
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
deleted file mode 100644
index 9ea44d111f33..000000000000
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ /dev/null
@@ -1,240 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 *
5 * Licensed under the GPL
6 */
7
8#ifndef __SYSDEP_X86_64_PTRACE_H
9#define __SYSDEP_X86_64_PTRACE_H
10
11#include "uml-config.h"
12#include "user_constants.h"
13#include "sysdep/faultinfo.h"
14
15#define MAX_REG_OFFSET (UM_FRAME_SIZE)
16#define MAX_REG_NR ((MAX_REG_OFFSET) / sizeof(unsigned long))
17
18#include "skas_ptregs.h"
19
20#define REGS_IP(r) ((r)[HOST_IP])
21#define REGS_SP(r) ((r)[HOST_SP])
22
23#define REGS_RBX(r) ((r)[HOST_RBX])
24#define REGS_RCX(r) ((r)[HOST_RCX])
25#define REGS_RDX(r) ((r)[HOST_RDX])
26#define REGS_RSI(r) ((r)[HOST_RSI])
27#define REGS_RDI(r) ((r)[HOST_RDI])
28#define REGS_RBP(r) ((r)[HOST_RBP])
29#define REGS_RAX(r) ((r)[HOST_RAX])
30#define REGS_R8(r) ((r)[HOST_R8])
31#define REGS_R9(r) ((r)[HOST_R9])
32#define REGS_R10(r) ((r)[HOST_R10])
33#define REGS_R11(r) ((r)[HOST_R11])
34#define REGS_R12(r) ((r)[HOST_R12])
35#define REGS_R13(r) ((r)[HOST_R13])
36#define REGS_R14(r) ((r)[HOST_R14])
37#define REGS_R15(r) ((r)[HOST_R15])
38#define REGS_CS(r) ((r)[HOST_CS])
39#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
40#define REGS_SS(r) ((r)[HOST_SS])
41
42#define HOST_FS_BASE 21
43#define HOST_GS_BASE 22
44#define HOST_DS 23
45#define HOST_ES 24
46#define HOST_FS 25
47#define HOST_GS 26
48
49/* Also defined in asm/ptrace-x86_64.h, but not in libc headers. So, these
50 * are already defined for kernel code, but not for userspace code.
51 */
52#ifndef FS_BASE
53/* These aren't defined in ptrace.h, but exist in struct user_regs_struct,
54 * which is what x86_64 ptrace actually uses.
55 */
56#define FS_BASE (HOST_FS_BASE * sizeof(long))
57#define GS_BASE (HOST_GS_BASE * sizeof(long))
58#define DS (HOST_DS * sizeof(long))
59#define ES (HOST_ES * sizeof(long))
60#define FS (HOST_FS * sizeof(long))
61#define GS (HOST_GS * sizeof(long))
62#endif
63
64#define REGS_FS_BASE(r) ((r)[HOST_FS_BASE])
65#define REGS_GS_BASE(r) ((r)[HOST_GS_BASE])
66#define REGS_DS(r) ((r)[HOST_DS])
67#define REGS_ES(r) ((r)[HOST_ES])
68#define REGS_FS(r) ((r)[HOST_FS])
69#define REGS_GS(r) ((r)[HOST_GS])
70
71#define REGS_ORIG_RAX(r) ((r)[HOST_ORIG_RAX])
72
73#define REGS_SET_SYSCALL_RETURN(r, res) REGS_RAX(r) = (res)
74
75#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
76
77#define REGS_SEGV_IS_FIXABLE(r) SEGV_IS_FIXABLE((r)->trap_type)
78
79#define REGS_FAULT_ADDR(r) ((r)->fault_addr)
80
81#define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type)
82
83#define REGS_TRAP(r) ((r)->trap_type)
84
85#define REGS_ERR(r) ((r)->fault_type)
86
87struct uml_pt_regs {
88 unsigned long gp[MAX_REG_NR];
89 struct faultinfo faultinfo;
90 long syscall;
91 int is_user;
92};
93
94#define EMPTY_UML_PT_REGS { }
95
96#define UPT_RBX(r) REGS_RBX((r)->gp)
97#define UPT_RCX(r) REGS_RCX((r)->gp)
98#define UPT_RDX(r) REGS_RDX((r)->gp)
99#define UPT_RSI(r) REGS_RSI((r)->gp)
100#define UPT_RDI(r) REGS_RDI((r)->gp)
101#define UPT_RBP(r) REGS_RBP((r)->gp)
102#define UPT_RAX(r) REGS_RAX((r)->gp)
103#define UPT_R8(r) REGS_R8((r)->gp)
104#define UPT_R9(r) REGS_R9((r)->gp)
105#define UPT_R10(r) REGS_R10((r)->gp)
106#define UPT_R11(r) REGS_R11((r)->gp)
107#define UPT_R12(r) REGS_R12((r)->gp)
108#define UPT_R13(r) REGS_R13((r)->gp)
109#define UPT_R14(r) REGS_R14((r)->gp)
110#define UPT_R15(r) REGS_R15((r)->gp)
111#define UPT_CS(r) REGS_CS((r)->gp)
112#define UPT_FS_BASE(r) REGS_FS_BASE((r)->gp)
113#define UPT_FS(r) REGS_FS((r)->gp)
114#define UPT_GS_BASE(r) REGS_GS_BASE((r)->gp)
115#define UPT_GS(r) REGS_GS((r)->gp)
116#define UPT_DS(r) REGS_DS((r)->gp)
117#define UPT_ES(r) REGS_ES((r)->gp)
118#define UPT_CS(r) REGS_CS((r)->gp)
119#define UPT_SS(r) REGS_SS((r)->gp)
120#define UPT_ORIG_RAX(r) REGS_ORIG_RAX((r)->gp)
121
122#define UPT_IP(r) REGS_IP((r)->gp)
123#define UPT_SP(r) REGS_SP((r)->gp)
124
125#define UPT_EFLAGS(r) REGS_EFLAGS((r)->gp)
126#define UPT_SYSCALL_NR(r) ((r)->syscall)
127#define UPT_SYSCALL_RET(r) UPT_RAX(r)
128
129extern int user_context(unsigned long sp);
130
131#define UPT_IS_USER(r) ((r)->is_user)
132
133#define UPT_SYSCALL_ARG1(r) UPT_RDI(r)
134#define UPT_SYSCALL_ARG2(r) UPT_RSI(r)
135#define UPT_SYSCALL_ARG3(r) UPT_RDX(r)
136#define UPT_SYSCALL_ARG4(r) UPT_R10(r)
137#define UPT_SYSCALL_ARG5(r) UPT_R8(r)
138#define UPT_SYSCALL_ARG6(r) UPT_R9(r)
139
140struct syscall_args {
141 unsigned long args[6];
142};
143
144#define SYSCALL_ARGS(r) ((struct syscall_args) \
145 { .args = { UPT_SYSCALL_ARG1(r), \
146 UPT_SYSCALL_ARG2(r), \
147 UPT_SYSCALL_ARG3(r), \
148 UPT_SYSCALL_ARG4(r), \
149 UPT_SYSCALL_ARG5(r), \
150 UPT_SYSCALL_ARG6(r) } } )
151
152#define UPT_REG(regs, reg) \
153 ({ unsigned long val; \
154 switch(reg){ \
155 case R8: val = UPT_R8(regs); break; \
156 case R9: val = UPT_R9(regs); break; \
157 case R10: val = UPT_R10(regs); break; \
158 case R11: val = UPT_R11(regs); break; \
159 case R12: val = UPT_R12(regs); break; \
160 case R13: val = UPT_R13(regs); break; \
161 case R14: val = UPT_R14(regs); break; \
162 case R15: val = UPT_R15(regs); break; \
163 case RIP: val = UPT_IP(regs); break; \
164 case RSP: val = UPT_SP(regs); break; \
165 case RAX: val = UPT_RAX(regs); break; \
166 case RBX: val = UPT_RBX(regs); break; \
167 case RCX: val = UPT_RCX(regs); break; \
168 case RDX: val = UPT_RDX(regs); break; \
169 case RSI: val = UPT_RSI(regs); break; \
170 case RDI: val = UPT_RDI(regs); break; \
171 case RBP: val = UPT_RBP(regs); break; \
172 case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \
173 case CS: val = UPT_CS(regs); break; \
174 case SS: val = UPT_SS(regs); break; \
175 case FS_BASE: val = UPT_FS_BASE(regs); break; \
176 case GS_BASE: val = UPT_GS_BASE(regs); break; \
177 case DS: val = UPT_DS(regs); break; \
178 case ES: val = UPT_ES(regs); break; \
179 case FS : val = UPT_FS (regs); break; \
180 case GS: val = UPT_GS(regs); break; \
181 case EFLAGS: val = UPT_EFLAGS(regs); break; \
182 default : \
183 panic("Bad register in UPT_REG : %d\n", reg); \
184 val = -1; \
185 } \
186 val; \
187 })
188
189
190#define UPT_SET(regs, reg, val) \
191 ({ unsigned long __upt_val = val; \
192 switch(reg){ \
193 case R8: UPT_R8(regs) = __upt_val; break; \
194 case R9: UPT_R9(regs) = __upt_val; break; \
195 case R10: UPT_R10(regs) = __upt_val; break; \
196 case R11: UPT_R11(regs) = __upt_val; break; \
197 case R12: UPT_R12(regs) = __upt_val; break; \
198 case R13: UPT_R13(regs) = __upt_val; break; \
199 case R14: UPT_R14(regs) = __upt_val; break; \
200 case R15: UPT_R15(regs) = __upt_val; break; \
201 case RIP: UPT_IP(regs) = __upt_val; break; \
202 case RSP: UPT_SP(regs) = __upt_val; break; \
203 case RAX: UPT_RAX(regs) = __upt_val; break; \
204 case RBX: UPT_RBX(regs) = __upt_val; break; \
205 case RCX: UPT_RCX(regs) = __upt_val; break; \
206 case RDX: UPT_RDX(regs) = __upt_val; break; \
207 case RSI: UPT_RSI(regs) = __upt_val; break; \
208 case RDI: UPT_RDI(regs) = __upt_val; break; \
209 case RBP: UPT_RBP(regs) = __upt_val; break; \
210 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \
211 case CS: UPT_CS(regs) = __upt_val; break; \
212 case SS: UPT_SS(regs) = __upt_val; break; \
213 case FS_BASE: UPT_FS_BASE(regs) = __upt_val; break; \
214 case GS_BASE: UPT_GS_BASE(regs) = __upt_val; break; \
215 case DS: UPT_DS(regs) = __upt_val; break; \
216 case ES: UPT_ES(regs) = __upt_val; break; \
217 case FS: UPT_FS(regs) = __upt_val; break; \
218 case GS: UPT_GS(regs) = __upt_val; break; \
219 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \
220 default : \
221 panic("Bad register in UPT_SET : %d\n", reg); \
222 break; \
223 } \
224 __upt_val; \
225 })
226
227#define UPT_SET_SYSCALL_RETURN(r, res) \
228 REGS_SET_SYSCALL_RETURN((r)->regs, (res))
229
230#define UPT_RESTART_SYSCALL(r) REGS_RESTART_SYSCALL((r)->gp)
231
232#define UPT_SEGV_IS_FIXABLE(r) REGS_SEGV_IS_FIXABLE(&r->skas)
233
234#define UPT_FAULTINFO(r) (&(r)->faultinfo)
235
236static inline void arch_init_registers(int pid)
237{
238}
239
240#endif
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h
deleted file mode 100644
index 4dbccdb58f48..000000000000
--- a/arch/um/include/sysdep-x86_64/ptrace_user.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_PTRACE_USER_H__
8#define __SYSDEP_X86_64_PTRACE_USER_H__
9
10#define __FRAME_OFFSETS
11#include <sys/ptrace.h>
12#include <linux/ptrace.h>
13#include <asm/ptrace.h>
14#undef __FRAME_OFFSETS
15#include "user_constants.h"
16
17#define PT_INDEX(off) ((off) / sizeof(unsigned long))
18
19#define PT_SYSCALL_NR(regs) ((regs)[PT_INDEX(ORIG_RAX)])
20#define PT_SYSCALL_NR_OFFSET (ORIG_RAX)
21
22#define PT_SYSCALL_ARG1(regs) (((unsigned long *) (regs))[PT_INDEX(RDI)])
23#define PT_SYSCALL_ARG1_OFFSET (RDI)
24
25#define PT_SYSCALL_ARG2(regs) (((unsigned long *) (regs))[PT_INDEX(RSI)])
26#define PT_SYSCALL_ARG2_OFFSET (RSI)
27
28#define PT_SYSCALL_ARG3(regs) (((unsigned long *) (regs))[PT_INDEX(RDX)])
29#define PT_SYSCALL_ARG3_OFFSET (RDX)
30
31#define PT_SYSCALL_ARG4(regs) (((unsigned long *) (regs))[PT_INDEX(RCX)])
32#define PT_SYSCALL_ARG4_OFFSET (RCX)
33
34#define PT_SYSCALL_ARG5(regs) (((unsigned long *) (regs))[PT_INDEX(R8)])
35#define PT_SYSCALL_ARG5_OFFSET (R8)
36
37#define PT_SYSCALL_ARG6(regs) (((unsigned long *) (regs))[PT_INDEX(R9)])
38#define PT_SYSCALL_ARG6_OFFSET (R9)
39
40#define PT_SYSCALL_RET_OFFSET (RAX)
41
42#define PT_IP_OFFSET (RIP)
43#define PT_IP(regs) ((regs)[PT_INDEX(RIP)])
44
45#define PT_SP_OFFSET (RSP)
46#define PT_SP(regs) ((regs)[PT_INDEX(RSP)])
47
48#define PT_ORIG_RAX_OFFSET (ORIG_RAX)
49#define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)])
50
51/*
52 * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though
53 * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the
54 * 2.4 name and value for 2.4 host compatibility.
55 */
56#ifndef PTRACE_OLDSETOPTIONS
57#define PTRACE_OLDSETOPTIONS 21
58#endif
59
60/*
61 * These are before the system call, so the system call number is RAX
62 * rather than ORIG_RAX, and arg4 is R10 rather than RCX
63 */
64#define REGS_SYSCALL_NR PT_INDEX(RAX)
65#define REGS_SYSCALL_ARG1 PT_INDEX(RDI)
66#define REGS_SYSCALL_ARG2 PT_INDEX(RSI)
67#define REGS_SYSCALL_ARG3 PT_INDEX(RDX)
68#define REGS_SYSCALL_ARG4 PT_INDEX(R10)
69#define REGS_SYSCALL_ARG5 PT_INDEX(R8)
70#define REGS_SYSCALL_ARG6 PT_INDEX(R9)
71
72#define REGS_IP_INDEX PT_INDEX(RIP)
73#define REGS_SP_INDEX PT_INDEX(RSP)
74
75#define FP_SIZE (HOST_FP_SIZE)
76
77#endif
diff --git a/arch/um/include/sysdep-x86_64/sc.h b/arch/um/include/sysdep-x86_64/sc.h
deleted file mode 100644
index 8aee45b07434..000000000000
--- a/arch/um/include/sysdep-x86_64/sc.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#ifndef __SYSDEP_X86_64_SC_H
2#define __SYSDEP_X86_64_SC_H
3
4/* Copyright (C) 2003 - 2004 PathScale, Inc
5 * Released under the GPL
6 */
7
8#include <user_constants.h>
9
10#define SC_OFFSET(sc, field) \
11 *((unsigned long *) &(((char *) (sc))[HOST_##field]))
12
13#define SC_RBX(sc) SC_OFFSET(sc, SC_RBX)
14#define SC_RCX(sc) SC_OFFSET(sc, SC_RCX)
15#define SC_RDX(sc) SC_OFFSET(sc, SC_RDX)
16#define SC_RSI(sc) SC_OFFSET(sc, SC_RSI)
17#define SC_RDI(sc) SC_OFFSET(sc, SC_RDI)
18#define SC_RBP(sc) SC_OFFSET(sc, SC_RBP)
19#define SC_RAX(sc) SC_OFFSET(sc, SC_RAX)
20#define SC_R8(sc) SC_OFFSET(sc, SC_R8)
21#define SC_R9(sc) SC_OFFSET(sc, SC_R9)
22#define SC_R10(sc) SC_OFFSET(sc, SC_R10)
23#define SC_R11(sc) SC_OFFSET(sc, SC_R11)
24#define SC_R12(sc) SC_OFFSET(sc, SC_R12)
25#define SC_R13(sc) SC_OFFSET(sc, SC_R13)
26#define SC_R14(sc) SC_OFFSET(sc, SC_R14)
27#define SC_R15(sc) SC_OFFSET(sc, SC_R15)
28#define SC_IP(sc) SC_OFFSET(sc, SC_IP)
29#define SC_SP(sc) SC_OFFSET(sc, SC_SP)
30#define SC_CR2(sc) SC_OFFSET(sc, SC_CR2)
31#define SC_ERR(sc) SC_OFFSET(sc, SC_ERR)
32#define SC_TRAPNO(sc) SC_OFFSET(sc, SC_TRAPNO)
33#define SC_CS(sc) SC_OFFSET(sc, SC_CS)
34#define SC_FS(sc) SC_OFFSET(sc, SC_FS)
35#define SC_GS(sc) SC_OFFSET(sc, SC_GS)
36#define SC_EFLAGS(sc) SC_OFFSET(sc, SC_EFLAGS)
37#define SC_SIGMASK(sc) SC_OFFSET(sc, SC_SIGMASK)
38#define SC_SS(sc) SC_OFFSET(sc, SC_SS)
39#if 0
40#define SC_ORIG_RAX(sc) SC_OFFSET(sc, SC_ORIG_RAX)
41#define SC_DS(sc) SC_OFFSET(sc, SC_DS)
42#define SC_ES(sc) SC_OFFSET(sc, SC_ES)
43#endif
44
45#endif
diff --git a/arch/um/include/sysdep-x86_64/sigcontext.h b/arch/um/include/sysdep-x86_64/sigcontext.h
deleted file mode 100644
index 0155133b1458..000000000000
--- a/arch/um/include/sysdep-x86_64/sigcontext.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_SIGCONTEXT_H
8#define __SYSDEP_X86_64_SIGCONTEXT_H
9
10#include <sysdep/sc.h>
11
12#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
13
14#define GET_FAULTINFO_FROM_SC(fi, sc) \
15 { \
16 (fi).cr2 = SC_CR2(sc); \
17 (fi).error_code = SC_ERR(sc); \
18 (fi).trap_no = SC_TRAPNO(sc); \
19 }
20
21/* This is Page Fault */
22#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
23
24/* No broken SKAS API, which doesn't pass trap_no, here. */
25#define SEGV_MAYBE_FIXABLE(fi) 0
26
27#endif
diff --git a/arch/um/include/sysdep-x86_64/skas_ptrace.h b/arch/um/include/sysdep-x86_64/skas_ptrace.h
deleted file mode 100644
index 95db4be786e4..000000000000
--- a/arch/um/include/sysdep-x86_64/skas_ptrace.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_X86_64_SKAS_PTRACE_H
7#define __SYSDEP_X86_64_SKAS_PTRACE_H
8
9struct ptrace_faultinfo {
10 int is_write;
11 unsigned long addr;
12};
13
14struct ptrace_ldt {
15 int func;
16 void *ptr;
17 unsigned long bytecount;
18};
19
20#define PTRACE_LDT 54
21
22#endif
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h
deleted file mode 100644
index 655f9c2de3ac..000000000000
--- a/arch/um/include/sysdep-x86_64/stub.h
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H
8
9#include <sys/mman.h>
10#include <asm/unistd.h>
11#include <sysdep/ptrace_user.h>
12#include "as-layout.h"
13#include "stub-data.h"
14#include "kern_constants.h"
15#include "uml-config.h"
16
17extern void stub_segv_handler(int sig);
18extern void stub_clone_handler(void);
19
20#define STUB_SYSCALL_RET PT_INDEX(RAX)
21#define STUB_MMAP_NR __NR_mmap
22#define MMAP_OFFSET(o) (o)
23
24#define __syscall_clobber "r11","rcx","memory"
25#define __syscall "syscall"
26
27static inline long stub_syscall0(long syscall)
28{
29 long ret;
30
31 __asm__ volatile (__syscall
32 : "=a" (ret)
33 : "0" (syscall) : __syscall_clobber );
34
35 return ret;
36}
37
38static inline long stub_syscall2(long syscall, long arg1, long arg2)
39{
40 long ret;
41
42 __asm__ volatile (__syscall
43 : "=a" (ret)
44 : "0" (syscall), "D" (arg1), "S" (arg2) : __syscall_clobber );
45
46 return ret;
47}
48
49static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
50{
51 long ret;
52
53 __asm__ volatile (__syscall
54 : "=a" (ret)
55 : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3)
56 : __syscall_clobber );
57
58 return ret;
59}
60
61static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
62 long arg4)
63{
64 long ret;
65
66 __asm__ volatile ("movq %5,%%r10 ; " __syscall
67 : "=a" (ret)
68 : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
69 "g" (arg4)
70 : __syscall_clobber, "r10" );
71
72 return ret;
73}
74
75static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
76 long arg4, long arg5)
77{
78 long ret;
79
80 __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall
81 : "=a" (ret)
82 : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
83 "g" (arg4), "g" (arg5)
84 : __syscall_clobber, "r10", "r8" );
85
86 return ret;
87}
88
89static inline void trap_myself(void)
90{
91 __asm("int3");
92}
93
94static inline void remap_stack(long fd, unsigned long offset)
95{
96 __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; "
97 "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; "
98 "movq %%rax, (%%rbx)":
99 : "a" (STUB_MMAP_NR), "D" (STUB_DATA),
100 "S" (UM_KERN_PAGE_SIZE),
101 "d" (PROT_READ | PROT_WRITE),
102 "g" (MAP_FIXED | MAP_SHARED), "g" (fd),
103 "g" (offset),
104 "i" (&((struct stub_data *) STUB_DATA)->err)
105 : __syscall_clobber, "r10", "r8", "r9" );
106}
107
108#endif
diff --git a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h
deleted file mode 100644
index 7cfb0b085655..000000000000
--- a/arch/um/include/sysdep-x86_64/syscalls.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#ifndef __SYSDEP_X86_64_SYSCALLS_H__
8#define __SYSDEP_X86_64_SYSCALLS_H__
9
10#include <linux/msg.h>
11#include <linux/shm.h>
12#include <kern_constants.h>
13
14typedef long syscall_handler_t(void);
15
16extern syscall_handler_t *sys_call_table[];
17
18#define EXECUTE_SYSCALL(syscall, regs) \
19 (((long (*)(long, long, long, long, long, long)) \
20 (*sys_call_table[syscall]))(UPT_SYSCALL_ARG1(&regs->regs), \
21 UPT_SYSCALL_ARG2(&regs->regs), \
22 UPT_SYSCALL_ARG3(&regs->regs), \
23 UPT_SYSCALL_ARG4(&regs->regs), \
24 UPT_SYSCALL_ARG5(&regs->regs), \
25 UPT_SYSCALL_ARG6(&regs->regs)))
26
27extern long old_mmap(unsigned long addr, unsigned long len,
28 unsigned long prot, unsigned long flags,
29 unsigned long fd, unsigned long pgoff);
30extern syscall_handler_t sys_modify_ldt;
31extern syscall_handler_t sys_arch_prctl;
32
33#endif
diff --git a/arch/um/include/sysdep-x86_64/tls.h b/arch/um/include/sysdep-x86_64/tls.h
deleted file mode 100644
index 35f19f25bd3b..000000000000
--- a/arch/um/include/sysdep-x86_64/tls.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _SYSDEP_TLS_H
2#define _SYSDEP_TLS_H
3
4# ifndef __KERNEL__
5
6/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
7 * may be named user_desc (but in 2.4 and in header matching its API was named
8 * modify_ldt_ldt_s). */
9
10typedef struct um_dup_user_desc {
11 unsigned int entry_number;
12 unsigned int base_addr;
13 unsigned int limit;
14 unsigned int seg_32bit:1;
15 unsigned int contents:2;
16 unsigned int read_exec_only:1;
17 unsigned int limit_in_pages:1;
18 unsigned int seg_not_present:1;
19 unsigned int useable:1;
20 unsigned int lm:1;
21} user_desc_t;
22
23# else /* __KERNEL__ */
24
25# include <asm/ldt.h>
26typedef struct user_desc user_desc_t;
27
28# endif /* __KERNEL__ */
29#endif /* _SYSDEP_TLS_H */