diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-um |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-um')
126 files changed, 3347 insertions, 0 deletions
diff --git a/include/asm-um/a.out.h b/include/asm-um/a.out.h new file mode 100644 index 000000000000..7c26265e1d7a --- /dev/null +++ b/include/asm-um/a.out.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef __UM_A_OUT_H | ||
2 | #define __UM_A_OUT_H | ||
3 | |||
4 | #include "linux/config.h" | ||
5 | #include "asm/arch/a.out.h" | ||
6 | #include "choose-mode.h" | ||
7 | |||
8 | #undef STACK_TOP | ||
9 | |||
10 | extern unsigned long stacksizelim; | ||
11 | |||
12 | extern unsigned long host_task_size; | ||
13 | |||
14 | #define STACK_ROOM (stacksizelim) | ||
15 | |||
16 | extern int honeypot; | ||
17 | #define STACK_TOP \ | ||
18 | CHOOSE_MODE((honeypot ? host_task_size : task_size), task_size) | ||
19 | |||
20 | #endif | ||
diff --git a/include/asm-um/apic.h b/include/asm-um/apic.h new file mode 100644 index 000000000000..876dee84ab11 --- /dev/null +++ b/include/asm-um/apic.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_APIC_H | ||
2 | #define __UM_APIC_H | ||
3 | |||
4 | #endif | ||
diff --git a/include/asm-um/arch-signal-i386.h b/include/asm-um/arch-signal-i386.h new file mode 100644 index 000000000000..99a9de4728da --- /dev/null +++ b/include/asm-um/arch-signal-i386.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_ARCH_SIGNAL_I386_H | ||
7 | #define __UM_ARCH_SIGNAL_I386_H | ||
8 | |||
9 | struct arch_signal_context { | ||
10 | unsigned long extrasigs[_NSIG_WORDS]; | ||
11 | }; | ||
12 | |||
13 | #endif | ||
14 | |||
15 | /* | ||
16 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
17 | * Emacs will notice this stuff at the end of the file and automatically | ||
18 | * adjust the settings for this buffer only. This must remain at the end | ||
19 | * of the file. | ||
20 | * --------------------------------------------------------------------------- | ||
21 | * Local variables: | ||
22 | * c-file-style: "linux" | ||
23 | * End: | ||
24 | */ | ||
diff --git a/include/asm-um/archparam-i386.h b/include/asm-um/archparam-i386.h new file mode 100644 index 000000000000..6f78de5b621b --- /dev/null +++ b/include/asm-um/archparam-i386.h | |||
@@ -0,0 +1,163 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_ARCHPARAM_I386_H | ||
7 | #define __UM_ARCHPARAM_I386_H | ||
8 | |||
9 | /********* Bits for asm-um/elf.h ************/ | ||
10 | |||
11 | #include <asm/user.h> | ||
12 | |||
13 | extern char * elf_aux_platform; | ||
14 | #define ELF_PLATFORM (elf_aux_platform) | ||
15 | |||
16 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
17 | |||
18 | typedef struct user_i387_struct elf_fpregset_t; | ||
19 | typedef unsigned long elf_greg_t; | ||
20 | |||
21 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | ||
22 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
23 | |||
24 | #define ELF_DATA ELFDATA2LSB | ||
25 | #define ELF_ARCH EM_386 | ||
26 | |||
27 | #define ELF_PLAT_INIT(regs, load_addr) do { \ | ||
28 | PT_REGS_EBX(regs) = 0; \ | ||
29 | PT_REGS_ECX(regs) = 0; \ | ||
30 | PT_REGS_EDX(regs) = 0; \ | ||
31 | PT_REGS_ESI(regs) = 0; \ | ||
32 | PT_REGS_EDI(regs) = 0; \ | ||
33 | PT_REGS_EBP(regs) = 0; \ | ||
34 | PT_REGS_EAX(regs) = 0; \ | ||
35 | } while(0) | ||
36 | |||
37 | /* Shamelessly stolen from include/asm-i386/elf.h */ | ||
38 | |||
39 | #define ELF_CORE_COPY_REGS(pr_reg, regs) do { \ | ||
40 | pr_reg[0] = PT_REGS_EBX(regs); \ | ||
41 | pr_reg[1] = PT_REGS_ECX(regs); \ | ||
42 | pr_reg[2] = PT_REGS_EDX(regs); \ | ||
43 | pr_reg[3] = PT_REGS_ESI(regs); \ | ||
44 | pr_reg[4] = PT_REGS_EDI(regs); \ | ||
45 | pr_reg[5] = PT_REGS_EBP(regs); \ | ||
46 | pr_reg[6] = PT_REGS_EAX(regs); \ | ||
47 | pr_reg[7] = PT_REGS_DS(regs); \ | ||
48 | pr_reg[8] = PT_REGS_ES(regs); \ | ||
49 | /* fake once used fs and gs selectors? */ \ | ||
50 | pr_reg[9] = PT_REGS_DS(regs); \ | ||
51 | pr_reg[10] = PT_REGS_DS(regs); \ | ||
52 | pr_reg[11] = PT_REGS_SYSCALL_NR(regs); \ | ||
53 | pr_reg[12] = PT_REGS_IP(regs); \ | ||
54 | pr_reg[13] = PT_REGS_CS(regs); \ | ||
55 | pr_reg[14] = PT_REGS_EFLAGS(regs); \ | ||
56 | pr_reg[15] = PT_REGS_SP(regs); \ | ||
57 | pr_reg[16] = PT_REGS_SS(regs); \ | ||
58 | } while(0); | ||
59 | |||
60 | |||
61 | extern unsigned long vsyscall_ehdr; | ||
62 | extern unsigned long vsyscall_end; | ||
63 | extern unsigned long __kernel_vsyscall; | ||
64 | |||
65 | #define VSYSCALL_BASE vsyscall_ehdr | ||
66 | #define VSYSCALL_END vsyscall_end | ||
67 | |||
68 | /* | ||
69 | * This is the range that is readable by user mode, and things | ||
70 | * acting like user mode such as get_user_pages. | ||
71 | */ | ||
72 | #define FIXADDR_USER_START VSYSCALL_BASE | ||
73 | #define FIXADDR_USER_END VSYSCALL_END | ||
74 | |||
75 | /* | ||
76 | * Architecture-neutral AT_ values in 0-17, leave some room | ||
77 | * for more of them, start the x86-specific ones at 32. | ||
78 | */ | ||
79 | #define AT_SYSINFO 32 | ||
80 | #define AT_SYSINFO_EHDR 33 | ||
81 | |||
82 | #define ARCH_DLINFO \ | ||
83 | do { \ | ||
84 | if ( vsyscall_ehdr ) { \ | ||
85 | NEW_AUX_ENT(AT_SYSINFO, __kernel_vsyscall); \ | ||
86 | NEW_AUX_ENT(AT_SYSINFO_EHDR, vsyscall_ehdr); \ | ||
87 | } \ | ||
88 | } while (0) | ||
89 | |||
90 | /* | ||
91 | * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out | ||
92 | * extra segments containing the vsyscall DSO contents. Dumping its | ||
93 | * contents makes post-mortem fully interpretable later without matching up | ||
94 | * the same kernel and hardware config to see what PC values meant. | ||
95 | * Dumping its extra ELF program headers includes all the other information | ||
96 | * a debugger needs to easily find how the vsyscall DSO was being used. | ||
97 | */ | ||
98 | #define ELF_CORE_EXTRA_PHDRS \ | ||
99 | (vsyscall_ehdr ? (((struct elfhdr *)vsyscall_ehdr)->e_phnum) : 0 ) | ||
100 | |||
101 | #define ELF_CORE_WRITE_EXTRA_PHDRS \ | ||
102 | if ( vsyscall_ehdr ) { \ | ||
103 | const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \ | ||
104 | const struct elf_phdr *const phdrp = \ | ||
105 | (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \ | ||
106 | int i; \ | ||
107 | Elf32_Off ofs = 0; \ | ||
108 | for (i = 0; i < ehdrp->e_phnum; ++i) { \ | ||
109 | struct elf_phdr phdr = phdrp[i]; \ | ||
110 | if (phdr.p_type == PT_LOAD) { \ | ||
111 | ofs = phdr.p_offset = offset; \ | ||
112 | offset += phdr.p_filesz; \ | ||
113 | } \ | ||
114 | else \ | ||
115 | phdr.p_offset += ofs; \ | ||
116 | phdr.p_paddr = 0; /* match other core phdrs */ \ | ||
117 | DUMP_WRITE(&phdr, sizeof(phdr)); \ | ||
118 | } \ | ||
119 | } | ||
120 | #define ELF_CORE_WRITE_EXTRA_DATA \ | ||
121 | if ( vsyscall_ehdr ) { \ | ||
122 | const struct elfhdr *const ehdrp = (struct elfhdr *)vsyscall_ehdr; \ | ||
123 | const struct elf_phdr *const phdrp = \ | ||
124 | (const struct elf_phdr *) (vsyscall_ehdr + ehdrp->e_phoff); \ | ||
125 | int i; \ | ||
126 | for (i = 0; i < ehdrp->e_phnum; ++i) { \ | ||
127 | if (phdrp[i].p_type == PT_LOAD) \ | ||
128 | DUMP_WRITE((void *) phdrp[i].p_vaddr, \ | ||
129 | phdrp[i].p_filesz); \ | ||
130 | } \ | ||
131 | } | ||
132 | |||
133 | #define R_386_NONE 0 | ||
134 | #define R_386_32 1 | ||
135 | #define R_386_PC32 2 | ||
136 | #define R_386_GOT32 3 | ||
137 | #define R_386_PLT32 4 | ||
138 | #define R_386_COPY 5 | ||
139 | #define R_386_GLOB_DAT 6 | ||
140 | #define R_386_JMP_SLOT 7 | ||
141 | #define R_386_RELATIVE 8 | ||
142 | #define R_386_GOTOFF 9 | ||
143 | #define R_386_GOTPC 10 | ||
144 | #define R_386_NUM 11 | ||
145 | |||
146 | /********* Nothing for asm-um/hardirq.h **********/ | ||
147 | |||
148 | /********* Nothing for asm-um/hw_irq.h **********/ | ||
149 | |||
150 | /********* Nothing for asm-um/string.h **********/ | ||
151 | |||
152 | #endif | ||
153 | |||
154 | /* | ||
155 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
156 | * Emacs will notice this stuff at the end of the file and automatically | ||
157 | * adjust the settings for this buffer only. This must remain at the end | ||
158 | * of the file. | ||
159 | * --------------------------------------------------------------------------- | ||
160 | * Local variables: | ||
161 | * c-file-style: "linux" | ||
162 | * End: | ||
163 | */ | ||
diff --git a/include/asm-um/archparam-ppc.h b/include/asm-um/archparam-ppc.h new file mode 100644 index 000000000000..0ebced92a762 --- /dev/null +++ b/include/asm-um/archparam-ppc.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __UM_ARCHPARAM_PPC_H | ||
2 | #define __UM_ARCHPARAM_PPC_H | ||
3 | |||
4 | /********* Bits for asm-um/elf.h ************/ | ||
5 | |||
6 | #define ELF_PLATFORM (0) | ||
7 | |||
8 | #define ELF_ET_DYN_BASE (0x08000000) | ||
9 | |||
10 | /* the following stolen from asm-ppc/elf.h */ | ||
11 | #define ELF_NGREG 48 /* includes nip, msr, lr, etc. */ | ||
12 | #define ELF_NFPREG 33 /* includes fpscr */ | ||
13 | /* General registers */ | ||
14 | typedef unsigned long elf_greg_t; | ||
15 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
16 | |||
17 | /* Floating point registers */ | ||
18 | typedef double elf_fpreg_t; | ||
19 | typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; | ||
20 | |||
21 | #define ELF_DATA ELFDATA2MSB | ||
22 | #define ELF_ARCH EM_PPC | ||
23 | |||
24 | /********* Bits for asm-um/hw_irq.h **********/ | ||
25 | |||
26 | struct hw_interrupt_type; | ||
27 | |||
28 | /********* Bits for asm-um/hardirq.h **********/ | ||
29 | |||
30 | #define irq_enter(cpu, irq) hardirq_enter(cpu) | ||
31 | #define irq_exit(cpu, irq) hardirq_exit(cpu) | ||
32 | |||
33 | /********* Bits for asm-um/string.h **********/ | ||
34 | |||
35 | #define __HAVE_ARCH_STRRCHR | ||
36 | |||
37 | #endif | ||
diff --git a/include/asm-um/archparam-x86_64.h b/include/asm-um/archparam-x86_64.h new file mode 100644 index 000000000000..96321c4892f1 --- /dev/null +++ b/include/asm-um/archparam-x86_64.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_ARCHPARAM_X86_64_H | ||
8 | #define __UM_ARCHPARAM_X86_64_H | ||
9 | |||
10 | #include <asm/user.h> | ||
11 | |||
12 | #define ELF_PLATFORM "x86_64" | ||
13 | |||
14 | #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) | ||
15 | |||
16 | typedef unsigned long elf_greg_t; | ||
17 | typedef struct { } elf_fpregset_t; | ||
18 | |||
19 | #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) | ||
20 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
21 | |||
22 | #define ELF_DATA ELFDATA2LSB | ||
23 | #define ELF_ARCH EM_X86_64 | ||
24 | |||
25 | #define ELF_PLAT_INIT(regs, load_addr) do { \ | ||
26 | PT_REGS_RBX(regs) = 0; \ | ||
27 | PT_REGS_RCX(regs) = 0; \ | ||
28 | PT_REGS_RDX(regs) = 0; \ | ||
29 | PT_REGS_RSI(regs) = 0; \ | ||
30 | PT_REGS_RDI(regs) = 0; \ | ||
31 | PT_REGS_RBP(regs) = 0; \ | ||
32 | PT_REGS_RAX(regs) = 0; \ | ||
33 | PT_REGS_R8(regs) = 0; \ | ||
34 | PT_REGS_R9(regs) = 0; \ | ||
35 | PT_REGS_R10(regs) = 0; \ | ||
36 | PT_REGS_R11(regs) = 0; \ | ||
37 | PT_REGS_R12(regs) = 0; \ | ||
38 | PT_REGS_R13(regs) = 0; \ | ||
39 | PT_REGS_R14(regs) = 0; \ | ||
40 | PT_REGS_R15(regs) = 0; \ | ||
41 | } while (0) | ||
42 | |||
43 | #ifdef TIF_IA32 /* XXX */ | ||
44 | clear_thread_flag(TIF_IA32); | ||
45 | #endif | ||
46 | |||
47 | /* No user-accessible fixmap addresses, i.e. vsyscall */ | ||
48 | #define FIXADDR_USER_START 0 | ||
49 | #define FIXADDR_USER_END 0 | ||
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/include/asm-um/atomic.h b/include/asm-um/atomic.h new file mode 100644 index 000000000000..b683f1034d1e --- /dev/null +++ b/include/asm-um/atomic.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __UM_ATOMIC_H | ||
2 | #define __UM_ATOMIC_H | ||
3 | |||
4 | /* The i386 atomic.h calls printk, but doesn't include kernel.h, so we | ||
5 | * include it here. | ||
6 | */ | ||
7 | #include "linux/kernel.h" | ||
8 | |||
9 | #include "asm/arch/atomic.h" | ||
10 | |||
11 | #endif | ||
diff --git a/include/asm-um/bitops.h b/include/asm-um/bitops.h new file mode 100644 index 000000000000..46d781953d3a --- /dev/null +++ b/include/asm-um/bitops.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_BITOPS_H | ||
2 | #define __UM_BITOPS_H | ||
3 | |||
4 | #include "asm/arch/bitops.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/boot.h b/include/asm-um/boot.h new file mode 100644 index 000000000000..09548c3e784e --- /dev/null +++ b/include/asm-um/boot.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_BOOT_H | ||
2 | #define __UM_BOOT_H | ||
3 | |||
4 | #include "asm/arch/boot.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/bug.h b/include/asm-um/bug.h new file mode 100644 index 000000000000..1e22fa26ff06 --- /dev/null +++ b/include/asm-um/bug.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_BUG_H | ||
2 | #define __UM_BUG_H | ||
3 | #include <asm-generic/bug.h> | ||
4 | #endif | ||
diff --git a/include/asm-um/bugs.h b/include/asm-um/bugs.h new file mode 100644 index 000000000000..6a72e240d5fc --- /dev/null +++ b/include/asm-um/bugs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_BUGS_H | ||
2 | #define __UM_BUGS_H | ||
3 | |||
4 | void check_bugs(void); | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/byteorder.h b/include/asm-um/byteorder.h new file mode 100644 index 000000000000..eee0a834f447 --- /dev/null +++ b/include/asm-um/byteorder.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_BYTEORDER_H | ||
2 | #define __UM_BYTEORDER_H | ||
3 | |||
4 | #include "asm/arch/byteorder.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/cache.h b/include/asm-um/cache.h new file mode 100644 index 000000000000..4b134fe8504e --- /dev/null +++ b/include/asm-um/cache.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_CACHE_H | ||
2 | #define __UM_CACHE_H | ||
3 | |||
4 | /* These are x86 numbers */ | ||
5 | #define L1_CACHE_SHIFT 5 | ||
6 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | ||
7 | |||
8 | #define L1_CACHE_SHIFT_MAX 7 /* largest L1 which this arch supports */ | ||
9 | |||
10 | #endif | ||
diff --git a/include/asm-um/cacheflush.h b/include/asm-um/cacheflush.h new file mode 100644 index 000000000000..12e9d4b74c8f --- /dev/null +++ b/include/asm-um/cacheflush.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_CACHEFLUSH_H | ||
2 | #define __UM_CACHEFLUSH_H | ||
3 | |||
4 | #include "asm/arch/cacheflush.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/calling.h b/include/asm-um/calling.h new file mode 100644 index 000000000000..0b2384cc99fd --- /dev/null +++ b/include/asm-um/calling.h | |||
@@ -0,0 +1,9 @@ | |||
1 | # Copyright 2003 - 2004 Pathscale, Inc | ||
2 | # Released under the GPL | ||
3 | |||
4 | #ifndef __UM_CALLING_H /* XXX x86_64 */ | ||
5 | #define __UM_CALLING_H | ||
6 | |||
7 | #include "asm/arch/calling.h" | ||
8 | |||
9 | #endif | ||
diff --git a/include/asm-um/checksum.h b/include/asm-um/checksum.h new file mode 100644 index 000000000000..5b501361e361 --- /dev/null +++ b/include/asm-um/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/include/asm-um/cobalt.h b/include/asm-um/cobalt.h new file mode 100644 index 000000000000..f813a684be98 --- /dev/null +++ b/include/asm-um/cobalt.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_COBALT_H | ||
2 | #define __UM_COBALT_H | ||
3 | |||
4 | #include "asm/arch/cobalt.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S new file mode 100644 index 000000000000..a3d6aab0e74d --- /dev/null +++ b/include/asm-um/common.lds.S | |||
@@ -0,0 +1,104 @@ | |||
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 | . = ALIGN(16); /* Exception table */ | ||
12 | __start___ex_table = .; | ||
13 | __ex_table : { *(__ex_table) } | ||
14 | __stop___ex_table = .; | ||
15 | |||
16 | RODATA | ||
17 | |||
18 | .unprotected : { *(.unprotected) } | ||
19 | . = ALIGN(4096); | ||
20 | PROVIDE (_unprotected_end = .); | ||
21 | |||
22 | . = ALIGN(4096); | ||
23 | __uml_setup_start = .; | ||
24 | .uml.setup.init : { *(.uml.setup.init) } | ||
25 | __uml_setup_end = .; | ||
26 | |||
27 | __uml_help_start = .; | ||
28 | .uml.help.init : { *(.uml.help.init) } | ||
29 | __uml_help_end = .; | ||
30 | |||
31 | __uml_postsetup_start = .; | ||
32 | .uml.postsetup.init : { *(.uml.postsetup.init) } | ||
33 | __uml_postsetup_end = .; | ||
34 | |||
35 | __setup_start = .; | ||
36 | .init.setup : { *(.init.setup) } | ||
37 | __setup_end = .; | ||
38 | |||
39 | . = ALIGN(32); | ||
40 | __per_cpu_start = . ; | ||
41 | .data.percpu : { *(.data.percpu) } | ||
42 | __per_cpu_end = . ; | ||
43 | |||
44 | __initcall_start = .; | ||
45 | .initcall.init : { | ||
46 | *(.initcall1.init) | ||
47 | *(.initcall2.init) | ||
48 | *(.initcall3.init) | ||
49 | *(.initcall4.init) | ||
50 | *(.initcall5.init) | ||
51 | *(.initcall6.init) | ||
52 | *(.initcall7.init) | ||
53 | } | ||
54 | __initcall_end = .; | ||
55 | |||
56 | __con_initcall_start = .; | ||
57 | .con_initcall.init : { *(.con_initcall.init) } | ||
58 | __con_initcall_end = .; | ||
59 | |||
60 | __uml_initcall_start = .; | ||
61 | .uml.initcall.init : { *(.uml.initcall.init) } | ||
62 | __uml_initcall_end = .; | ||
63 | __init_end = .; | ||
64 | |||
65 | SECURITY_INIT | ||
66 | |||
67 | __exitcall_begin = .; | ||
68 | .exitcall : { *(.exitcall.exit) } | ||
69 | __exitcall_end = .; | ||
70 | |||
71 | __uml_exitcall_begin = .; | ||
72 | .uml.exitcall : { *(.uml.exitcall.exit) } | ||
73 | __uml_exitcall_end = .; | ||
74 | |||
75 | . = ALIGN(4); | ||
76 | __alt_instructions = .; | ||
77 | .altinstructions : { *(.altinstructions) } | ||
78 | __alt_instructions_end = .; | ||
79 | .altinstr_replacement : { *(.altinstr_replacement) } | ||
80 | /* .exit.text is discard at runtime, not link time, to deal with references | ||
81 | from .altinstructions and .eh_frame */ | ||
82 | .exit.text : { *(.exit.text) } | ||
83 | .exit.data : { *(.exit.data) } | ||
84 | |||
85 | __preinit_array_start = .; | ||
86 | .preinit_array : { *(.preinit_array) } | ||
87 | __preinit_array_end = .; | ||
88 | __init_array_start = .; | ||
89 | .init_array : { *(.init_array) } | ||
90 | __init_array_end = .; | ||
91 | __fini_array_start = .; | ||
92 | .fini_array : { *(.fini_array) } | ||
93 | __fini_array_end = .; | ||
94 | |||
95 | . = ALIGN(4096); | ||
96 | __initramfs_start = .; | ||
97 | .init.ramfs : { *(.init.ramfs) } | ||
98 | __initramfs_end = .; | ||
99 | |||
100 | /* Sections to be discarded */ | ||
101 | /DISCARD/ : { | ||
102 | *(.exitcall.exit) | ||
103 | } | ||
104 | |||
diff --git a/include/asm-um/cpufeature.h b/include/asm-um/cpufeature.h new file mode 100644 index 000000000000..fb7bd42a4d96 --- /dev/null +++ b/include/asm-um/cpufeature.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_CPUFEATURE_H | ||
2 | #define __UM_CPUFEATURE_H | ||
3 | |||
4 | #include "asm/arch/cpufeature.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/cputime.h b/include/asm-um/cputime.h new file mode 100644 index 000000000000..c84acbadfa2f --- /dev/null +++ b/include/asm-um/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/include/asm-um/current.h b/include/asm-um/current.h new file mode 100644 index 000000000000..8fd72f69ce65 --- /dev/null +++ b/include/asm-um/current.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_CURRENT_H | ||
7 | #define __UM_CURRENT_H | ||
8 | |||
9 | #ifndef __ASSEMBLY__ | ||
10 | |||
11 | #include "asm/page.h" | ||
12 | #include "linux/thread_info.h" | ||
13 | |||
14 | #define current (current_thread_info()->task) | ||
15 | |||
16 | /*Backward compatibility - it's used inside arch/um.*/ | ||
17 | #define current_thread current_thread_info() | ||
18 | |||
19 | #endif /* __ASSEMBLY__ */ | ||
20 | |||
21 | #endif | ||
22 | |||
23 | /* | ||
24 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
25 | * Emacs will notice this stuff at the end of the file and automatically | ||
26 | * adjust the settings for this buffer only. This must remain at the end | ||
27 | * of the file. | ||
28 | * --------------------------------------------------------------------------- | ||
29 | * Local variables: | ||
30 | * c-file-style: "linux" | ||
31 | * End: | ||
32 | */ | ||
diff --git a/include/asm-um/delay.h b/include/asm-um/delay.h new file mode 100644 index 000000000000..40695576ca60 --- /dev/null +++ b/include/asm-um/delay.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __UM_DELAY_H | ||
2 | #define __UM_DELAY_H | ||
3 | |||
4 | #include "asm/arch/delay.h" | ||
5 | #include "asm/archparam.h" | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-um/desc.h b/include/asm-um/desc.h new file mode 100644 index 000000000000..ac1d2a20d178 --- /dev/null +++ b/include/asm-um/desc.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_DESC_H | ||
2 | #define __UM_DESC_H | ||
3 | |||
4 | #include "asm/arch/desc.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/div64.h b/include/asm-um/div64.h new file mode 100644 index 000000000000..1e17f7409cab --- /dev/null +++ b/include/asm-um/div64.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _UM_DIV64_H | ||
2 | #define _UM_DIV64_H | ||
3 | |||
4 | #include "asm/arch/div64.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/dma-mapping.h b/include/asm-um/dma-mapping.h new file mode 100644 index 000000000000..13e6291f7151 --- /dev/null +++ b/include/asm-um/dma-mapping.h | |||
@@ -0,0 +1,121 @@ | |||
1 | #ifndef _ASM_DMA_MAPPING_H | ||
2 | #define _ASM_DMA_MAPPING_H | ||
3 | |||
4 | #include <asm/scatterlist.h> | ||
5 | |||
6 | static inline int | ||
7 | dma_supported(struct device *dev, u64 mask) | ||
8 | { | ||
9 | BUG(); | ||
10 | return(0); | ||
11 | } | ||
12 | |||
13 | static inline int | ||
14 | dma_set_mask(struct device *dev, u64 dma_mask) | ||
15 | { | ||
16 | BUG(); | ||
17 | return(0); | ||
18 | } | ||
19 | |||
20 | static inline void * | ||
21 | dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | ||
22 | int flag) | ||
23 | { | ||
24 | BUG(); | ||
25 | return((void *) 0); | ||
26 | } | ||
27 | |||
28 | static inline void | ||
29 | dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | ||
30 | dma_addr_t dma_handle) | ||
31 | { | ||
32 | BUG(); | ||
33 | } | ||
34 | |||
35 | static inline dma_addr_t | ||
36 | dma_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 | |||
43 | static inline void | ||
44 | dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | ||
45 | enum dma_data_direction direction) | ||
46 | { | ||
47 | BUG(); | ||
48 | } | ||
49 | |||
50 | static inline dma_addr_t | ||
51 | dma_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 | |||
59 | static inline void | ||
60 | dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | ||
61 | enum dma_data_direction direction) | ||
62 | { | ||
63 | BUG(); | ||
64 | } | ||
65 | |||
66 | static inline int | ||
67 | dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | ||
68 | enum dma_data_direction direction) | ||
69 | { | ||
70 | BUG(); | ||
71 | return(0); | ||
72 | } | ||
73 | |||
74 | static inline void | ||
75 | dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | ||
76 | enum dma_data_direction direction) | ||
77 | { | ||
78 | BUG(); | ||
79 | } | ||
80 | |||
81 | static inline void | ||
82 | dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size, | ||
83 | enum dma_data_direction direction) | ||
84 | { | ||
85 | BUG(); | ||
86 | } | ||
87 | |||
88 | static inline void | ||
89 | dma_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) (1) | ||
98 | |||
99 | static inline int | ||
100 | dma_get_cache_alignment(void) | ||
101 | { | ||
102 | BUG(); | ||
103 | return(0); | ||
104 | } | ||
105 | |||
106 | static inline void | ||
107 | dma_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 | |||
114 | static inline void | ||
115 | dma_cache_sync(void *vaddr, size_t size, | ||
116 | enum dma_data_direction direction) | ||
117 | { | ||
118 | BUG(); | ||
119 | } | ||
120 | |||
121 | #endif | ||
diff --git a/include/asm-um/dma.h b/include/asm-um/dma.h new file mode 100644 index 000000000000..9f6139a8a525 --- /dev/null +++ b/include/asm-um/dma.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_DMA_H | ||
2 | #define __UM_DMA_H | ||
3 | |||
4 | #include "asm/io.h" | ||
5 | |||
6 | extern unsigned long uml_physmem; | ||
7 | |||
8 | #define MAX_DMA_ADDRESS (uml_physmem) | ||
9 | |||
10 | #endif | ||
diff --git a/include/asm-um/dwarf2.h b/include/asm-um/dwarf2.h new file mode 100644 index 000000000000..d1a02e762931 --- /dev/null +++ b/include/asm-um/dwarf2.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* Copyright 2003 - 2004 Pathscale, Inc | ||
2 | * Released under the GPL | ||
3 | */ | ||
4 | |||
5 | /* Needed on x86_64 by thunk.S */ | ||
6 | #ifndef __UM_DWARF2_H | ||
7 | #define __UM_DWARF2_H | ||
8 | |||
9 | #include "asm/arch/dwarf2.h" | ||
10 | |||
11 | #endif | ||
diff --git a/include/asm-um/elf.h b/include/asm-um/elf.h new file mode 100644 index 000000000000..b3a7258f9971 --- /dev/null +++ b/include/asm-um/elf.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef __UM_ELF_H | ||
2 | #define __UM_ELF_H | ||
3 | |||
4 | #include "linux/config.h" | ||
5 | #include "asm/archparam.h" | ||
6 | |||
7 | extern long elf_aux_hwcap; | ||
8 | #define ELF_HWCAP (elf_aux_hwcap) | ||
9 | |||
10 | #define SET_PERSONALITY(ex, ibcs2) do ; while(0) | ||
11 | |||
12 | #define ELF_EXEC_PAGESIZE 4096 | ||
13 | |||
14 | #define elf_check_arch(x) (1) | ||
15 | |||
16 | #ifdef CONFIG_64_BIT | ||
17 | #define ELF_CLASS ELFCLASS64 | ||
18 | #else | ||
19 | #define ELF_CLASS ELFCLASS32 | ||
20 | #endif | ||
21 | |||
22 | #define USE_ELF_CORE_DUMP | ||
23 | |||
24 | #define R_386_NONE 0 | ||
25 | #define R_386_32 1 | ||
26 | #define R_386_PC32 2 | ||
27 | #define R_386_GOT32 3 | ||
28 | #define R_386_PLT32 4 | ||
29 | #define R_386_COPY 5 | ||
30 | #define R_386_GLOB_DAT 6 | ||
31 | #define R_386_JMP_SLOT 7 | ||
32 | #define R_386_RELATIVE 8 | ||
33 | #define R_386_GOTOFF 9 | ||
34 | #define R_386_GOTPC 10 | ||
35 | #define R_386_NUM 11 | ||
36 | |||
37 | #endif | ||
diff --git a/include/asm-um/errno.h b/include/asm-um/errno.h new file mode 100644 index 000000000000..b7a9e37fd8d8 --- /dev/null +++ b/include/asm-um/errno.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_ERRNO_H | ||
2 | #define __UM_ERRNO_H | ||
3 | |||
4 | #include "asm/arch/errno.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/fcntl.h b/include/asm-um/fcntl.h new file mode 100644 index 000000000000..812a65446d92 --- /dev/null +++ b/include/asm-um/fcntl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_FCNTL_H | ||
2 | #define __UM_FCNTL_H | ||
3 | |||
4 | #include "asm/arch/fcntl.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/fixmap.h b/include/asm-um/fixmap.h new file mode 100644 index 000000000000..900f3fbb9fab --- /dev/null +++ b/include/asm-um/fixmap.h | |||
@@ -0,0 +1,97 @@ | |||
1 | #ifndef __UM_FIXMAP_H | ||
2 | #define __UM_FIXMAP_H | ||
3 | |||
4 | #include <linux/config.h> | ||
5 | #include <asm/kmap_types.h> | ||
6 | #include <asm/archparam.h> | ||
7 | |||
8 | /* | ||
9 | * Here we define all the compile-time 'special' virtual | ||
10 | * addresses. The point is to have a constant address at | ||
11 | * compile time, but to set the physical address only | ||
12 | * in the boot process. We allocate these special addresses | ||
13 | * from the end of virtual memory (0xfffff000) backwards. | ||
14 | * Also this lets us do fail-safe vmalloc(), we | ||
15 | * can guarantee that these special addresses and | ||
16 | * vmalloc()-ed addresses never overlap. | ||
17 | * | ||
18 | * these 'compile-time allocated' memory buffers are | ||
19 | * fixed-size 4k pages. (or larger if used with an increment | ||
20 | * highger than 1) use fixmap_set(idx,phys) to associate | ||
21 | * physical memory with fixmap indices. | ||
22 | * | ||
23 | * TLB entries of such buffers will not be flushed across | ||
24 | * task switches. | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * on UP currently we will have no trace of the fixmap mechanizm, | ||
29 | * no page table allocations, etc. This might change in the | ||
30 | * future, say framebuffers for the console driver(s) could be | ||
31 | * fix-mapped? | ||
32 | */ | ||
33 | enum fixed_addresses { | ||
34 | #ifdef CONFIG_HIGHMEM | ||
35 | FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ | ||
36 | FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, | ||
37 | #endif | ||
38 | __end_of_fixed_addresses | ||
39 | }; | ||
40 | |||
41 | extern void __set_fixmap (enum fixed_addresses idx, | ||
42 | unsigned long phys, pgprot_t flags); | ||
43 | |||
44 | #define set_fixmap(idx, phys) \ | ||
45 | __set_fixmap(idx, phys, PAGE_KERNEL) | ||
46 | /* | ||
47 | * Some hardware wants to get fixmapped without caching. | ||
48 | */ | ||
49 | #define set_fixmap_nocache(idx, phys) \ | ||
50 | __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) | ||
51 | /* | ||
52 | * used by vmalloc.c. | ||
53 | * | ||
54 | * Leave one empty page between vmalloc'ed areas and | ||
55 | * the start of the fixmap, and leave one page empty | ||
56 | * at the top of mem.. | ||
57 | */ | ||
58 | extern unsigned long get_kmem_end(void); | ||
59 | |||
60 | #define FIXADDR_TOP (get_kmem_end() - 0x2000) | ||
61 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | ||
62 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
63 | |||
64 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | ||
65 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
66 | |||
67 | extern void __this_fixmap_does_not_exist(void); | ||
68 | |||
69 | /* | ||
70 | * 'index to address' translation. If anyone tries to use the idx | ||
71 | * directly without tranlation, we catch the bug with a NULL-deference | ||
72 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
73 | */ | ||
74 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
75 | { | ||
76 | /* | ||
77 | * this branch gets completely eliminated after inlining, | ||
78 | * except when someone tries to use fixaddr indices in an | ||
79 | * illegal way. (such as mixing up address types or using | ||
80 | * out-of-range indices). | ||
81 | * | ||
82 | * If it doesn't get removed, the linker will complain | ||
83 | * loudly with a reasonably clear error message.. | ||
84 | */ | ||
85 | if (idx >= __end_of_fixed_addresses) | ||
86 | __this_fixmap_does_not_exist(); | ||
87 | |||
88 | return __fix_to_virt(idx); | ||
89 | } | ||
90 | |||
91 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
92 | { | ||
93 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
94 | return __virt_to_fix(vaddr); | ||
95 | } | ||
96 | |||
97 | #endif | ||
diff --git a/include/asm-um/floppy.h b/include/asm-um/floppy.h new file mode 100644 index 000000000000..453e7415fb6f --- /dev/null +++ b/include/asm-um/floppy.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_FLOPPY_H | ||
2 | #define __UM_FLOPPY_H | ||
3 | |||
4 | #include "asm/arch/floppy.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/hardirq.h b/include/asm-um/hardirq.h new file mode 100644 index 000000000000..1224b2690a23 --- /dev/null +++ b/include/asm-um/hardirq.h | |||
@@ -0,0 +1,26 @@ | |||
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/config.h> | ||
7 | #include <linux/threads.h> | ||
8 | #include <linux/irq.h> | ||
9 | |||
10 | /* NOTE: When SMP works again we might want to make this | ||
11 | * ____cacheline_aligned or maybe use per_cpu state? --cw */ | ||
12 | typedef struct { | ||
13 | unsigned int __softirq_pending; | ||
14 | } irq_cpustat_t; | ||
15 | |||
16 | #include <linux/irq_cpustat.h> | ||
17 | |||
18 | /* As this would be very strange for UML to get we BUG() after the | ||
19 | * printk. */ | ||
20 | static inline void ack_bad_irq(unsigned int irq) | ||
21 | { | ||
22 | printk(KERN_ERR "unexpected IRQ %02x\n", irq); | ||
23 | BUG(); | ||
24 | } | ||
25 | |||
26 | #endif /* __ASM_UM_HARDIRQ_H */ | ||
diff --git a/include/asm-um/hdreg.h b/include/asm-um/hdreg.h new file mode 100644 index 000000000000..cf6363abcab9 --- /dev/null +++ b/include/asm-um/hdreg.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_HDREG_H | ||
2 | #define __UM_HDREG_H | ||
3 | |||
4 | #include "asm/arch/hdreg.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/highmem.h b/include/asm-um/highmem.h new file mode 100644 index 000000000000..36974cb8abc7 --- /dev/null +++ b/include/asm-um/highmem.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __UM_HIGHMEM_H | ||
2 | #define __UM_HIGHMEM_H | ||
3 | |||
4 | #include "asm/page.h" | ||
5 | #include "asm/fixmap.h" | ||
6 | #include "asm/arch/highmem.h" | ||
7 | |||
8 | #undef PKMAP_BASE | ||
9 | |||
10 | #define PKMAP_BASE ((FIXADDR_START - LAST_PKMAP * PAGE_SIZE) & PMD_MASK) | ||
11 | |||
12 | #endif | ||
diff --git a/include/asm-um/hw_irq.h b/include/asm-um/hw_irq.h new file mode 100644 index 000000000000..4ee38c0b6a64 --- /dev/null +++ b/include/asm-um/hw_irq.h | |||
@@ -0,0 +1,10 @@ | |||
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 | static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) | ||
8 | {} | ||
9 | |||
10 | #endif | ||
diff --git a/include/asm-um/ide.h b/include/asm-um/ide.h new file mode 100644 index 000000000000..3d1ccebcfbaf --- /dev/null +++ b/include/asm-um/ide.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IDE_H | ||
2 | #define __UM_IDE_H | ||
3 | |||
4 | #include "asm/arch/ide.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/io.h b/include/asm-um/io.h new file mode 100644 index 000000000000..90674056dcef --- /dev/null +++ b/include/asm-um/io.h | |||
@@ -0,0 +1,36 @@ | |||
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 | |||
8 | static inline int inb(unsigned long i) { return(0); } | ||
9 | static 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 | */ | ||
15 | static inline unsigned long virt_to_phys(volatile void * address) | ||
16 | { | ||
17 | return __pa((void *) address); | ||
18 | } | ||
19 | |||
20 | static 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 | |||
36 | #endif | ||
diff --git a/include/asm-um/ioctl.h b/include/asm-um/ioctl.h new file mode 100644 index 000000000000..cc22157346db --- /dev/null +++ b/include/asm-um/ioctl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IOCTL_H | ||
2 | #define __UM_IOCTL_H | ||
3 | |||
4 | #include "asm/arch/ioctl.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/ioctls.h b/include/asm-um/ioctls.h new file mode 100644 index 000000000000..9a1a017de6a7 --- /dev/null +++ b/include/asm-um/ioctls.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IOCTLS_H | ||
2 | #define __UM_IOCTLS_H | ||
3 | |||
4 | #include "asm/arch/ioctls.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/ipc.h b/include/asm-um/ipc.h new file mode 100644 index 000000000000..e2ddc47f3e52 --- /dev/null +++ b/include/asm-um/ipc.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IPC_H | ||
2 | #define __UM_IPC_H | ||
3 | |||
4 | #include "asm/arch/ipc.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/ipcbuf.h b/include/asm-um/ipcbuf.h new file mode 100644 index 000000000000..bb2ad31dc434 --- /dev/null +++ b/include/asm-um/ipcbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_IPCBUF_H | ||
2 | #define __UM_IPCBUF_H | ||
3 | |||
4 | #include "asm/arch/ipcbuf.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/irq.h b/include/asm-um/irq.h new file mode 100644 index 000000000000..de389a477cdd --- /dev/null +++ b/include/asm-um/irq.h | |||
@@ -0,0 +1,22 @@ | |||
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 | |||
19 | #define LAST_IRQ XTERM_IRQ | ||
20 | #define NR_IRQS (LAST_IRQ + 1) | ||
21 | |||
22 | #endif | ||
diff --git a/include/asm-um/irq_vectors.h b/include/asm-um/irq_vectors.h new file mode 100644 index 000000000000..62ddba6fc733 --- /dev/null +++ b/include/asm-um/irq_vectors.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_IRQ_VECTORS_H | ||
7 | #define __UM_IRQ_VECTORS_H | ||
8 | |||
9 | #endif | ||
10 | |||
11 | /* | ||
12 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
13 | * Emacs will notice this stuff at the end of the file and automatically | ||
14 | * adjust the settings for this buffer only. This must remain at the end | ||
15 | * of the file. | ||
16 | * --------------------------------------------------------------------------- | ||
17 | * Local variables: | ||
18 | * c-file-style: "linux" | ||
19 | * End: | ||
20 | */ | ||
diff --git a/include/asm-um/keyboard.h b/include/asm-um/keyboard.h new file mode 100644 index 000000000000..ee2e2303d0e4 --- /dev/null +++ b/include/asm-um/keyboard.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_KEYBOARD_H | ||
2 | #define __UM_KEYBOARD_H | ||
3 | |||
4 | #include "asm/arch/keyboard.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/kmap_types.h b/include/asm-um/kmap_types.h new file mode 100644 index 000000000000..0b22ad776e76 --- /dev/null +++ b/include/asm-um/kmap_types.h | |||
@@ -0,0 +1,11 @@ | |||
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 | #include "asm/arch/kmap_types.h" | ||
10 | |||
11 | #endif | ||
diff --git a/include/asm-um/linkage.h b/include/asm-um/linkage.h new file mode 100644 index 000000000000..27011652b015 --- /dev/null +++ b/include/asm-um/linkage.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __ASM_LINKAGE_H | ||
2 | #define __ASM_LINKAGE_H | ||
3 | |||
4 | #define FASTCALL(x) x __attribute__((regparm(3))) | ||
5 | #define fastcall __attribute__((regparm(3))) | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-um/local.h b/include/asm-um/local.h new file mode 100644 index 000000000000..9a280c5bb609 --- /dev/null +++ b/include/asm-um/local.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_LOCAL_H | ||
2 | #define __UM_LOCAL_H | ||
3 | |||
4 | #include "asm/arch/local.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/locks.h b/include/asm-um/locks.h new file mode 100644 index 000000000000..f80030a3ef5a --- /dev/null +++ b/include/asm-um/locks.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_LOCKS_H | ||
2 | #define __UM_LOCKS_H | ||
3 | |||
4 | #include "asm/arch/locks.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/mca_dma.h b/include/asm-um/mca_dma.h new file mode 100644 index 000000000000..e492e4ec1392 --- /dev/null +++ b/include/asm-um/mca_dma.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef mca___UM_DMA_H | ||
2 | #define mca___UM_DMA_H | ||
3 | |||
4 | #include "asm/arch/mca_dma.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/mman.h b/include/asm-um/mman.h new file mode 100644 index 000000000000..b09ed523019b --- /dev/null +++ b/include/asm-um/mman.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_MMAN_H | ||
2 | #define __UM_MMAN_H | ||
3 | |||
4 | #include "asm/arch/mman.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/mmu.h b/include/asm-um/mmu.h new file mode 100644 index 000000000000..2cf35c21d694 --- /dev/null +++ b/include/asm-um/mmu.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __MMU_H | ||
7 | #define __MMU_H | ||
8 | |||
9 | #include "um_mmu.h" | ||
10 | |||
11 | #endif | ||
12 | |||
13 | /* | ||
14 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
15 | * Emacs will notice this stuff at the end of the file and automatically | ||
16 | * adjust the settings for this buffer only. This must remain at the end | ||
17 | * of the file. | ||
18 | * --------------------------------------------------------------------------- | ||
19 | * Local variables: | ||
20 | * c-file-style: "linux" | ||
21 | * End: | ||
22 | */ | ||
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h new file mode 100644 index 000000000000..89bff310b7a9 --- /dev/null +++ b/include/asm-um/mmu_context.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.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 "choose-mode.h" | ||
11 | |||
12 | #define get_mmu_context(task) do ; while(0) | ||
13 | #define activate_context(tsk) do ; while(0) | ||
14 | |||
15 | #define deactivate_mm(tsk,mm) do { } while (0) | ||
16 | |||
17 | static inline void activate_mm(struct mm_struct *old, struct mm_struct *new) | ||
18 | { | ||
19 | } | ||
20 | |||
21 | extern void switch_mm_skas(int mm_fd); | ||
22 | |||
23 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | ||
24 | struct task_struct *tsk) | ||
25 | { | ||
26 | unsigned cpu = smp_processor_id(); | ||
27 | |||
28 | if(prev != next){ | ||
29 | cpu_clear(cpu, prev->cpu_vm_mask); | ||
30 | cpu_set(cpu, next->cpu_vm_mask); | ||
31 | if(next != &init_mm) | ||
32 | CHOOSE_MODE((void) 0, | ||
33 | switch_mm_skas(next->context.skas.mm_fd)); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | static inline void enter_lazy_tlb(struct mm_struct *mm, | ||
38 | struct task_struct *tsk) | ||
39 | { | ||
40 | } | ||
41 | |||
42 | extern int init_new_context_skas(struct task_struct *task, | ||
43 | struct mm_struct *mm); | ||
44 | |||
45 | static inline int init_new_context_tt(struct task_struct *task, | ||
46 | struct mm_struct *mm) | ||
47 | { | ||
48 | return(0); | ||
49 | } | ||
50 | |||
51 | static inline int init_new_context(struct task_struct *task, | ||
52 | struct mm_struct *mm) | ||
53 | { | ||
54 | return(CHOOSE_MODE_PROC(init_new_context_tt, init_new_context_skas, | ||
55 | task, mm)); | ||
56 | } | ||
57 | |||
58 | extern void destroy_context_skas(struct mm_struct *mm); | ||
59 | |||
60 | static inline void destroy_context(struct mm_struct *mm) | ||
61 | { | ||
62 | CHOOSE_MODE((void) 0, destroy_context_skas(mm)); | ||
63 | } | ||
64 | |||
65 | #endif | ||
66 | |||
67 | /* | ||
68 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
69 | * Emacs will notice this stuff at the end of the file and automatically | ||
70 | * adjust the settings for this buffer only. This must remain at the end | ||
71 | * of the file. | ||
72 | * --------------------------------------------------------------------------- | ||
73 | * Local variables: | ||
74 | * c-file-style: "linux" | ||
75 | * End: | ||
76 | */ | ||
diff --git a/include/asm-um/module-generic.h b/include/asm-um/module-generic.h new file mode 100644 index 000000000000..5a265f56b174 --- /dev/null +++ b/include/asm-um/module-generic.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_MODULE_GENERIC_H | ||
2 | #define __UM_MODULE_GENERIC_H | ||
3 | |||
4 | #include "asm/arch/module.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/module-i386.h b/include/asm-um/module-i386.h new file mode 100644 index 000000000000..5ead4a0b2e35 --- /dev/null +++ b/include/asm-um/module-i386.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __UM_MODULE_I386_H | ||
2 | #define __UM_MODULE_I386_H | ||
3 | |||
4 | /* UML is simple */ | ||
5 | struct mod_arch_specific | ||
6 | { | ||
7 | }; | ||
8 | |||
9 | #define Elf_Shdr Elf32_Shdr | ||
10 | #define Elf_Sym Elf32_Sym | ||
11 | #define Elf_Ehdr Elf32_Ehdr | ||
12 | |||
13 | #endif | ||
diff --git a/include/asm-um/module-x86_64.h b/include/asm-um/module-x86_64.h new file mode 100644 index 000000000000..35b5491d3e96 --- /dev/null +++ b/include/asm-um/module-x86_64.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_MODULE_X86_64_H | ||
8 | #define __UM_MODULE_X86_64_H | ||
9 | |||
10 | /* UML is simple */ | ||
11 | struct mod_arch_specific | ||
12 | { | ||
13 | }; | ||
14 | |||
15 | #define Elf_Shdr Elf64_Shdr | ||
16 | #define Elf_Sym Elf64_Sym | ||
17 | #define Elf_Ehdr Elf64_Ehdr | ||
18 | |||
19 | #endif | ||
20 | |||
21 | /* | ||
22 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
23 | * Emacs will notice this stuff at the end of the file and automatically | ||
24 | * adjust the settings for this buffer only. This must remain at the end | ||
25 | * of the file. | ||
26 | * --------------------------------------------------------------------------- | ||
27 | * Local variables: | ||
28 | * c-file-style: "linux" | ||
29 | * End: | ||
30 | */ | ||
diff --git a/include/asm-um/msgbuf.h b/include/asm-um/msgbuf.h new file mode 100644 index 000000000000..8ce8c30d5377 --- /dev/null +++ b/include/asm-um/msgbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_MSGBUF_H | ||
2 | #define __UM_MSGBUF_H | ||
3 | |||
4 | #include "asm/arch/msgbuf.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/mtrr.h b/include/asm-um/mtrr.h new file mode 100644 index 000000000000..5e9cd12c578d --- /dev/null +++ b/include/asm-um/mtrr.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_MTRR_H | ||
2 | #define __UM_MTRR_H | ||
3 | |||
4 | #include "asm/arch/mtrr.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/namei.h b/include/asm-um/namei.h new file mode 100644 index 000000000000..002984d5bc85 --- /dev/null +++ b/include/asm-um/namei.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_NAMEI_H | ||
2 | #define __UM_NAMEI_H | ||
3 | |||
4 | #include "asm/arch/namei.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/page.h b/include/asm-um/page.h new file mode 100644 index 000000000000..3620a08dc9f3 --- /dev/null +++ b/include/asm-um/page.h | |||
@@ -0,0 +1,130 @@ | |||
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 | struct page; | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <asm/vm-flags.h> | ||
14 | |||
15 | /* PAGE_SHIFT determines the page size */ | ||
16 | #define PAGE_SHIFT 12 | ||
17 | #define PAGE_SIZE (1UL << PAGE_SHIFT) | ||
18 | #define PAGE_MASK (~(PAGE_SIZE-1)) | ||
19 | |||
20 | /* | ||
21 | * These are used to make use of C type-checking.. | ||
22 | */ | ||
23 | |||
24 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | ||
25 | #define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) | ||
26 | |||
27 | #define clear_user_page(page, vaddr, pg) clear_page(page) | ||
28 | #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) | ||
29 | |||
30 | #if defined(CONFIG_3_LEVEL_PGTABLES) && !defined(CONFIG_64_BIT) | ||
31 | |||
32 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | ||
33 | typedef struct { unsigned long long pmd; } pmd_t; | ||
34 | typedef struct { unsigned long pgd; } pgd_t; | ||
35 | #define pte_val(x) ((x).pte_low | ((unsigned long long) (x).pte_high << 32)) | ||
36 | |||
37 | #define pte_get_bits(pte, bits) ((pte).pte_low & (bits)) | ||
38 | #define pte_set_bits(pte, bits) ((pte).pte_low |= (bits)) | ||
39 | #define pte_clear_bits(pte, bits) ((pte).pte_low &= ~(bits)) | ||
40 | #define pte_copy(to, from) ({ (to).pte_high = (from).pte_high; \ | ||
41 | smp_wmb(); \ | ||
42 | (to).pte_low = (from).pte_low; }) | ||
43 | #define pte_is_zero(pte) (!((pte).pte_low & ~_PAGE_NEWPAGE) && !(pte).pte_high) | ||
44 | #define pte_set_val(pte, phys, prot) \ | ||
45 | ({ (pte).pte_high = (phys) >> 32; \ | ||
46 | (pte).pte_low = (phys) | pgprot_val(prot); }) | ||
47 | |||
48 | typedef unsigned long long pfn_t; | ||
49 | typedef unsigned long long phys_t; | ||
50 | |||
51 | #else | ||
52 | |||
53 | typedef struct { unsigned long pte; } pte_t; | ||
54 | typedef struct { unsigned long pgd; } pgd_t; | ||
55 | |||
56 | #ifdef CONFIG_3_LEVEL_PGTABLES | ||
57 | typedef struct { unsigned long pmd; } pmd_t; | ||
58 | #define pmd_val(x) ((x).pmd) | ||
59 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
60 | #endif | ||
61 | |||
62 | #define pte_val(x) ((x).pte) | ||
63 | |||
64 | |||
65 | #define pte_get_bits(p, bits) ((p).pte & (bits)) | ||
66 | #define pte_set_bits(p, bits) ((p).pte |= (bits)) | ||
67 | #define pte_clear_bits(p, bits) ((p).pte &= ~(bits)) | ||
68 | #define pte_copy(to, from) ((to).pte = (from).pte) | ||
69 | #define pte_is_zero(p) (!((p).pte & ~_PAGE_NEWPAGE)) | ||
70 | #define pte_set_val(p, phys, prot) (p).pte = (phys | pgprot_val(prot)) | ||
71 | |||
72 | typedef unsigned long pfn_t; | ||
73 | typedef unsigned long phys_t; | ||
74 | |||
75 | #endif | ||
76 | |||
77 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
78 | |||
79 | #define pgd_val(x) ((x).pgd) | ||
80 | #define pgprot_val(x) ((x).pgprot) | ||
81 | |||
82 | #define __pte(x) ((pte_t) { (x) } ) | ||
83 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
84 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
85 | |||
86 | /* to align the pointer to the (next) page boundary */ | ||
87 | #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK) | ||
88 | |||
89 | extern unsigned long uml_physmem; | ||
90 | |||
91 | #define PAGE_OFFSET (uml_physmem) | ||
92 | #define KERNELBASE PAGE_OFFSET | ||
93 | |||
94 | #define __va_space (8*1024*1024) | ||
95 | |||
96 | extern unsigned long to_phys(void *virt); | ||
97 | extern void *to_virt(unsigned long phys); | ||
98 | #define __pa(virt) to_phys((void *) virt) | ||
99 | #define __va(phys) to_virt((unsigned long) phys) | ||
100 | |||
101 | #define page_to_pfn(page) ((page) - mem_map) | ||
102 | #define pfn_to_page(pfn) (mem_map + (pfn)) | ||
103 | |||
104 | #define phys_to_pfn(p) ((p) >> PAGE_SHIFT) | ||
105 | #define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT) | ||
106 | |||
107 | #define pfn_valid(pfn) ((pfn) < max_mapnr) | ||
108 | #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v))) | ||
109 | |||
110 | /* Pure 2^n version of get_order */ | ||
111 | static __inline__ int get_order(unsigned long size) | ||
112 | { | ||
113 | int order; | ||
114 | |||
115 | size = (size-1) >> (PAGE_SHIFT-1); | ||
116 | order = -1; | ||
117 | do { | ||
118 | size >>= 1; | ||
119 | order++; | ||
120 | } while (size); | ||
121 | return order; | ||
122 | } | ||
123 | |||
124 | extern struct page *arch_validate(struct page *page, int mask, int order); | ||
125 | #define HAVE_ARCH_VALIDATE | ||
126 | |||
127 | extern void arch_free_page(struct page *page, int order); | ||
128 | #define HAVE_ARCH_FREE_PAGE | ||
129 | |||
130 | #endif | ||
diff --git a/include/asm-um/page_offset.h b/include/asm-um/page_offset.h new file mode 100644 index 000000000000..1c168dfbf359 --- /dev/null +++ b/include/asm-um/page_offset.h | |||
@@ -0,0 +1 @@ | |||
#define PAGE_OFFSET_RAW (uml_physmem) | |||
diff --git a/include/asm-um/param.h b/include/asm-um/param.h new file mode 100644 index 000000000000..f914e7d67b01 --- /dev/null +++ b/include/asm-um/param.h | |||
@@ -0,0 +1,18 @@ | |||
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 100 | ||
14 | #define USER_HZ 100 /* .. some user interfaces are in "ticks" */ | ||
15 | #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ | ||
16 | #endif | ||
17 | |||
18 | #endif | ||
diff --git a/include/asm-um/pci.h b/include/asm-um/pci.h new file mode 100644 index 000000000000..59923199cdc3 --- /dev/null +++ b/include/asm-um/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/include/asm-um/pda.h b/include/asm-um/pda.h new file mode 100644 index 000000000000..0d8bf33ffd42 --- /dev/null +++ b/include/asm-um/pda.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PDA_X86_64_H | ||
8 | #define __UM_PDA_X86_64_H | ||
9 | |||
10 | /* XXX */ | ||
11 | struct foo { | ||
12 | unsigned int __softirq_pending; | ||
13 | unsigned int __nmi_count; | ||
14 | }; | ||
15 | |||
16 | extern struct foo me; | ||
17 | |||
18 | #define read_pda(me) (&me) | ||
19 | |||
20 | #endif | ||
21 | |||
22 | /* | ||
23 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
24 | * Emacs will notice this stuff at the end of the file and automatically | ||
25 | * adjust the settings for this buffer only. This must remain at the end | ||
26 | * of the file. | ||
27 | * --------------------------------------------------------------------------- | ||
28 | * Local variables: | ||
29 | * c-file-style: "linux" | ||
30 | * End: | ||
31 | */ | ||
diff --git a/include/asm-um/percpu.h b/include/asm-um/percpu.h new file mode 100644 index 000000000000..5723e2aab8e7 --- /dev/null +++ b/include/asm-um/percpu.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_PERCPU_H | ||
2 | #define __UM_PERCPU_H | ||
3 | |||
4 | #include "asm/arch/percpu.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/pgalloc.h b/include/asm-um/pgalloc.h new file mode 100644 index 000000000000..8fcb2fc0a892 --- /dev/null +++ b/include/asm-um/pgalloc.h | |||
@@ -0,0 +1,65 @@ | |||
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/config.h" | ||
12 | #include "linux/mm.h" | ||
13 | #include "asm/fixmap.h" | ||
14 | |||
15 | #define pmd_populate_kernel(mm, pmd, pte) \ | ||
16 | set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) | ||
17 | |||
18 | #define pmd_populate(mm, pmd, pte) \ | ||
19 | set_pmd(pmd, __pmd(_PAGE_TABLE + \ | ||
20 | ((unsigned long long)page_to_pfn(pte) << \ | ||
21 | (unsigned long long) PAGE_SHIFT))) | ||
22 | |||
23 | /* | ||
24 | * Allocate and free page tables. | ||
25 | */ | ||
26 | extern pgd_t *pgd_alloc(struct mm_struct *); | ||
27 | extern void pgd_free(pgd_t *pgd); | ||
28 | |||
29 | extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); | ||
30 | extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); | ||
31 | |||
32 | static inline void pte_free_kernel(pte_t *pte) | ||
33 | { | ||
34 | free_page((unsigned long) pte); | ||
35 | } | ||
36 | |||
37 | static inline void pte_free(struct page *pte) | ||
38 | { | ||
39 | __free_page(pte); | ||
40 | } | ||
41 | |||
42 | #define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) | ||
43 | |||
44 | #ifdef CONFIG_3_LEVEL_PGTABLES | ||
45 | /* | ||
46 | * In the 3-level case we free the pmds as part of the pgd. | ||
47 | */ | ||
48 | #define pmd_free(x) do { } while (0) | ||
49 | #define __pmd_free_tlb(tlb,x) do { } while (0) | ||
50 | #endif | ||
51 | |||
52 | #define check_pgt_cache() do { } while (0) | ||
53 | |||
54 | #endif | ||
55 | |||
56 | /* | ||
57 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
58 | * Emacs will notice this stuff at the end of the file and automatically | ||
59 | * adjust the settings for this buffer only. This must remain at the end | ||
60 | * of the file. | ||
61 | * --------------------------------------------------------------------------- | ||
62 | * Local variables: | ||
63 | * c-file-style: "linux" | ||
64 | * End: | ||
65 | */ | ||
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h new file mode 100644 index 000000000000..61eb24734247 --- /dev/null +++ b/include/asm-um/pgtable-2level.h | |||
@@ -0,0 +1,83 @@ | |||
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_PGD_NR 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 | |||
35 | static inline int pgd_newpage(pgd_t pgd) { return 0; } | ||
36 | static inline void pgd_mkuptodate(pgd_t pgd) { } | ||
37 | |||
38 | #define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | ||
39 | |||
40 | static inline pte_t pte_mknewprot(pte_t pte) | ||
41 | { | ||
42 | pte_val(pte) |= _PAGE_NEWPROT; | ||
43 | return(pte); | ||
44 | } | ||
45 | |||
46 | static inline pte_t pte_mknewpage(pte_t pte) | ||
47 | { | ||
48 | pte_val(pte) |= _PAGE_NEWPAGE; | ||
49 | return(pte); | ||
50 | } | ||
51 | |||
52 | static inline void set_pte(pte_t *pteptr, pte_t pteval) | ||
53 | { | ||
54 | /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so | ||
55 | * fix_range knows to unmap it. _PAGE_NEWPROT is specific to | ||
56 | * mapped pages. | ||
57 | */ | ||
58 | *pteptr = pte_mknewpage(pteval); | ||
59 | if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr); | ||
60 | } | ||
61 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
62 | |||
63 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) | ||
64 | |||
65 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
66 | #define pte_none(x) !(pte_val(x) & ~_PAGE_NEWPAGE) | ||
67 | #define pte_pfn(x) phys_to_pfn(pte_val(x)) | ||
68 | #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot)) | ||
69 | #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot)) | ||
70 | |||
71 | #define pmd_page_kernel(pmd) \ | ||
72 | ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ||
73 | |||
74 | /* | ||
75 | * Bits 0 through 3 are taken | ||
76 | */ | ||
77 | #define PTE_FILE_MAX_BITS 28 | ||
78 | |||
79 | #define pte_to_pgoff(pte) (pte_val(pte) >> 4) | ||
80 | |||
81 | #define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE }) | ||
82 | |||
83 | #endif | ||
diff --git a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h new file mode 100644 index 000000000000..faf051c2c418 --- /dev/null +++ b/include/asm-um/pgtable-3level.h | |||
@@ -0,0 +1,173 @@ | |||
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 | #define PGDIR_SHIFT 30 | ||
15 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) | ||
16 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) | ||
17 | |||
18 | /* PMD_SHIFT determines the size of the area a second-level page table can | ||
19 | * map | ||
20 | */ | ||
21 | |||
22 | #define PMD_SHIFT 21 | ||
23 | #define PMD_SIZE (1UL << PMD_SHIFT) | ||
24 | #define PMD_MASK (~(PMD_SIZE-1)) | ||
25 | |||
26 | /* | ||
27 | * entries per page directory level | ||
28 | */ | ||
29 | |||
30 | #define PTRS_PER_PTE 512 | ||
31 | #define PTRS_PER_PMD 512 | ||
32 | #define USER_PTRS_PER_PGD ((TASK_SIZE + (PGDIR_SIZE - 1)) / PGDIR_SIZE) | ||
33 | #define PTRS_PER_PGD 512 | ||
34 | #define FIRST_USER_PGD_NR 0 | ||
35 | |||
36 | #define pte_ERROR(e) \ | ||
37 | printk("%s:%d: bad pte %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | ||
38 | pte_val(e)) | ||
39 | #define pmd_ERROR(e) \ | ||
40 | printk("%s:%d: bad pmd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | ||
41 | pmd_val(e)) | ||
42 | #define pgd_ERROR(e) \ | ||
43 | printk("%s:%d: bad pgd %p(%016lx).\n", __FILE__, __LINE__, &(e), \ | ||
44 | pgd_val(e)) | ||
45 | |||
46 | #define pud_none(x) (!(pud_val(x) & ~_PAGE_NEWPAGE)) | ||
47 | #define pud_bad(x) ((pud_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | ||
48 | #define pud_present(x) (pud_val(x) & _PAGE_PRESENT) | ||
49 | #define pud_populate(mm, pud, pmd) \ | ||
50 | set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) | ||
51 | |||
52 | #define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) | ||
53 | static inline int pgd_newpage(pgd_t pgd) | ||
54 | { | ||
55 | return(pgd_val(pgd) & _PAGE_NEWPAGE); | ||
56 | } | ||
57 | |||
58 | static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } | ||
59 | |||
60 | |||
61 | #define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE)) | ||
62 | |||
63 | static inline pte_t pte_mknewprot(pte_t pte) | ||
64 | { | ||
65 | pte_set_bits(pte, _PAGE_NEWPROT); | ||
66 | return(pte); | ||
67 | } | ||
68 | |||
69 | static inline pte_t pte_mknewpage(pte_t pte) | ||
70 | { | ||
71 | pte_set_bits(pte, _PAGE_NEWPAGE); | ||
72 | return(pte); | ||
73 | } | ||
74 | |||
75 | static inline void set_pte(pte_t *pteptr, pte_t pteval) | ||
76 | { | ||
77 | pte_copy(*pteptr, pteval); | ||
78 | |||
79 | /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so | ||
80 | * fix_range knows to unmap it. _PAGE_NEWPROT is specific to | ||
81 | * mapped pages. | ||
82 | */ | ||
83 | |||
84 | *pteptr = pte_mknewpage(*pteptr); | ||
85 | if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr); | ||
86 | } | ||
87 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
88 | |||
89 | #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) | ||
90 | |||
91 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | ||
92 | { | ||
93 | pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL); | ||
94 | |||
95 | if(pmd) | ||
96 | memset(pmd, 0, PAGE_SIZE); | ||
97 | |||
98 | return pmd; | ||
99 | } | ||
100 | |||
101 | static inline void pmd_free(pmd_t *pmd){ | ||
102 | free_page((unsigned long) pmd); | ||
103 | } | ||
104 | |||
105 | #define __pmd_free_tlb(tlb,x) do { } while (0) | ||
106 | |||
107 | static inline void pud_clear (pud_t * pud) { } | ||
108 | |||
109 | #define pud_page(pud) \ | ||
110 | ((struct page *) __va(pud_val(pud) & PAGE_MASK)) | ||
111 | |||
112 | /* Find an entry in the second-level page table.. */ | ||
113 | #define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \ | ||
114 | pmd_index(address)) | ||
115 | |||
116 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
117 | |||
118 | static inline int pte_none(pte_t pte) | ||
119 | { | ||
120 | return pte_is_zero(pte); | ||
121 | } | ||
122 | |||
123 | static inline unsigned long pte_pfn(pte_t pte) | ||
124 | { | ||
125 | return phys_to_pfn(pte_val(pte)); | ||
126 | } | ||
127 | |||
128 | static inline pte_t pfn_pte(pfn_t page_nr, pgprot_t pgprot) | ||
129 | { | ||
130 | pte_t pte; | ||
131 | phys_t phys = pfn_to_phys(page_nr); | ||
132 | |||
133 | pte_set_val(pte, phys, pgprot); | ||
134 | return pte; | ||
135 | } | ||
136 | |||
137 | static inline pmd_t pfn_pmd(pfn_t page_nr, pgprot_t pgprot) | ||
138 | { | ||
139 | return __pmd((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); | ||
140 | } | ||
141 | |||
142 | /* | ||
143 | * Bits 0 through 3 are taken in the low part of the pte, | ||
144 | * put the 32 bits of offset into the high part. | ||
145 | */ | ||
146 | #define PTE_FILE_MAX_BITS 32 | ||
147 | |||
148 | #ifdef CONFIG_64_BIT | ||
149 | |||
150 | #define pte_to_pgoff(p) ((p).pte >> 32) | ||
151 | |||
152 | #define pgoff_to_pte(off) ((pte_t) { ((off) < 32) | _PAGE_FILE }) | ||
153 | |||
154 | #else | ||
155 | |||
156 | #define pte_to_pgoff(pte) ((pte).pte_high) | ||
157 | |||
158 | #define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) }) | ||
159 | |||
160 | #endif | ||
161 | |||
162 | #endif | ||
163 | |||
164 | /* | ||
165 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
166 | * Emacs will notice this stuff at the end of the file and automatically | ||
167 | * adjust the settings for this buffer only. This must remain at the end | ||
168 | * of the file. | ||
169 | * --------------------------------------------------------------------------- | ||
170 | * Local variables: | ||
171 | * c-file-style: "linux" | ||
172 | * End: | ||
173 | */ | ||
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h new file mode 100644 index 000000000000..71f9c0c78c0c --- /dev/null +++ b/include/asm-um/pgtable.h | |||
@@ -0,0 +1,386 @@ | |||
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_H | ||
9 | #define __UM_PGTABLE_H | ||
10 | |||
11 | #include "linux/sched.h" | ||
12 | #include "linux/linkage.h" | ||
13 | #include "asm/processor.h" | ||
14 | #include "asm/page.h" | ||
15 | #include "asm/fixmap.h" | ||
16 | |||
17 | #define _PAGE_PRESENT 0x001 | ||
18 | #define _PAGE_NEWPAGE 0x002 | ||
19 | #define _PAGE_NEWPROT 0x004 | ||
20 | #define _PAGE_FILE 0x008 /* set:pagecache unset:swap */ | ||
21 | #define _PAGE_PROTNONE 0x010 /* If not present */ | ||
22 | #define _PAGE_RW 0x020 | ||
23 | #define _PAGE_USER 0x040 | ||
24 | #define _PAGE_ACCESSED 0x080 | ||
25 | #define _PAGE_DIRTY 0x100 | ||
26 | |||
27 | #ifdef CONFIG_3_LEVEL_PGTABLES | ||
28 | #include "asm/pgtable-3level.h" | ||
29 | #else | ||
30 | #include "asm/pgtable-2level.h" | ||
31 | #endif | ||
32 | |||
33 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | ||
34 | |||
35 | extern void *um_virt_to_phys(struct task_struct *task, unsigned long virt, | ||
36 | pte_t *pte_out); | ||
37 | |||
38 | /* zero page used for uninitialized stuff */ | ||
39 | extern unsigned long *empty_zero_page; | ||
40 | |||
41 | #define pgtable_cache_init() do ; while (0) | ||
42 | |||
43 | /* | ||
44 | * pgd entries used up by user/kernel: | ||
45 | */ | ||
46 | |||
47 | #define USER_PGD_PTRS (TASK_SIZE >> PGDIR_SHIFT) | ||
48 | #define KERNEL_PGD_PTRS (PTRS_PER_PGD-USER_PGD_PTRS) | ||
49 | |||
50 | #ifndef __ASSEMBLY__ | ||
51 | /* Just any arbitrary offset to the start of the vmalloc VM area: the | ||
52 | * current 8MB value just means that there will be a 8MB "hole" after the | ||
53 | * physical memory until the kernel virtual memory starts. That means that | ||
54 | * any out-of-bounds memory accesses will hopefully be caught. | ||
55 | * The vmalloc() routines leaves a hole of 4kB between each vmalloced | ||
56 | * area for the same reason. ;) | ||
57 | */ | ||
58 | |||
59 | extern unsigned long end_iomem; | ||
60 | |||
61 | #define VMALLOC_OFFSET (__va_space) | ||
62 | #define VMALLOC_START ((end_iomem + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) | ||
63 | |||
64 | #ifdef CONFIG_HIGHMEM | ||
65 | # define VMALLOC_END (PKMAP_BASE-2*PAGE_SIZE) | ||
66 | #else | ||
67 | # define VMALLOC_END (FIXADDR_START-2*PAGE_SIZE) | ||
68 | #endif | ||
69 | |||
70 | #define REGION_SHIFT (sizeof(pte_t) * 8 - 4) | ||
71 | #define REGION_MASK (((unsigned long) 0xf) << REGION_SHIFT) | ||
72 | |||
73 | #define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
74 | #define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
75 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) | ||
76 | |||
77 | #define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) | ||
78 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED) | ||
79 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) | ||
80 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED) | ||
81 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) | ||
82 | #define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED) | ||
83 | |||
84 | /* | ||
85 | * The i386 can't do page protection for execute, and considers that the same are read. | ||
86 | * Also, write permissions imply read permissions. This is the closest we can get.. | ||
87 | */ | ||
88 | #define __P000 PAGE_NONE | ||
89 | #define __P001 PAGE_READONLY | ||
90 | #define __P010 PAGE_COPY | ||
91 | #define __P011 PAGE_COPY | ||
92 | #define __P100 PAGE_READONLY | ||
93 | #define __P101 PAGE_READONLY | ||
94 | #define __P110 PAGE_COPY | ||
95 | #define __P111 PAGE_COPY | ||
96 | |||
97 | #define __S000 PAGE_NONE | ||
98 | #define __S001 PAGE_READONLY | ||
99 | #define __S010 PAGE_SHARED | ||
100 | #define __S011 PAGE_SHARED | ||
101 | #define __S100 PAGE_READONLY | ||
102 | #define __S101 PAGE_READONLY | ||
103 | #define __S110 PAGE_SHARED | ||
104 | #define __S111 PAGE_SHARED | ||
105 | |||
106 | /* | ||
107 | * Define this if things work differently on an i386 and an i486: | ||
108 | * it will (on an i486) warn about kernel memory accesses that are | ||
109 | * done without a 'verify_area(VERIFY_WRITE,..)' | ||
110 | */ | ||
111 | #undef TEST_VERIFY_AREA | ||
112 | |||
113 | /* page table for 0-4MB for everybody */ | ||
114 | extern unsigned long pg0[1024]; | ||
115 | |||
116 | /* | ||
117 | * BAD_PAGETABLE is used when we need a bogus page-table, while | ||
118 | * BAD_PAGE is used for a bogus page. | ||
119 | * | ||
120 | * ZERO_PAGE is a global shared page that is always zero: used | ||
121 | * for zero-mapped memory areas etc.. | ||
122 | */ | ||
123 | extern pte_t __bad_page(void); | ||
124 | extern pte_t * __bad_pagetable(void); | ||
125 | |||
126 | #define BAD_PAGETABLE __bad_pagetable() | ||
127 | #define BAD_PAGE __bad_page() | ||
128 | |||
129 | #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) | ||
130 | |||
131 | /* number of bits that fit into a memory pointer */ | ||
132 | #define BITS_PER_PTR (8*sizeof(unsigned long)) | ||
133 | |||
134 | /* to align the pointer to a pointer address */ | ||
135 | #define PTR_MASK (~(sizeof(void*)-1)) | ||
136 | |||
137 | /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */ | ||
138 | /* 64-bit machines, beware! SRB. */ | ||
139 | #define SIZEOF_PTR_LOG2 3 | ||
140 | |||
141 | /* to find an entry in a page-table */ | ||
142 | #define PAGE_PTR(address) \ | ||
143 | ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK) | ||
144 | |||
145 | #define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE)) | ||
146 | |||
147 | #define pmd_none(x) (!(pmd_val(x) & ~_PAGE_NEWPAGE)) | ||
148 | #define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE) | ||
149 | #define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) | ||
150 | #define pmd_clear(xp) do { pmd_val(*(xp)) = _PAGE_NEWPAGE; } while (0) | ||
151 | |||
152 | #define pmd_newpage(x) (pmd_val(x) & _PAGE_NEWPAGE) | ||
153 | #define pmd_mkuptodate(x) (pmd_val(x) &= ~_PAGE_NEWPAGE) | ||
154 | |||
155 | #define pud_newpage(x) (pud_val(x) & _PAGE_NEWPAGE) | ||
156 | #define pud_mkuptodate(x) (pud_val(x) &= ~_PAGE_NEWPAGE) | ||
157 | |||
158 | #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) | ||
159 | |||
160 | #define pmd_page(pmd) phys_to_page(pmd_val(pmd) & PAGE_MASK) | ||
161 | |||
162 | #define pte_address(x) (__va(pte_val(x) & PAGE_MASK)) | ||
163 | #define mk_phys(a, r) ((a) + (((unsigned long) r) << REGION_SHIFT)) | ||
164 | #define phys_addr(p) ((p) & ~REGION_MASK) | ||
165 | |||
166 | /* | ||
167 | * The following only work if pte_present() is true. | ||
168 | * Undefined behaviour if not.. | ||
169 | */ | ||
170 | static inline int pte_user(pte_t pte) | ||
171 | { | ||
172 | return((pte_get_bits(pte, _PAGE_USER)) && | ||
173 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
174 | } | ||
175 | |||
176 | static inline int pte_read(pte_t pte) | ||
177 | { | ||
178 | return((pte_get_bits(pte, _PAGE_USER)) && | ||
179 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
180 | } | ||
181 | |||
182 | static inline int pte_exec(pte_t pte){ | ||
183 | return((pte_get_bits(pte, _PAGE_USER)) && | ||
184 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
185 | } | ||
186 | |||
187 | static inline int pte_write(pte_t pte) | ||
188 | { | ||
189 | return((pte_get_bits(pte, _PAGE_RW)) && | ||
190 | !(pte_get_bits(pte, _PAGE_PROTNONE))); | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * The following only works if pte_present() is not true. | ||
195 | */ | ||
196 | static inline int pte_file(pte_t pte) | ||
197 | { | ||
198 | return pte_get_bits(pte, _PAGE_FILE); | ||
199 | } | ||
200 | |||
201 | static inline int pte_dirty(pte_t pte) | ||
202 | { | ||
203 | return pte_get_bits(pte, _PAGE_DIRTY); | ||
204 | } | ||
205 | |||
206 | static inline int pte_young(pte_t pte) | ||
207 | { | ||
208 | return pte_get_bits(pte, _PAGE_ACCESSED); | ||
209 | } | ||
210 | |||
211 | static inline int pte_newpage(pte_t pte) | ||
212 | { | ||
213 | return pte_get_bits(pte, _PAGE_NEWPAGE); | ||
214 | } | ||
215 | |||
216 | static inline int pte_newprot(pte_t pte) | ||
217 | { | ||
218 | return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT))); | ||
219 | } | ||
220 | |||
221 | static inline pte_t pte_rdprotect(pte_t pte) | ||
222 | { | ||
223 | pte_clear_bits(pte, _PAGE_USER); | ||
224 | return(pte_mknewprot(pte)); | ||
225 | } | ||
226 | |||
227 | static inline pte_t pte_exprotect(pte_t pte) | ||
228 | { | ||
229 | pte_clear_bits(pte, _PAGE_USER); | ||
230 | return(pte_mknewprot(pte)); | ||
231 | } | ||
232 | |||
233 | static inline pte_t pte_mkclean(pte_t pte) | ||
234 | { | ||
235 | pte_clear_bits(pte, _PAGE_DIRTY); | ||
236 | return(pte); | ||
237 | } | ||
238 | |||
239 | static inline pte_t pte_mkold(pte_t pte) | ||
240 | { | ||
241 | pte_clear_bits(pte, _PAGE_ACCESSED); | ||
242 | return(pte); | ||
243 | } | ||
244 | |||
245 | static inline pte_t pte_wrprotect(pte_t pte) | ||
246 | { | ||
247 | pte_clear_bits(pte, _PAGE_RW); | ||
248 | return(pte_mknewprot(pte)); | ||
249 | } | ||
250 | |||
251 | static inline pte_t pte_mkread(pte_t pte) | ||
252 | { | ||
253 | pte_set_bits(pte, _PAGE_RW); | ||
254 | return(pte_mknewprot(pte)); | ||
255 | } | ||
256 | |||
257 | static inline pte_t pte_mkexec(pte_t pte) | ||
258 | { | ||
259 | pte_set_bits(pte, _PAGE_USER); | ||
260 | return(pte_mknewprot(pte)); | ||
261 | } | ||
262 | |||
263 | static inline pte_t pte_mkdirty(pte_t pte) | ||
264 | { | ||
265 | pte_set_bits(pte, _PAGE_DIRTY); | ||
266 | return(pte); | ||
267 | } | ||
268 | |||
269 | static inline pte_t pte_mkyoung(pte_t pte) | ||
270 | { | ||
271 | pte_set_bits(pte, _PAGE_ACCESSED); | ||
272 | return(pte); | ||
273 | } | ||
274 | |||
275 | static inline pte_t pte_mkwrite(pte_t pte) | ||
276 | { | ||
277 | pte_set_bits(pte, _PAGE_RW); | ||
278 | return(pte_mknewprot(pte)); | ||
279 | } | ||
280 | |||
281 | static inline pte_t pte_mkuptodate(pte_t pte) | ||
282 | { | ||
283 | pte_clear_bits(pte, _PAGE_NEWPAGE); | ||
284 | if(pte_present(pte)) | ||
285 | pte_clear_bits(pte, _PAGE_NEWPROT); | ||
286 | return(pte); | ||
287 | } | ||
288 | |||
289 | extern phys_t page_to_phys(struct page *page); | ||
290 | |||
291 | /* | ||
292 | * Conversion functions: convert a page and protection to a page entry, | ||
293 | * and a page entry and page directory to the page they refer to. | ||
294 | */ | ||
295 | |||
296 | extern pte_t mk_pte(struct page *page, pgprot_t pgprot); | ||
297 | |||
298 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | ||
299 | { | ||
300 | pte_set_val(pte, (pte_val(pte) & _PAGE_CHG_MASK), newprot); | ||
301 | if(pte_present(pte)) pte = pte_mknewpage(pte_mknewprot(pte)); | ||
302 | return pte; | ||
303 | } | ||
304 | |||
305 | #define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) | ||
306 | |||
307 | /* | ||
308 | * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] | ||
309 | * | ||
310 | * this macro returns the index of the entry in the pgd page which would | ||
311 | * control the given virtual address | ||
312 | */ | ||
313 | #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) | ||
314 | |||
315 | #define pgd_index_k(addr) pgd_index(addr) | ||
316 | |||
317 | /* | ||
318 | * pgd_offset() returns a (pgd_t *) | ||
319 | * pgd_index() is used get the offset into the pgd page's array of pgd_t's; | ||
320 | */ | ||
321 | #define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) | ||
322 | |||
323 | /* | ||
324 | * a shortcut which implies the use of the kernel's pgd, instead | ||
325 | * of a process's | ||
326 | */ | ||
327 | #define pgd_offset_k(address) pgd_offset(&init_mm, address) | ||
328 | |||
329 | /* | ||
330 | * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] | ||
331 | * | ||
332 | * this macro returns the index of the entry in the pmd page which would | ||
333 | * control the given virtual address | ||
334 | */ | ||
335 | #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) | ||
336 | |||
337 | /* | ||
338 | * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] | ||
339 | * | ||
340 | * this macro returns the index of the entry in the pte page which would | ||
341 | * control the given virtual address | ||
342 | */ | ||
343 | #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | ||
344 | #define pte_offset_kernel(dir, address) \ | ||
345 | ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) | ||
346 | #define pte_offset_map(dir, address) \ | ||
347 | ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) | ||
348 | #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address) | ||
349 | #define pte_unmap(pte) do { } while (0) | ||
350 | #define pte_unmap_nested(pte) do { } while (0) | ||
351 | |||
352 | #define update_mmu_cache(vma,address,pte) do ; while (0) | ||
353 | |||
354 | /* Encode and de-code a swap entry */ | ||
355 | #define __swp_type(x) (((x).val >> 4) & 0x3f) | ||
356 | #define __swp_offset(x) ((x).val >> 11) | ||
357 | |||
358 | #define __swp_entry(type, offset) \ | ||
359 | ((swp_entry_t) { ((type) << 4) | ((offset) << 11) }) | ||
360 | #define __pte_to_swp_entry(pte) \ | ||
361 | ((swp_entry_t) { pte_val(pte_mkuptodate(pte)) }) | ||
362 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | ||
363 | |||
364 | #define kern_addr_valid(addr) (1) | ||
365 | |||
366 | #include <asm-generic/pgtable.h> | ||
367 | |||
368 | #include <asm-generic/pgtable-nopud.h> | ||
369 | |||
370 | #endif | ||
371 | #endif | ||
372 | |||
373 | extern struct page *phys_to_page(const unsigned long phys); | ||
374 | extern struct page *__virt_to_page(const unsigned long virt); | ||
375 | #define virt_to_page(addr) __virt_to_page((const unsigned long) addr) | ||
376 | |||
377 | /* | ||
378 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
379 | * Emacs will notice this stuff at the end of the file and automatically | ||
380 | * adjust the settings for this buffer only. This must remain at the end | ||
381 | * of the file. | ||
382 | * --------------------------------------------------------------------------- | ||
383 | * Local variables: | ||
384 | * c-file-style: "linux" | ||
385 | * End: | ||
386 | */ | ||
diff --git a/include/asm-um/poll.h b/include/asm-um/poll.h new file mode 100644 index 000000000000..1eb4e1bc6383 --- /dev/null +++ b/include/asm-um/poll.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_POLL_H | ||
2 | #define __UM_POLL_H | ||
3 | |||
4 | #include "asm/arch/poll.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/posix_types.h b/include/asm-um/posix_types.h new file mode 100644 index 000000000000..32fb4198f644 --- /dev/null +++ b/include/asm-um/posix_types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_POSIX_TYPES_H | ||
2 | #define __UM_POSIX_TYPES_H | ||
3 | |||
4 | #include "asm/arch/posix_types.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/prctl.h b/include/asm-um/prctl.h new file mode 100644 index 000000000000..64b6d099bdd5 --- /dev/null +++ b/include/asm-um/prctl.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_PRCTL_H | ||
2 | #define __UM_PRCTL_H | ||
3 | |||
4 | #include "asm/arch/prctl.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h new file mode 100644 index 000000000000..038ba6fc88b8 --- /dev/null +++ b/include/asm-um/processor-generic.h | |||
@@ -0,0 +1,150 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PROCESSOR_GENERIC_H | ||
7 | #define __UM_PROCESSOR_GENERIC_H | ||
8 | |||
9 | struct pt_regs; | ||
10 | |||
11 | struct task_struct; | ||
12 | |||
13 | #include "linux/config.h" | ||
14 | #include "asm/ptrace.h" | ||
15 | #include "choose-mode.h" | ||
16 | |||
17 | struct mm_struct; | ||
18 | |||
19 | struct thread_struct { | ||
20 | int forking; | ||
21 | int nsyscalls; | ||
22 | struct pt_regs regs; | ||
23 | unsigned long cr2; | ||
24 | int err; | ||
25 | unsigned long trap_no; | ||
26 | int singlestep_syscall; | ||
27 | void *fault_addr; | ||
28 | void *fault_catcher; | ||
29 | struct task_struct *prev_sched; | ||
30 | unsigned long temp_stack; | ||
31 | void *exec_buf; | ||
32 | struct arch_thread arch; | ||
33 | union { | ||
34 | #ifdef CONFIG_MODE_TT | ||
35 | struct { | ||
36 | int extern_pid; | ||
37 | int tracing; | ||
38 | int switch_pipe[2]; | ||
39 | int vm_seq; | ||
40 | } tt; | ||
41 | #endif | ||
42 | #ifdef CONFIG_MODE_SKAS | ||
43 | struct { | ||
44 | void *switch_buf; | ||
45 | void *fork_buf; | ||
46 | int mm_count; | ||
47 | } skas; | ||
48 | #endif | ||
49 | } mode; | ||
50 | struct { | ||
51 | int op; | ||
52 | union { | ||
53 | struct { | ||
54 | int pid; | ||
55 | } fork, exec; | ||
56 | struct { | ||
57 | int (*proc)(void *); | ||
58 | void *arg; | ||
59 | } thread; | ||
60 | struct { | ||
61 | void (*proc)(void *); | ||
62 | void *arg; | ||
63 | } cb; | ||
64 | } u; | ||
65 | } request; | ||
66 | }; | ||
67 | |||
68 | #define INIT_THREAD \ | ||
69 | { \ | ||
70 | .forking = 0, \ | ||
71 | .nsyscalls = 0, \ | ||
72 | .regs = EMPTY_REGS, \ | ||
73 | .cr2 = 0, \ | ||
74 | .err = 0, \ | ||
75 | .fault_addr = NULL, \ | ||
76 | .prev_sched = NULL, \ | ||
77 | .temp_stack = 0, \ | ||
78 | .exec_buf = NULL, \ | ||
79 | .arch = INIT_ARCH_THREAD, \ | ||
80 | .request = { 0 } \ | ||
81 | } | ||
82 | |||
83 | typedef struct { | ||
84 | unsigned long seg; | ||
85 | } mm_segment_t; | ||
86 | |||
87 | extern struct task_struct *alloc_task_struct(void); | ||
88 | |||
89 | extern void release_thread(struct task_struct *); | ||
90 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
91 | extern void dump_thread(struct pt_regs *regs, struct user *u); | ||
92 | extern void prepare_to_copy(struct task_struct *tsk); | ||
93 | |||
94 | extern unsigned long thread_saved_pc(struct task_struct *t); | ||
95 | |||
96 | static inline void mm_copy_segments(struct mm_struct *from_mm, | ||
97 | struct mm_struct *new_mm) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | #define init_stack (init_thread_union.stack) | ||
102 | |||
103 | /* | ||
104 | * User space process size: 3GB (default). | ||
105 | */ | ||
106 | extern unsigned long task_size; | ||
107 | |||
108 | #define TASK_SIZE (task_size) | ||
109 | |||
110 | /* This decides where the kernel will search for a free chunk of vm | ||
111 | * space during mmap's. | ||
112 | */ | ||
113 | #define TASK_UNMAPPED_BASE (0x40000000) | ||
114 | |||
115 | extern void start_thread(struct pt_regs *regs, unsigned long entry, | ||
116 | unsigned long stack); | ||
117 | |||
118 | struct cpuinfo_um { | ||
119 | unsigned long loops_per_jiffy; | ||
120 | int ipi_pipe[2]; | ||
121 | }; | ||
122 | |||
123 | extern struct cpuinfo_um boot_cpu_data; | ||
124 | |||
125 | #define my_cpu_data cpu_data[smp_processor_id()] | ||
126 | |||
127 | #ifdef CONFIG_SMP | ||
128 | extern struct cpuinfo_um cpu_data[]; | ||
129 | #define current_cpu_data cpu_data[smp_processor_id()] | ||
130 | #else | ||
131 | #define cpu_data (&boot_cpu_data) | ||
132 | #define current_cpu_data boot_cpu_data | ||
133 | #endif | ||
134 | |||
135 | #define KSTK_EIP(tsk) (PT_REGS_IP(&tsk->thread.regs)) | ||
136 | #define KSTK_ESP(tsk) (PT_REGS_SP(&tsk->thread.regs)) | ||
137 | #define get_wchan(p) (0) | ||
138 | |||
139 | #endif | ||
140 | |||
141 | /* | ||
142 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
143 | * Emacs will notice this stuff at the end of the file and automatically | ||
144 | * adjust the settings for this buffer only. This must remain at the end | ||
145 | * of the file. | ||
146 | * --------------------------------------------------------------------------- | ||
147 | * Local variables: | ||
148 | * c-file-style: "linux" | ||
149 | * End: | ||
150 | */ | ||
diff --git a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h new file mode 100644 index 000000000000..2deb8f1adbf1 --- /dev/null +++ b/include/asm-um/processor-i386.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PROCESSOR_I386_H | ||
7 | #define __UM_PROCESSOR_I386_H | ||
8 | |||
9 | extern int host_has_xmm; | ||
10 | extern int host_has_cmov; | ||
11 | |||
12 | struct arch_thread { | ||
13 | unsigned long debugregs[8]; | ||
14 | int debugregs_seq; | ||
15 | }; | ||
16 | |||
17 | #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ | ||
18 | .debugregs_seq = 0 } | ||
19 | |||
20 | #include "asm/arch/user.h" | ||
21 | |||
22 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | ||
23 | static inline void rep_nop(void) | ||
24 | { | ||
25 | __asm__ __volatile__("rep;nop": : :"memory"); | ||
26 | } | ||
27 | |||
28 | #define cpu_relax() rep_nop() | ||
29 | |||
30 | /* | ||
31 | * Default implementation of macro that returns current | ||
32 | * instruction pointer ("program counter"). Stolen | ||
33 | * from asm-i386/processor.h | ||
34 | */ | ||
35 | #define current_text_addr() \ | ||
36 | ({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; }) | ||
37 | |||
38 | #define ARCH_IS_STACKGROW(address) \ | ||
39 | (address + 32 >= UPT_SP(¤t->thread.regs.regs)) | ||
40 | |||
41 | #include "asm/processor-generic.h" | ||
42 | |||
43 | #endif | ||
44 | |||
45 | /* | ||
46 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
47 | * Emacs will notice this stuff at the end of the file and automatically | ||
48 | * adjust the settings for this buffer only. This must remain at the end | ||
49 | * of the file. | ||
50 | * --------------------------------------------------------------------------- | ||
51 | * Local variables: | ||
52 | * c-file-style: "linux" | ||
53 | * End: | ||
54 | */ | ||
diff --git a/include/asm-um/processor-ppc.h b/include/asm-um/processor-ppc.h new file mode 100644 index 000000000000..959323151229 --- /dev/null +++ b/include/asm-um/processor-ppc.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef __UM_PROCESSOR_PPC_H | ||
2 | #define __UM_PROCESSOR_PPC_H | ||
3 | |||
4 | #if defined(__ASSEMBLY__) | ||
5 | |||
6 | #define CONFIG_PPC_MULTIPLATFORM | ||
7 | #include "arch/processor.h" | ||
8 | |||
9 | #else | ||
10 | |||
11 | #include "asm/processor-generic.h" | ||
12 | |||
13 | #endif | ||
14 | |||
15 | #endif | ||
diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h new file mode 100644 index 000000000000..a1ae3a4cd938 --- /dev/null +++ b/include/asm-um/processor-x86_64.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PROCESSOR_X86_64_H | ||
8 | #define __UM_PROCESSOR_X86_64_H | ||
9 | |||
10 | #include "asm/arch/user.h" | ||
11 | |||
12 | struct arch_thread { | ||
13 | }; | ||
14 | |||
15 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ | ||
16 | extern inline void rep_nop(void) | ||
17 | { | ||
18 | __asm__ __volatile__("rep;nop": : :"memory"); | ||
19 | } | ||
20 | |||
21 | #define cpu_relax() rep_nop() | ||
22 | |||
23 | #define INIT_ARCH_THREAD { } | ||
24 | |||
25 | #define current_text_addr() \ | ||
26 | ({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; }) | ||
27 | |||
28 | #define ARCH_IS_STACKGROW(address) \ | ||
29 | (address + 128 >= UPT_SP(¤t->thread.regs.regs)) | ||
30 | |||
31 | #include "asm/processor-generic.h" | ||
32 | |||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
37 | * Emacs will notice this stuff at the end of the file and automatically | ||
38 | * adjust the settings for this buffer only. This must remain at the end | ||
39 | * of the file. | ||
40 | * --------------------------------------------------------------------------- | ||
41 | * Local variables: | ||
42 | * c-file-style: "linux" | ||
43 | * End: | ||
44 | */ | ||
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h new file mode 100644 index 000000000000..46599ac44037 --- /dev/null +++ b/include/asm-um/ptrace-generic.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.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 "linux/config.h" | ||
12 | |||
13 | #define pt_regs pt_regs_subarch | ||
14 | #define show_regs show_regs_subarch | ||
15 | #define send_sigtrap send_sigtrap_subarch | ||
16 | |||
17 | #include "asm/arch/ptrace.h" | ||
18 | |||
19 | #undef pt_regs | ||
20 | #undef show_regs | ||
21 | #undef send_sigtrap | ||
22 | #undef user_mode | ||
23 | #undef instruction_pointer | ||
24 | |||
25 | #include "sysdep/ptrace.h" | ||
26 | |||
27 | struct pt_regs { | ||
28 | union uml_pt_regs regs; | ||
29 | }; | ||
30 | |||
31 | #define EMPTY_REGS { regs : EMPTY_UML_PT_REGS } | ||
32 | |||
33 | #define PT_REGS_IP(r) UPT_IP(&(r)->regs) | ||
34 | #define PT_REGS_SP(r) UPT_SP(&(r)->regs) | ||
35 | |||
36 | #define PT_REG(r, reg) UPT_REG(&(r)->regs, reg) | ||
37 | #define PT_REGS_SET(r, reg, val) UPT_SET(&(r)->regs, reg, val) | ||
38 | |||
39 | #define PT_REGS_SET_SYSCALL_RETURN(r, res) \ | ||
40 | UPT_SET_SYSCALL_RETURN(&(r)->regs, res) | ||
41 | #define PT_REGS_RESTART_SYSCALL(r) UPT_RESTART_SYSCALL(&(r)->regs) | ||
42 | |||
43 | #define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs) | ||
44 | |||
45 | #define PT_REGS_SC(r) UPT_SC(&(r)->regs) | ||
46 | |||
47 | #define instruction_pointer(regs) PT_REGS_IP(regs) | ||
48 | |||
49 | struct task_struct; | ||
50 | |||
51 | extern unsigned long getreg(struct task_struct *child, int regno); | ||
52 | extern int putreg(struct task_struct *child, int regno, unsigned long value); | ||
53 | extern int get_fpregs(unsigned long buf, struct task_struct *child); | ||
54 | extern int set_fpregs(unsigned long buf, struct task_struct *child); | ||
55 | extern int get_fpxregs(unsigned long buf, struct task_struct *child); | ||
56 | extern int set_fpxregs(unsigned long buf, struct task_struct *tsk); | ||
57 | |||
58 | extern void show_regs(struct pt_regs *regs); | ||
59 | |||
60 | extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, | ||
61 | int error_code); | ||
62 | |||
63 | #endif | ||
64 | |||
65 | #endif | ||
66 | |||
67 | /* | ||
68 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
69 | * Emacs will notice this stuff at the end of the file and automatically | ||
70 | * adjust the settings for this buffer only. This must remain at the end | ||
71 | * of the file. | ||
72 | * --------------------------------------------------------------------------- | ||
73 | * Local variables: | ||
74 | * c-file-style: "linux" | ||
75 | * End: | ||
76 | */ | ||
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h new file mode 100644 index 000000000000..9e47590ec293 --- /dev/null +++ b/include/asm-um/ptrace-i386.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_PTRACE_I386_H | ||
7 | #define __UM_PTRACE_I386_H | ||
8 | |||
9 | #include "sysdep/ptrace.h" | ||
10 | #include "asm/ptrace-generic.h" | ||
11 | |||
12 | #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) | ||
13 | #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) | ||
14 | #define PT_REGS_ECX(r) UPT_ECX(&(r)->regs) | ||
15 | #define PT_REGS_EDX(r) UPT_EDX(&(r)->regs) | ||
16 | #define PT_REGS_ESI(r) UPT_ESI(&(r)->regs) | ||
17 | #define PT_REGS_EDI(r) UPT_EDI(&(r)->regs) | ||
18 | #define PT_REGS_EBP(r) UPT_EBP(&(r)->regs) | ||
19 | |||
20 | #define PT_REGS_CS(r) UPT_CS(&(r)->regs) | ||
21 | #define PT_REGS_SS(r) UPT_SS(&(r)->regs) | ||
22 | #define PT_REGS_DS(r) UPT_DS(&(r)->regs) | ||
23 | #define PT_REGS_ES(r) UPT_ES(&(r)->regs) | ||
24 | #define PT_REGS_FS(r) UPT_FS(&(r)->regs) | ||
25 | #define PT_REGS_GS(r) UPT_GS(&(r)->regs) | ||
26 | |||
27 | #define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) | ||
28 | |||
29 | #define PT_REGS_ORIG_SYSCALL(r) PT_REGS_EAX(r) | ||
30 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_EAX(r) | ||
31 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | ||
32 | |||
33 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
34 | |||
35 | #endif | ||
36 | |||
37 | /* | ||
38 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
39 | * Emacs will notice this stuff at the end of the file and automatically | ||
40 | * adjust the settings for this buffer only. This must remain at the end | ||
41 | * of the file. | ||
42 | * --------------------------------------------------------------------------- | ||
43 | * Local variables: | ||
44 | * c-file-style: "linux" | ||
45 | * End: | ||
46 | */ | ||
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h new file mode 100644 index 000000000000..c34be39b78b2 --- /dev/null +++ b/include/asm-um/ptrace-x86_64.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_PTRACE_X86_64_H | ||
8 | #define __UM_PTRACE_X86_64_H | ||
9 | |||
10 | #include "linux/compiler.h" | ||
11 | |||
12 | #define signal_fault signal_fault_x86_64 | ||
13 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | ||
14 | #include "asm/ptrace-generic.h" | ||
15 | #undef signal_fault | ||
16 | |||
17 | void signal_fault(struct pt_regs_subarch *regs, void *frame, char *where); | ||
18 | |||
19 | #define FS_BASE (21 * sizeof(unsigned long)) | ||
20 | #define GS_BASE (22 * sizeof(unsigned long)) | ||
21 | #define DS (23 * sizeof(unsigned long)) | ||
22 | #define ES (24 * sizeof(unsigned long)) | ||
23 | #define FS (25 * sizeof(unsigned long)) | ||
24 | #define GS (26 * sizeof(unsigned long)) | ||
25 | |||
26 | #define PT_REGS_RBX(r) UPT_RBX(&(r)->regs) | ||
27 | #define PT_REGS_RCX(r) UPT_RCX(&(r)->regs) | ||
28 | #define PT_REGS_RDX(r) UPT_RDX(&(r)->regs) | ||
29 | #define PT_REGS_RSI(r) UPT_RSI(&(r)->regs) | ||
30 | #define PT_REGS_RDI(r) UPT_RDI(&(r)->regs) | ||
31 | #define PT_REGS_RBP(r) UPT_RBP(&(r)->regs) | ||
32 | #define PT_REGS_RAX(r) UPT_RAX(&(r)->regs) | ||
33 | #define PT_REGS_R8(r) UPT_R8(&(r)->regs) | ||
34 | #define PT_REGS_R9(r) UPT_R9(&(r)->regs) | ||
35 | #define PT_REGS_R10(r) UPT_R10(&(r)->regs) | ||
36 | #define PT_REGS_R11(r) UPT_R11(&(r)->regs) | ||
37 | #define PT_REGS_R12(r) UPT_R12(&(r)->regs) | ||
38 | #define PT_REGS_R13(r) UPT_R13(&(r)->regs) | ||
39 | #define PT_REGS_R14(r) UPT_R14(&(r)->regs) | ||
40 | #define PT_REGS_R15(r) UPT_R15(&(r)->regs) | ||
41 | |||
42 | #define PT_REGS_FS(r) UPT_FS(&(r)->regs) | ||
43 | #define PT_REGS_GS(r) UPT_GS(&(r)->regs) | ||
44 | #define PT_REGS_DS(r) UPT_DS(&(r)->regs) | ||
45 | #define PT_REGS_ES(r) UPT_ES(&(r)->regs) | ||
46 | #define PT_REGS_SS(r) UPT_SS(&(r)->regs) | ||
47 | #define PT_REGS_CS(r) UPT_CS(&(r)->regs) | ||
48 | |||
49 | #define PT_REGS_ORIG_RAX(r) UPT_ORIG_RAX(&(r)->regs) | ||
50 | #define PT_REGS_RIP(r) UPT_IP(&(r)->regs) | ||
51 | #define PT_REGS_RSP(r) UPT_SP(&(r)->regs) | ||
52 | |||
53 | #define PT_REGS_EFLAGS(r) UPT_EFLAGS(&(r)->regs) | ||
54 | |||
55 | /* XXX */ | ||
56 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | ||
57 | #define PT_REGS_ORIG_SYSCALL(r) PT_REGS_RAX(r) | ||
58 | #define PT_REGS_SYSCALL_RET(r) PT_REGS_RAX(r) | ||
59 | |||
60 | #define PT_FIX_EXEC_STACK(sp) do ; while(0) | ||
61 | |||
62 | #define profile_pc(regs) PT_REGS_IP(regs) | ||
63 | |||
64 | #endif | ||
65 | |||
66 | /* | ||
67 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
68 | * Emacs will notice this stuff at the end of the file and automatically | ||
69 | * adjust the settings for this buffer only. This must remain at the end | ||
70 | * of the file. | ||
71 | * --------------------------------------------------------------------------- | ||
72 | * Local variables: | ||
73 | * c-file-style: "linux" | ||
74 | * End: | ||
75 | */ | ||
diff --git a/include/asm-um/resource.h b/include/asm-um/resource.h new file mode 100644 index 000000000000..c9b074001252 --- /dev/null +++ b/include/asm-um/resource.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_RESOURCE_H | ||
2 | #define __UM_RESOURCE_H | ||
3 | |||
4 | #include "asm/arch/resource.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/rwlock.h b/include/asm-um/rwlock.h new file mode 100644 index 000000000000..ff383aafc9fe --- /dev/null +++ b/include/asm-um/rwlock.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_RWLOCK_H | ||
2 | #define __UM_RWLOCK_H | ||
3 | |||
4 | #include "asm/arch/rwlock.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/rwsem.h b/include/asm-um/rwsem.h new file mode 100644 index 000000000000..661c0e54702b --- /dev/null +++ b/include/asm-um/rwsem.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_RWSEM_H__ | ||
2 | #define __UM_RWSEM_H__ | ||
3 | |||
4 | #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96) | ||
5 | #define __builtin_expect(exp,c) (exp) | ||
6 | #endif | ||
7 | |||
8 | #include "asm/arch/rwsem.h" | ||
9 | |||
10 | #endif | ||
diff --git a/include/asm-um/scatterlist.h b/include/asm-um/scatterlist.h new file mode 100644 index 000000000000..e92016aa2079 --- /dev/null +++ b/include/asm-um/scatterlist.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SCATTERLIST_H | ||
2 | #define __UM_SCATTERLIST_H | ||
3 | |||
4 | #include "asm/arch/scatterlist.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/sections.h b/include/asm-um/sections.h new file mode 100644 index 000000000000..6b0231eefea8 --- /dev/null +++ b/include/asm-um/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/include/asm-um/segment.h b/include/asm-um/segment.h new file mode 100644 index 000000000000..55e40301f625 --- /dev/null +++ b/include/asm-um/segment.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_SEGMENT_H | ||
2 | #define __UM_SEGMENT_H | ||
3 | |||
4 | #endif | ||
diff --git a/include/asm-um/semaphore.h b/include/asm-um/semaphore.h new file mode 100644 index 000000000000..ff13c34de421 --- /dev/null +++ b/include/asm-um/semaphore.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SEMAPHORE_H | ||
2 | #define __UM_SEMAPHORE_H | ||
3 | |||
4 | #include "asm/arch/semaphore.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/sembuf.h b/include/asm-um/sembuf.h new file mode 100644 index 000000000000..1ae82c14ff86 --- /dev/null +++ b/include/asm-um/sembuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SEMBUF_H | ||
2 | #define __UM_SEMBUF_H | ||
3 | |||
4 | #include "asm/arch/sembuf.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/serial.h b/include/asm-um/serial.h new file mode 100644 index 000000000000..61ad07cfd2d5 --- /dev/null +++ b/include/asm-um/serial.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SERIAL_H | ||
2 | #define __UM_SERIAL_H | ||
3 | |||
4 | #include "asm/arch/serial.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/setup.h b/include/asm-um/setup.h new file mode 100644 index 000000000000..c85252e803c1 --- /dev/null +++ b/include/asm-um/setup.h | |||
@@ -0,0 +1,9 @@ | |||
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 | #define COMMAND_LINE_SIZE 4096 | ||
8 | |||
9 | #endif /* SETUP_H_INCLUDED */ | ||
diff --git a/include/asm-um/shmbuf.h b/include/asm-um/shmbuf.h new file mode 100644 index 000000000000..9684d4a284a6 --- /dev/null +++ b/include/asm-um/shmbuf.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SHMBUF_H | ||
2 | #define __UM_SHMBUF_H | ||
3 | |||
4 | #include "asm/arch/shmbuf.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/shmparam.h b/include/asm-um/shmparam.h new file mode 100644 index 000000000000..124c00174f6a --- /dev/null +++ b/include/asm-um/shmparam.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SHMPARAM_H | ||
2 | #define __UM_SHMPARAM_H | ||
3 | |||
4 | #include "asm/arch/shmparam.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/sigcontext-generic.h b/include/asm-um/sigcontext-generic.h new file mode 100644 index 000000000000..164587014c61 --- /dev/null +++ b/include/asm-um/sigcontext-generic.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SIGCONTEXT_GENERIC_H | ||
2 | #define __UM_SIGCONTEXT_GENERIC_H | ||
3 | |||
4 | #include "asm/arch/sigcontext.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/sigcontext-i386.h b/include/asm-um/sigcontext-i386.h new file mode 100644 index 000000000000..b88333f488bb --- /dev/null +++ b/include/asm-um/sigcontext-i386.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SIGCONTEXT_I386_H | ||
2 | #define __UM_SIGCONTEXT_I386_H | ||
3 | |||
4 | #include "asm/sigcontext-generic.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/sigcontext-ppc.h b/include/asm-um/sigcontext-ppc.h new file mode 100644 index 000000000000..2467f20eda99 --- /dev/null +++ b/include/asm-um/sigcontext-ppc.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef __UM_SIGCONTEXT_PPC_H | ||
2 | #define __UM_SIGCONTEXT_PPC_H | ||
3 | |||
4 | #define pt_regs sys_pt_regs | ||
5 | |||
6 | #include "asm/sigcontext-generic.h" | ||
7 | |||
8 | #undef pt_regs | ||
9 | |||
10 | #endif | ||
diff --git a/include/asm-um/sigcontext-x86_64.h b/include/asm-um/sigcontext-x86_64.h new file mode 100644 index 000000000000..b600e0b01e48 --- /dev/null +++ b/include/asm-um/sigcontext-x86_64.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* Copyright 2003 PathScale, Inc. | ||
2 | * | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __UM_SIGCONTEXT_X86_64_H | ||
7 | #define __UM_SIGCONTEXT_X86_64_H | ||
8 | |||
9 | #include "asm/sigcontext-generic.h" | ||
10 | |||
11 | #endif | ||
12 | |||
13 | /* | ||
14 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
15 | * Emacs will notice this stuff at the end of the file and automatically | ||
16 | * adjust the settings for this buffer only. This must remain at the end | ||
17 | * of the file. | ||
18 | * --------------------------------------------------------------------------- | ||
19 | * Local variables: | ||
20 | * c-file-style: "linux" | ||
21 | * End: | ||
22 | */ | ||
diff --git a/include/asm-um/siginfo.h b/include/asm-um/siginfo.h new file mode 100644 index 000000000000..bec6124c36d0 --- /dev/null +++ b/include/asm-um/siginfo.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SIGINFO_H | ||
2 | #define __UM_SIGINFO_H | ||
3 | |||
4 | #include "asm/arch/siginfo.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/signal.h b/include/asm-um/signal.h new file mode 100644 index 000000000000..52ed92cbce4c --- /dev/null +++ b/include/asm-um/signal.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_SIGNAL_H | ||
7 | #define __UM_SIGNAL_H | ||
8 | |||
9 | /* Need to kill the do_signal() declaration in the i386 signal.h */ | ||
10 | |||
11 | #define do_signal do_signal_renamed | ||
12 | #include "asm/arch/signal.h" | ||
13 | #undef do_signal | ||
14 | #undef ptrace_signal_deliver | ||
15 | |||
16 | #define ptrace_signal_deliver(regs, cookie) do {} while(0) | ||
17 | |||
18 | #endif | ||
19 | |||
20 | /* | ||
21 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
22 | * Emacs will notice this stuff at the end of the file and automatically | ||
23 | * adjust the settings for this buffer only. This must remain at the end | ||
24 | * of the file. | ||
25 | * --------------------------------------------------------------------------- | ||
26 | * Local variables: | ||
27 | * c-file-style: "linux" | ||
28 | * End: | ||
29 | */ | ||
diff --git a/include/asm-um/smp.h b/include/asm-um/smp.h new file mode 100644 index 000000000000..4412d5d9c26b --- /dev/null +++ b/include/asm-um/smp.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __UM_SMP_H | ||
2 | #define __UM_SMP_H | ||
3 | |||
4 | #ifdef CONFIG_SMP | ||
5 | |||
6 | #include "linux/config.h" | ||
7 | #include "linux/bitops.h" | ||
8 | #include "asm/current.h" | ||
9 | #include "linux/cpumask.h" | ||
10 | |||
11 | #define smp_processor_id() (current_thread->cpu) | ||
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 */ | ||
15 | extern int hard_smp_processor_id(void); | ||
16 | #define NO_PROC_ID -1 | ||
17 | |||
18 | extern int ncpus; | ||
19 | |||
20 | |||
21 | extern inline void smp_cpus_done(unsigned int maxcpus) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | #endif | ||
26 | |||
27 | #endif | ||
diff --git a/include/asm-um/socket.h b/include/asm-um/socket.h new file mode 100644 index 000000000000..67886e42ef04 --- /dev/null +++ b/include/asm-um/socket.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SOCKET_H | ||
2 | #define __UM_SOCKET_H | ||
3 | |||
4 | #include "asm/arch/socket.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/sockios.h b/include/asm-um/sockios.h new file mode 100644 index 000000000000..93ee1c55c4d6 --- /dev/null +++ b/include/asm-um/sockios.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SOCKIOS_H | ||
2 | #define __UM_SOCKIOS_H | ||
3 | |||
4 | #include "asm/arch/sockios.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/spinlock.h b/include/asm-um/spinlock.h new file mode 100644 index 000000000000..f18c82886992 --- /dev/null +++ b/include/asm-um/spinlock.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_SPINLOCK_H | ||
2 | #define __UM_SPINLOCK_H | ||
3 | |||
4 | #include "asm/arch/spinlock.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/stat.h b/include/asm-um/stat.h new file mode 100644 index 000000000000..83ed85ad2539 --- /dev/null +++ b/include/asm-um/stat.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_STAT_H | ||
2 | #define __UM_STAT_H | ||
3 | |||
4 | #include "asm/arch/stat.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/statfs.h b/include/asm-um/statfs.h new file mode 100644 index 000000000000..ba6fb53e7f87 --- /dev/null +++ b/include/asm-um/statfs.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _UM_STATFS_H | ||
2 | #define _UM_STATFS_H | ||
3 | |||
4 | #include "asm/arch/statfs.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/string.h b/include/asm-um/string.h new file mode 100644 index 000000000000..9a0571f6dd61 --- /dev/null +++ b/include/asm-um/string.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __UM_STRING_H | ||
2 | #define __UM_STRING_H | ||
3 | |||
4 | #include "asm/arch/string.h" | ||
5 | #include "asm/archparam.h" | ||
6 | |||
7 | #endif | ||
diff --git a/include/asm-um/suspend.h b/include/asm-um/suspend.h new file mode 100644 index 000000000000..f4e8e007f468 --- /dev/null +++ b/include/asm-um/suspend.h | |||
@@ -0,0 +1,4 @@ | |||
1 | #ifndef __UM_SUSPEND_H | ||
2 | #define __UM_SUSPEND_H | ||
3 | |||
4 | #endif | ||
diff --git a/include/asm-um/system-generic.h b/include/asm-um/system-generic.h new file mode 100644 index 000000000000..5bcfa35e7a22 --- /dev/null +++ b/include/asm-um/system-generic.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef __UM_SYSTEM_GENERIC_H | ||
2 | #define __UM_SYSTEM_GENERIC_H | ||
3 | |||
4 | #include "asm/arch/system.h" | ||
5 | |||
6 | #undef switch_to | ||
7 | #undef local_irq_save | ||
8 | #undef local_irq_restore | ||
9 | #undef local_irq_disable | ||
10 | #undef local_irq_enable | ||
11 | #undef local_save_flags | ||
12 | #undef local_irq_restore | ||
13 | #undef local_irq_enable | ||
14 | #undef local_irq_disable | ||
15 | #undef local_irq_save | ||
16 | #undef irqs_disabled | ||
17 | |||
18 | extern void *switch_to(void *prev, void *next, void *last); | ||
19 | |||
20 | extern int get_signals(void); | ||
21 | extern int set_signals(int enable); | ||
22 | extern int get_signals(void); | ||
23 | extern void block_signals(void); | ||
24 | extern void unblock_signals(void); | ||
25 | |||
26 | #define local_save_flags(flags) do { typecheck(unsigned long, flags); \ | ||
27 | (flags) = get_signals(); } while(0) | ||
28 | #define local_irq_restore(flags) do { typecheck(unsigned long, flags); \ | ||
29 | set_signals(flags); } while(0) | ||
30 | |||
31 | #define local_irq_save(flags) do { local_save_flags(flags); \ | ||
32 | local_irq_disable(); } while(0) | ||
33 | |||
34 | #define local_irq_enable() unblock_signals() | ||
35 | #define local_irq_disable() block_signals() | ||
36 | |||
37 | #define irqs_disabled() \ | ||
38 | ({ \ | ||
39 | unsigned long flags; \ | ||
40 | local_save_flags(flags); \ | ||
41 | (flags == 0); \ | ||
42 | }) | ||
43 | |||
44 | extern void *_switch_to(void *prev, void *next, void *last); | ||
45 | #define switch_to(prev, next, last) prev = _switch_to(prev, next, last) | ||
46 | |||
47 | #endif | ||
diff --git a/include/asm-um/system-i386.h b/include/asm-um/system-i386.h new file mode 100644 index 000000000000..ea8381de3cc9 --- /dev/null +++ b/include/asm-um/system-i386.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __UM_SYSTEM_I386_H | ||
2 | #define __UM_SYSTEM_I386_H | ||
3 | |||
4 | #include "asm/system-generic.h" | ||
5 | |||
6 | #define __HAVE_ARCH_CMPXCHG 1 | ||
7 | |||
8 | #endif | ||
diff --git a/include/asm-um/system-ppc.h b/include/asm-um/system-ppc.h new file mode 100644 index 000000000000..17cde6640bf5 --- /dev/null +++ b/include/asm-um/system-ppc.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef __UM_SYSTEM_PPC_H | ||
2 | #define __UM_SYSTEM_PPC_H | ||
3 | |||
4 | #define _switch_to _ppc_switch_to | ||
5 | |||
6 | #include "asm/arch/system.h" | ||
7 | |||
8 | #undef _switch_to | ||
9 | |||
10 | #include "asm/system-generic.h" | ||
11 | |||
12 | #endif | ||
diff --git a/include/asm-um/system-x86_64.h b/include/asm-um/system-x86_64.h new file mode 100644 index 000000000000..e1b61b580734 --- /dev/null +++ b/include/asm-um/system-x86_64.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __UM_SYSTEM_X86_64_H | ||
8 | #define __UM_SYSTEM_X86_64_H | ||
9 | |||
10 | #include "asm/system-generic.h" | ||
11 | |||
12 | #endif | ||
13 | |||
14 | /* | ||
15 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
16 | * Emacs will notice this stuff at the end of the file and automatically | ||
17 | * adjust the settings for this buffer only. This must remain at the end | ||
18 | * of the file. | ||
19 | * --------------------------------------------------------------------------- | ||
20 | * Local variables: | ||
21 | * c-file-style: "linux" | ||
22 | * End: | ||
23 | */ | ||
diff --git a/include/asm-um/termbits.h b/include/asm-um/termbits.h new file mode 100644 index 000000000000..5739c608a2cb --- /dev/null +++ b/include/asm-um/termbits.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_TERMBITS_H | ||
2 | #define __UM_TERMBITS_H | ||
3 | |||
4 | #include "asm/arch/termbits.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/termios.h b/include/asm-um/termios.h new file mode 100644 index 000000000000..d9f97b303311 --- /dev/null +++ b/include/asm-um/termios.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_TERMIOS_H | ||
2 | #define __UM_TERMIOS_H | ||
3 | |||
4 | #include "asm/arch/termios.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h new file mode 100644 index 000000000000..bffb577bc54e --- /dev/null +++ b/include/asm-um/thread_info.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.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 <linux/config.h> | ||
12 | #include <asm/processor.h> | ||
13 | #include <asm/types.h> | ||
14 | |||
15 | struct 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 | __s32 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 | }; | ||
27 | |||
28 | #define INIT_THREAD_INFO(tsk) \ | ||
29 | { \ | ||
30 | task: &tsk, \ | ||
31 | exec_domain: &default_exec_domain, \ | ||
32 | flags: 0, \ | ||
33 | cpu: 0, \ | ||
34 | preempt_count: 1, \ | ||
35 | addr_limit: KERNEL_DS, \ | ||
36 | restart_block: { \ | ||
37 | fn: do_no_restart_syscall, \ | ||
38 | }, \ | ||
39 | } | ||
40 | |||
41 | #define init_thread_info (init_thread_union.thread_info) | ||
42 | #define init_stack (init_thread_union.stack) | ||
43 | |||
44 | /* how to get the thread information struct from C */ | ||
45 | static inline struct thread_info *current_thread_info(void) | ||
46 | { | ||
47 | struct thread_info *ti; | ||
48 | unsigned long mask = PAGE_SIZE * | ||
49 | (1 << CONFIG_KERNEL_STACK_ORDER) - 1; | ||
50 | ti = (struct thread_info *) (((unsigned long) &ti) & ~mask); | ||
51 | return ti; | ||
52 | } | ||
53 | |||
54 | /* thread information allocation */ | ||
55 | #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE) | ||
56 | #define alloc_thread_info(tsk) \ | ||
57 | ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL)) | ||
58 | #define free_thread_info(ti) kfree(ti) | ||
59 | |||
60 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
61 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
62 | |||
63 | #endif | ||
64 | |||
65 | #define PREEMPT_ACTIVE 0x4000000 | ||
66 | |||
67 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
68 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
69 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
70 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
71 | * TIF_NEED_RESCHED | ||
72 | */ | ||
73 | #define TIF_RESTART_BLOCK 4 | ||
74 | #define TIF_MEMDIE 5 | ||
75 | |||
76 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | ||
77 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | ||
78 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | ||
79 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) | ||
80 | #define _TIF_RESTART_BLOCK (1 << TIF_RESTART_BLOCK) | ||
81 | |||
82 | #endif | ||
83 | |||
84 | /* | ||
85 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
86 | * Emacs will notice this stuff at the end of the file and automatically | ||
87 | * adjust the settings for this buffer only. This must remain at the end | ||
88 | * of the file. | ||
89 | * --------------------------------------------------------------------------- | ||
90 | * Local variables: | ||
91 | * c-file-style: "linux" | ||
92 | * End: | ||
93 | */ | ||
diff --git a/include/asm-um/timex.h b/include/asm-um/timex.h new file mode 100644 index 000000000000..0f4ada08f748 --- /dev/null +++ b/include/asm-um/timex.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef __UM_TIMEX_H | ||
2 | #define __UM_TIMEX_H | ||
3 | |||
4 | typedef unsigned long cycles_t; | ||
5 | |||
6 | static inline cycles_t get_cycles (void) | ||
7 | { | ||
8 | return 0; | ||
9 | } | ||
10 | |||
11 | #define CLOCK_TICK_RATE (HZ) | ||
12 | |||
13 | #endif | ||
diff --git a/include/asm-um/tlb.h b/include/asm-um/tlb.h new file mode 100644 index 000000000000..c640033bc1fd --- /dev/null +++ b/include/asm-um/tlb.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_TLB_H | ||
2 | #define __UM_TLB_H | ||
3 | |||
4 | #include <asm/arch/tlb.h> | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/tlbflush.h b/include/asm-um/tlbflush.h new file mode 100644 index 000000000000..522aa30f7eaa --- /dev/null +++ b/include/asm-um/tlbflush.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.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 | * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables | ||
21 | */ | ||
22 | |||
23 | extern void flush_tlb_all(void); | ||
24 | extern void flush_tlb_mm(struct mm_struct *mm); | ||
25 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | ||
26 | unsigned long end); | ||
27 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr); | ||
28 | extern void flush_tlb_kernel_vm(void); | ||
29 | extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); | ||
30 | extern void __flush_tlb_one(unsigned long addr); | ||
31 | |||
32 | static inline void flush_tlb_pgtables(struct mm_struct *mm, | ||
33 | unsigned long start, unsigned long end) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | #endif | ||
38 | |||
39 | /* | ||
40 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
41 | * Emacs will notice this stuff at the end of the file and automatically | ||
42 | * adjust the settings for this buffer only. This must remain at the end | ||
43 | * of the file. | ||
44 | * --------------------------------------------------------------------------- | ||
45 | * Local variables: | ||
46 | * c-file-style: "linux" | ||
47 | * End: | ||
48 | */ | ||
diff --git a/include/asm-um/topology.h b/include/asm-um/topology.h new file mode 100644 index 000000000000..0905e4f21d42 --- /dev/null +++ b/include/asm-um/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/include/asm-um/types.h b/include/asm-um/types.h new file mode 100644 index 000000000000..816e9590fc73 --- /dev/null +++ b/include/asm-um/types.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_TYPES_H | ||
2 | #define __UM_TYPES_H | ||
3 | |||
4 | #include "asm/arch/types.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/uaccess.h b/include/asm-um/uaccess.h new file mode 100644 index 000000000000..801710d00a40 --- /dev/null +++ b/include/asm-um/uaccess.h | |||
@@ -0,0 +1,102 @@ | |||
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 "linux/sched.h" | ||
10 | |||
11 | #define VERIFY_READ 0 | ||
12 | #define VERIFY_WRITE 1 | ||
13 | |||
14 | /* | ||
15 | * The fs value determines whether argument validity checking should be | ||
16 | * performed or not. If get_fs() == USER_DS, checking is performed, with | ||
17 | * get_fs() == KERNEL_DS, checking is bypassed. | ||
18 | * | ||
19 | * For historical reasons, these macros are grossly misnamed. | ||
20 | */ | ||
21 | |||
22 | #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) | ||
23 | |||
24 | #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) | ||
25 | #define USER_DS MAKE_MM_SEG(TASK_SIZE) | ||
26 | |||
27 | #define get_ds() (KERNEL_DS) | ||
28 | #define get_fs() (current_thread_info()->addr_limit) | ||
29 | #define set_fs(x) (current_thread_info()->addr_limit = (x)) | ||
30 | |||
31 | #define segment_eq(a, b) ((a).seg == (b).seg) | ||
32 | |||
33 | #include "um_uaccess.h" | ||
34 | |||
35 | #define __copy_from_user(to, from, n) copy_from_user(to, from, n) | ||
36 | |||
37 | #define __copy_to_user(to, from, n) copy_to_user(to, from, n) | ||
38 | |||
39 | #define __copy_to_user_inatomic __copy_to_user | ||
40 | #define __copy_from_user_inatomic __copy_from_user | ||
41 | |||
42 | #define __get_user(x, ptr) \ | ||
43 | ({ \ | ||
44 | const __typeof__(ptr) __private_ptr = ptr; \ | ||
45 | __typeof__(*(__private_ptr)) __private_val; \ | ||
46 | int __private_ret = -EFAULT; \ | ||
47 | (x) = 0; \ | ||
48 | if (__copy_from_user(&__private_val, (__private_ptr), \ | ||
49 | sizeof(*(__private_ptr))) == 0) {\ | ||
50 | (x) = (__typeof__(*(__private_ptr))) __private_val; \ | ||
51 | __private_ret = 0; \ | ||
52 | } \ | ||
53 | __private_ret; \ | ||
54 | }) | ||
55 | |||
56 | #define get_user(x, ptr) \ | ||
57 | ({ \ | ||
58 | const __typeof__((*(ptr))) __user *private_ptr = (ptr); \ | ||
59 | (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \ | ||
60 | __get_user(x, private_ptr) : ((x) = 0, -EFAULT)); \ | ||
61 | }) | ||
62 | |||
63 | #define __put_user(x, ptr) \ | ||
64 | ({ \ | ||
65 | __typeof__(ptr) __private_ptr = ptr; \ | ||
66 | __typeof__(*(__private_ptr)) __private_val; \ | ||
67 | int __private_ret = -EFAULT; \ | ||
68 | __private_val = (__typeof__(*(__private_ptr))) (x); \ | ||
69 | if (__copy_to_user((__private_ptr), &__private_val, \ | ||
70 | sizeof(*(__private_ptr))) == 0) { \ | ||
71 | __private_ret = 0; \ | ||
72 | } \ | ||
73 | __private_ret; \ | ||
74 | }) | ||
75 | |||
76 | #define put_user(x, ptr) \ | ||
77 | ({ \ | ||
78 | __typeof__(*(ptr)) __user *private_ptr = (ptr); \ | ||
79 | (access_ok(VERIFY_WRITE, private_ptr, sizeof(*private_ptr)) ? \ | ||
80 | __put_user(x, private_ptr) : -EFAULT); \ | ||
81 | }) | ||
82 | |||
83 | #define strlen_user(str) strnlen_user(str, ~0UL >> 1) | ||
84 | |||
85 | struct exception_table_entry | ||
86 | { | ||
87 | unsigned long insn; | ||
88 | unsigned long fixup; | ||
89 | }; | ||
90 | |||
91 | #endif | ||
92 | |||
93 | /* | ||
94 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
95 | * Emacs will notice this stuff at the end of the file and automatically | ||
96 | * adjust the settings for this buffer only. This must remain at the end | ||
97 | * of the file. | ||
98 | * --------------------------------------------------------------------------- | ||
99 | * Local variables: | ||
100 | * c-file-style: "linux" | ||
101 | * End: | ||
102 | */ | ||
diff --git a/include/asm-um/ucontext.h b/include/asm-um/ucontext.h new file mode 100644 index 000000000000..5c96c0e607f0 --- /dev/null +++ b/include/asm-um/ucontext.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_UM_UCONTEXT_H | ||
2 | #define _ASM_UM_UCONTEXT_H | ||
3 | |||
4 | #include "asm/arch/ucontext.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/unaligned.h b/include/asm-um/unaligned.h new file mode 100644 index 000000000000..1d2497c57274 --- /dev/null +++ b/include/asm-um/unaligned.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_UNALIGNED_H | ||
2 | #define __UM_UNALIGNED_H | ||
3 | |||
4 | #include "asm/arch/unaligned.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h new file mode 100644 index 000000000000..6fdde45cc053 --- /dev/null +++ b/include/asm-um/unistd.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2004 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef _UM_UNISTD_H_ | ||
7 | #define _UM_UNISTD_H_ | ||
8 | |||
9 | #include <linux/syscalls.h> | ||
10 | #include "linux/resource.h" | ||
11 | #include "asm/uaccess.h" | ||
12 | |||
13 | extern int um_execve(const char *file, char *const argv[], char *const env[]); | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | /* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */ | ||
17 | #define __ARCH_WANT_IPC_PARSE_VERSION | ||
18 | #define __ARCH_WANT_OLD_READDIR | ||
19 | #define __ARCH_WANT_SYS_ALARM | ||
20 | #define __ARCH_WANT_SYS_GETHOSTNAME | ||
21 | #define __ARCH_WANT_SYS_PAUSE | ||
22 | #define __ARCH_WANT_SYS_SGETMASK | ||
23 | #define __ARCH_WANT_SYS_SIGNAL | ||
24 | #define __ARCH_WANT_SYS_TIME | ||
25 | #define __ARCH_WANT_SYS_UTIME | ||
26 | #define __ARCH_WANT_SYS_WAITPID | ||
27 | #define __ARCH_WANT_SYS_SOCKETCALL | ||
28 | #define __ARCH_WANT_SYS_FADVISE64 | ||
29 | #define __ARCH_WANT_SYS_GETPGRP | ||
30 | #define __ARCH_WANT_SYS_LLSEEK | ||
31 | #define __ARCH_WANT_SYS_NICE | ||
32 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
33 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
34 | #define __ARCH_WANT_SYS_SIGPENDING | ||
35 | #define __ARCH_WANT_SYS_SIGPROCMASK | ||
36 | #define __ARCH_WANT_SYS_RT_SIGACTION | ||
37 | #endif | ||
38 | |||
39 | #ifdef __KERNEL_SYSCALLS__ | ||
40 | |||
41 | #include <linux/compiler.h> | ||
42 | #include <linux/types.h> | ||
43 | |||
44 | static inline int execve(const char *filename, char *const argv[], | ||
45 | char *const envp[]) | ||
46 | { | ||
47 | mm_segment_t fs; | ||
48 | int ret; | ||
49 | |||
50 | fs = get_fs(); | ||
51 | set_fs(KERNEL_DS); | ||
52 | ret = um_execve(filename, argv, envp); | ||
53 | set_fs(fs); | ||
54 | |||
55 | if (ret >= 0) | ||
56 | return ret; | ||
57 | |||
58 | errno = -(long)ret; | ||
59 | return -1; | ||
60 | } | ||
61 | |||
62 | int sys_execve(char *file, char **argv, char **env); | ||
63 | |||
64 | #endif /* __KERNEL_SYSCALLS__ */ | ||
65 | |||
66 | #undef __KERNEL_SYSCALLS__ | ||
67 | #include "asm/arch/unistd.h" | ||
68 | |||
69 | #endif /* _UM_UNISTD_H_*/ | ||
diff --git a/include/asm-um/user.h b/include/asm-um/user.h new file mode 100644 index 000000000000..aae414ee1f5e --- /dev/null +++ b/include/asm-um/user.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_USER_H | ||
2 | #define __UM_USER_H | ||
3 | |||
4 | #include "asm/arch/user.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/vga.h b/include/asm-um/vga.h new file mode 100644 index 000000000000..903a592b00d0 --- /dev/null +++ b/include/asm-um/vga.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __UM_VGA_H | ||
2 | #define __UM_VGA_H | ||
3 | |||
4 | #include "asm/arch/vga.h" | ||
5 | |||
6 | #endif | ||
diff --git a/include/asm-um/vm-flags-i386.h b/include/asm-um/vm-flags-i386.h new file mode 100644 index 000000000000..e0d24c568dbc --- /dev/null +++ b/include/asm-um/vm-flags-i386.h | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __VM_FLAGS_I386_H | ||
7 | #define __VM_FLAGS_I386_H | ||
8 | |||
9 | #define VM_DATA_DEFAULT_FLAGS \ | ||
10 | (VM_READ | VM_WRITE | \ | ||
11 | ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ | ||
12 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
13 | |||
14 | #endif | ||
diff --git a/include/asm-um/vm-flags-x86_64.h b/include/asm-um/vm-flags-x86_64.h new file mode 100644 index 000000000000..3213edfa7888 --- /dev/null +++ b/include/asm-um/vm-flags-x86_64.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com) | ||
3 | * Copyright 2003 PathScale, Inc. | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #ifndef __VM_FLAGS_X86_64_H | ||
8 | #define __VM_FLAGS_X86_64_H | ||
9 | |||
10 | #define __VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ | ||
11 | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) | ||
12 | #define __VM_STACK_FLAGS (VM_GROWSDOWN | VM_READ | VM_WRITE | \ | ||
13 | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | \ | ||
14 | VM_MAYEXEC) | ||
15 | |||
16 | extern unsigned long vm_stack_flags, vm_stack_flags32; | ||
17 | extern unsigned long vm_data_default_flags, vm_data_default_flags32; | ||
18 | extern unsigned long vm_force_exec32; | ||
19 | |||
20 | #ifdef TIF_IA32 | ||
21 | #define VM_DATA_DEFAULT_FLAGS \ | ||
22 | (test_thread_flag(TIF_IA32) ? vm_data_default_flags32 : \ | ||
23 | vm_data_default_flags) | ||
24 | |||
25 | #define VM_STACK_DEFAULT_FLAGS \ | ||
26 | (test_thread_flag(TIF_IA32) ? vm_stack_flags32 : vm_stack_flags) | ||
27 | #endif | ||
28 | |||
29 | #define VM_DATA_DEFAULT_FLAGS vm_data_default_flags | ||
30 | |||
31 | #define VM_STACK_DEFAULT_FLAGS vm_stack_flags | ||
32 | |||
33 | #endif | ||
diff --git a/include/asm-um/xor.h b/include/asm-um/xor.h new file mode 100644 index 000000000000..a19db3e17241 --- /dev/null +++ b/include/asm-um/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 | ||