aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/frv/kernel/gdb-stub.c12
-rw-r--r--arch/h8300/kernel/syscalls.S78
-rw-r--r--arch/i386/kernel/syscall_table.S3
-rw-r--r--arch/m32r/Kconfig4
-rw-r--r--arch/m32r/mm/mmu.S22
-rw-r--r--arch/powerpc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/swsusp.c4
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c6
-rw-r--r--arch/um/Kconfig3
-rw-r--r--arch/um/defconfig2
-rw-r--r--arch/um/include/common-offsets.h2
-rw-r--r--arch/um/include/kern_util.h3
-rw-r--r--arch/um/include/os.h1
-rw-r--r--arch/um/kernel/dyn.lds.S2
-rw-r--r--arch/um/kernel/init_task.c30
-rw-r--r--arch/um/kernel/irq.c115
-rw-r--r--arch/um/kernel/skas/process.c4
-rw-r--r--arch/um/kernel/tt/exec_kern.c2
-rw-r--r--arch/um/kernel/tt/process_kern.c2
-rw-r--r--arch/um/kernel/um_arch.c2
-rw-r--r--arch/um/kernel/uml.lds.S2
-rw-r--r--arch/um/os-Linux/signal.c50
-rw-r--r--arch/um/os-Linux/skas/process.c13
-rw-r--r--arch/um/os-Linux/sys-i386/signal.c8
-rw-r--r--arch/um/os-Linux/sys-x86_64/signal.c6
-rw-r--r--arch/um/os-Linux/util.c23
-rw-r--r--arch/x86_64/ia32/ia32entry.S3
-rw-r--r--arch/x86_64/kernel/head64.c7
28 files changed, 290 insertions, 121 deletions
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index 9550f37fb62c..1e7a101cbf4c 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -1195,7 +1195,7 @@ static void gdbstub_check_breakpoint(void)
1195/* 1195/*
1196 * 1196 *
1197 */ 1197 */
1198static void __attribute__((unused)) gdbstub_show_regs(void) 1198static void __maybe_unused gdbstub_show_regs(void)
1199{ 1199{
1200 unsigned long *reg; 1200 unsigned long *reg;
1201 int loop; 1201 int loop;
@@ -1223,7 +1223,7 @@ static void __attribute__((unused)) gdbstub_show_regs(void)
1223/* 1223/*
1224 * dump debugging regs 1224 * dump debugging regs
1225 */ 1225 */
1226static void __attribute__((unused)) gdbstub_dump_debugregs(void) 1226static void __maybe_unused gdbstub_dump_debugregs(void)
1227{ 1227{
1228 gdbstub_printk("DCR %08lx ", __debug_status.dcr); 1228 gdbstub_printk("DCR %08lx ", __debug_status.dcr);
1229 gdbstub_printk("BRR %08lx\n", __debug_status.brr); 1229 gdbstub_printk("BRR %08lx\n", __debug_status.brr);
@@ -2079,25 +2079,25 @@ void gdbstub_exit(int status)
2079 * GDB wants to call malloc() and free() to allocate memory for calling kernel 2079 * GDB wants to call malloc() and free() to allocate memory for calling kernel
2080 * functions directly from its command line 2080 * functions directly from its command line
2081 */ 2081 */
2082static void *malloc(size_t size) __attribute__((unused)); 2082static void *malloc(size_t size) __maybe_unused;
2083static void *malloc(size_t size) 2083static void *malloc(size_t size)
2084{ 2084{
2085 return kmalloc(size, GFP_ATOMIC); 2085 return kmalloc(size, GFP_ATOMIC);
2086} 2086}
2087 2087
2088static void free(void *p) __attribute__((unused)); 2088static void free(void *p) __maybe_unused;
2089static void free(void *p) 2089static void free(void *p)
2090{ 2090{
2091 kfree(p); 2091 kfree(p);
2092} 2092}
2093 2093
2094static uint32_t ___get_HSR0(void) __attribute__((unused)); 2094static uint32_t ___get_HSR0(void) __maybe_unused;
2095static uint32_t ___get_HSR0(void) 2095static uint32_t ___get_HSR0(void)
2096{ 2096{
2097 return __get_HSR(0); 2097 return __get_HSR(0);
2098} 2098}
2099 2099
2100static uint32_t ___set_HSR0(uint32_t x) __attribute__((unused)); 2100static uint32_t ___set_HSR0(uint32_t x) __maybe_unused;
2101static uint32_t ___set_HSR0(uint32_t x) 2101static uint32_t ___set_HSR0(uint32_t x)
2102{ 2102{
2103 __set_HSR(0, x); 2103 __set_HSR(0, x);
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index dab98fd99e63..54e21c3f2057 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -31,7 +31,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
31 .long SYMBOL_NAME(sys_mknod) 31 .long SYMBOL_NAME(sys_mknod)
32 .long SYMBOL_NAME(sys_chmod) /* 15 */ 32 .long SYMBOL_NAME(sys_chmod) /* 15 */
33 .long SYMBOL_NAME(sys_chown16) 33 .long SYMBOL_NAME(sys_chown16)
34 .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */ 34 .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */
35 .long SYMBOL_NAME(sys_stat) 35 .long SYMBOL_NAME(sys_stat)
36 .long SYMBOL_NAME(sys_lseek) 36 .long SYMBOL_NAME(sys_lseek)
37 .long SYMBOL_NAME(sys_getpid) /* 20 */ 37 .long SYMBOL_NAME(sys_getpid) /* 20 */
@@ -45,11 +45,11 @@ SYMBOL_NAME_LABEL(sys_call_table)
45 .long SYMBOL_NAME(sys_fstat) 45 .long SYMBOL_NAME(sys_fstat)
46 .long SYMBOL_NAME(sys_pause) 46 .long SYMBOL_NAME(sys_pause)
47 .long SYMBOL_NAME(sys_utime) /* 30 */ 47 .long SYMBOL_NAME(sys_utime) /* 30 */
48 .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */ 48 .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */
49 .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */ 49 .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */
50 .long SYMBOL_NAME(sys_access) 50 .long SYMBOL_NAME(sys_access)
51 .long SYMBOL_NAME(sys_nice) 51 .long SYMBOL_NAME(sys_nice)
52 .long SYMBOL_NAME(sys_ni_syscall) /* 35 */ /* old ftime syscall holder */ 52 .long SYMBOL_NAME(sys_ni_syscall) /* 35 old ftime syscall holder */
53 .long SYMBOL_NAME(sys_sync) 53 .long SYMBOL_NAME(sys_sync)
54 .long SYMBOL_NAME(sys_kill) 54 .long SYMBOL_NAME(sys_kill)
55 .long SYMBOL_NAME(sys_rename) 55 .long SYMBOL_NAME(sys_rename)
@@ -58,7 +58,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
58 .long SYMBOL_NAME(sys_dup) 58 .long SYMBOL_NAME(sys_dup)
59 .long SYMBOL_NAME(sys_pipe) 59 .long SYMBOL_NAME(sys_pipe)
60 .long SYMBOL_NAME(sys_times) 60 .long SYMBOL_NAME(sys_times)
61 .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */ 61 .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */
62 .long SYMBOL_NAME(sys_brk) /* 45 */ 62 .long SYMBOL_NAME(sys_brk) /* 45 */
63 .long SYMBOL_NAME(sys_setgid16) 63 .long SYMBOL_NAME(sys_setgid16)
64 .long SYMBOL_NAME(sys_getgid16) 64 .long SYMBOL_NAME(sys_getgid16)
@@ -66,13 +66,13 @@ SYMBOL_NAME_LABEL(sys_call_table)
66 .long SYMBOL_NAME(sys_geteuid16) 66 .long SYMBOL_NAME(sys_geteuid16)
67 .long SYMBOL_NAME(sys_getegid16) /* 50 */ 67 .long SYMBOL_NAME(sys_getegid16) /* 50 */
68 .long SYMBOL_NAME(sys_acct) 68 .long SYMBOL_NAME(sys_acct)
69 .long SYMBOL_NAME(sys_umount) /* recycled never used phys() */ 69 .long SYMBOL_NAME(sys_umount) /* recycled never used phys() */
70 .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ 70 .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */
71 .long SYMBOL_NAME(sys_ioctl) 71 .long SYMBOL_NAME(sys_ioctl)
72 .long SYMBOL_NAME(sys_fcntl) /* 55 */ 72 .long SYMBOL_NAME(sys_fcntl) /* 55 */
73 .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */ 73 .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */
74 .long SYMBOL_NAME(sys_setpgid) 74 .long SYMBOL_NAME(sys_setpgid)
75 .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */ 75 .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */
76 .long SYMBOL_NAME(sys_ni_syscall) 76 .long SYMBOL_NAME(sys_ni_syscall)
77 .long SYMBOL_NAME(sys_umask) /* 60 */ 77 .long SYMBOL_NAME(sys_umask) /* 60 */
78 .long SYMBOL_NAME(sys_chroot) 78 .long SYMBOL_NAME(sys_chroot)
@@ -112,7 +112,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
112 .long SYMBOL_NAME(sys_fchown16) /* 95 */ 112 .long SYMBOL_NAME(sys_fchown16) /* 95 */
113 .long SYMBOL_NAME(sys_getpriority) 113 .long SYMBOL_NAME(sys_getpriority)
114 .long SYMBOL_NAME(sys_setpriority) 114 .long SYMBOL_NAME(sys_setpriority)
115 .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */ 115 .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */
116 .long SYMBOL_NAME(sys_statfs) 116 .long SYMBOL_NAME(sys_statfs)
117 .long SYMBOL_NAME(sys_fstatfs) /* 100 */ 117 .long SYMBOL_NAME(sys_fstatfs) /* 100 */
118 .long SYMBOL_NAME(sys_ni_syscall) /* ioperm for i386 */ 118 .long SYMBOL_NAME(sys_ni_syscall) /* ioperm for i386 */
@@ -202,8 +202,8 @@ SYMBOL_NAME_LABEL(sys_call_table)
202 .long SYMBOL_NAME(sys_capset) /* 185 */ 202 .long SYMBOL_NAME(sys_capset) /* 185 */
203 .long SYMBOL_NAME(sys_sigaltstack) 203 .long SYMBOL_NAME(sys_sigaltstack)
204 .long SYMBOL_NAME(sys_sendfile) 204 .long SYMBOL_NAME(sys_sendfile)
205 .long SYMBOL_NAME(sys_ni_syscall) /* streams1 */ 205 .long SYMBOL_NAME(sys_ni_syscall) /* streams1 */
206 .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */ 206 .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */
207 .long SYMBOL_NAME(sys_vfork) /* 190 */ 207 .long SYMBOL_NAME(sys_vfork) /* 190 */
208 .long SYMBOL_NAME(sys_getrlimit) 208 .long SYMBOL_NAME(sys_getrlimit)
209 .long SYMBOL_NAME(sys_mmap2) 209 .long SYMBOL_NAME(sys_mmap2)
@@ -236,10 +236,10 @@ SYMBOL_NAME_LABEL(sys_call_table)
236 .long SYMBOL_NAME(sys_ni_syscall) 236 .long SYMBOL_NAME(sys_ni_syscall)
237 .long SYMBOL_NAME(sys_getdents64) /* 220 */ 237 .long SYMBOL_NAME(sys_getdents64) /* 220 */
238 .long SYMBOL_NAME(sys_fcntl64) 238 .long SYMBOL_NAME(sys_fcntl64)
239 .long SYMBOL_NAME(sys_ni_syscall) /* reserved for TUX */ 239 .long SYMBOL_NAME(sys_ni_syscall) /* reserved TUX */
240 .long SYMBOL_NAME(sys_ni_syscall) 240 .long SYMBOL_NAME(sys_ni_syscall) /* reserved Security */
241 .long SYMBOL_NAME(sys_gettid) 241 .long SYMBOL_NAME(sys_gettid)
242 .long SYMBOL_NAME(sys_ni_syscall) /* 225 */ /* sys_readahead */ 242 .long SYMBOL_NAME(sys_readahead) /* 225 */
243 .long SYMBOL_NAME(sys_setxattr) 243 .long SYMBOL_NAME(sys_setxattr)
244 .long SYMBOL_NAME(sys_lsetxattr) 244 .long SYMBOL_NAME(sys_lsetxattr)
245 .long SYMBOL_NAME(sys_fsetxattr) 245 .long SYMBOL_NAME(sys_fsetxattr)
@@ -257,8 +257,8 @@ SYMBOL_NAME_LABEL(sys_call_table)
257 .long SYMBOL_NAME(sys_futex) /* 240 */ 257 .long SYMBOL_NAME(sys_futex) /* 240 */
258 .long SYMBOL_NAME(sys_sched_setaffinity) 258 .long SYMBOL_NAME(sys_sched_setaffinity)
259 .long SYMBOL_NAME(sys_sched_getaffinity) 259 .long SYMBOL_NAME(sys_sched_getaffinity)
260 .long SYMBOL_NAME(sys_ni_syscall) /* sys_set_thread_area */ 260 .long SYMBOL_NAME(sys_ni_syscall)
261 .long SYMBOL_NAME(sys_ni_syscall) /* sys_get_thread_area */ 261 .long SYMBOL_NAME(sys_ni_syscall)
262 .long SYMBOL_NAME(sys_io_setup) /* 245 */ 262 .long SYMBOL_NAME(sys_io_setup) /* 245 */
263 .long SYMBOL_NAME(sys_io_destroy) 263 .long SYMBOL_NAME(sys_io_destroy)
264 .long SYMBOL_NAME(sys_io_getevents) 264 .long SYMBOL_NAME(sys_io_getevents)
@@ -288,8 +288,8 @@ SYMBOL_NAME_LABEL(sys_call_table)
288 .long SYMBOL_NAME(sys_utimes) 288 .long SYMBOL_NAME(sys_utimes)
289 .long SYMBOL_NAME(sys_fadvise64_64) 289 .long SYMBOL_NAME(sys_fadvise64_64)
290 .long SYMBOL_NAME(sys_ni_syscall) /* sys_vserver */ 290 .long SYMBOL_NAME(sys_ni_syscall) /* sys_vserver */
291 .long SYMBOL_NAME(sys_mbind) 291 .long SYMBOL_NAME(sys_ni_syscall)
292 .long SYMBOL_NAME(sys_get_mempolicy) 292 .long SYMBOL_NAME(sys_get_mempolicy) /* 275 */
293 .long SYMBOL_NAME(sys_set_mempolicy) 293 .long SYMBOL_NAME(sys_set_mempolicy)
294 .long SYMBOL_NAME(sys_mq_open) 294 .long SYMBOL_NAME(sys_mq_open)
295 .long SYMBOL_NAME(sys_mq_unlink) 295 .long SYMBOL_NAME(sys_mq_unlink)
@@ -297,16 +297,42 @@ SYMBOL_NAME_LABEL(sys_call_table)
297 .long SYMBOL_NAME(sys_mq_timedreceive) /* 280 */ 297 .long SYMBOL_NAME(sys_mq_timedreceive) /* 280 */
298 .long SYMBOL_NAME(sys_mq_notify) 298 .long SYMBOL_NAME(sys_mq_notify)
299 .long SYMBOL_NAME(sys_mq_getsetattr) 299 .long SYMBOL_NAME(sys_mq_getsetattr)
300 .long SYMBOL_NAME(sys_ni_syscall) /* reserved for kexec */
301 .long SYMBOL_NAME(sys_waitid) 300 .long SYMBOL_NAME(sys_waitid)
302 .long SYMBOL_NAME(sys_ni_syscall) /* 285 */ /* available */ 301 .long SYMBOL_NAME(sys_ni_syscall) /* sys_kexec_load */
303 .long SYMBOL_NAME(sys_add_key) 302 .long SYMBOL_NAME(sys_add_key) /* 285 */
304 .long SYMBOL_NAME(sys_request_key) 303 .long SYMBOL_NAME(sys_request_key)
305 .long SYMBOL_NAME(sys_keyctl) 304 .long SYMBOL_NAME(sys_keyctl)
306 305 .long SYMBOL_NAME(sys_ioprio_set)
307 .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 306 .long SYMBOL_NAME(sys_ioprio_get) /* 290 */
308 .long SYMBOL_NAME(sys_ni_syscall) 307 .long SYMBOL_NAME(sys_inotify_init)
309 .endr 308 .long SYMBOL_NAME(sys_inotify_add_watch)
309 .long SYMBOL_NAME(sys_inotify_rm_watch)
310 .long SYMBOL_NAME(sys_migrate_pages)
311 .long SYMBOL_NAME(sys_openat) /* 295 */
312 .long SYMBOL_NAME(sys_mkdirat)
313 .long SYMBOL_NAME(sys_mknodat)
314 .long SYMBOL_NAME(sys_fchownat)
315 .long SYMBOL_NAME(sys_futimesat)
316 .long SYMBOL_NAME(sys_fstatat64) /* 300 */
317 .long SYMBOL_NAME(sys_unlinkat)
318 .long SYMBOL_NAME(sys_renameat)
319 .long SYMBOL_NAME(sys_linkat)
320 .long SYMBOL_NAME(sys_symlinkat)
321 .long SYMBOL_NAME(sys_readlinkat) /* 305 */
322 .long SYMBOL_NAME(sys_fchmodat)
323 .long SYMBOL_NAME(sys_faccessat)
324 .long SYMBOL_NAME(sys_ni_syscall) /* sys_pselect6 */
325 .long SYMBOL_NAME(sys_ni_syscall) /* sys_ppoll */
326 .long SYMBOL_NAME(sys_unshare) /* 310 */
327 .long SYMBOL_NAME(sys_set_robust_list)
328 .long SYMBOL_NAME(sys_get_robust_list)
329 .long SYMBOL_NAME(sys_splice)
330 .long SYMBOL_NAME(sys_sync_file_range)
331 .long SYMBOL_NAME(sys_tee) /* 315 */
332 .long SYMBOL_NAME(sys_vmsplice)
333 .long SYMBOL_NAME(sys_ni_syscall) /* sys_move_pages */
334 .long SYMBOL_NAME(sys_getcpu)
335 .long SYMBOL_NAME(sys_ni_syscall) /* sys_epoll_pwait */
310 336
311 .macro call_sp addr 337 .macro call_sp addr
312 mov.l #SYMBOL_NAME(\addr),er6 338 mov.l #SYMBOL_NAME(\addr),er6
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 0772678ceecf..bf6adce52267 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -320,3 +320,6 @@ ENTRY(sys_call_table)
320 .long sys_getcpu 320 .long sys_getcpu
321 .long sys_epoll_pwait 321 .long sys_epoll_pwait
322 .long sys_utimensat /* 320 */ 322 .long sys_utimensat /* 320 */
323 .long sys_signalfd
324 .long sys_timerfd
325 .long sys_eventfd
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 9740d6b8ae11..c3bb8a755b00 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -241,6 +241,10 @@ config GENERIC_CALIBRATE_DELAY
241 bool 241 bool
242 default y 242 default y
243 243
244config SCHED_NO_NO_OMIT_FRAME_POINTER
245 bool
246 default y
247
244config PREEMPT 248config PREEMPT
245 bool "Preemptible Kernel" 249 bool "Preemptible Kernel"
246 help 250 help
diff --git a/arch/m32r/mm/mmu.S b/arch/m32r/mm/mmu.S
index 8bb74b10dca7..49a6d16a3d58 100644
--- a/arch/m32r/mm/mmu.S
+++ b/arch/m32r/mm/mmu.S
@@ -163,7 +163,8 @@ ENTRY(tme_handler)
163 163
164 ; pte_data = (unsigned long)pte_val(*pte); 164 ; pte_data = (unsigned long)pte_val(*pte);
165 ld r2, @r3 ; r2: pte data 165 ld r2, @r3 ; r2: pte data
166 or3 r2, r2, #2 ; _PAGE_PRESENT(=2) 166 and3 r3, r2, #2 ; _PAGE_PRESENT(=2) check
167 beqz r3, 3f
167 168
168 .fillinsn 169 .fillinsn
1695: 1705:
@@ -264,11 +265,8 @@ ENTRY(tme_handler)
264; 265;
265 and3 r1, r1, #0xeff 266 and3 r1, r1, #0xeff
266 ldi r4, #611 ; _KERNPG_TABLE(=611) 267 ldi r4, #611 ; _KERNPG_TABLE(=611)
267 beq r1, r4, 4f ; !pmd_bad(*pmd) ? 268 bne r1, r4, 3f ; !pmd_bad(*pmd) ?
268 .fillinsn 269
2693:
270 ldi r1, #0 ; r1: pte_data = 0
271 bra 5f
272 .fillinsn 270 .fillinsn
2734: 2714:
274 ; pte = pte_offset(pmd, address); 272 ; pte = pte_offset(pmd, address);
@@ -282,8 +280,10 @@ ENTRY(tme_handler)
282 add r4, r3 ; r4: pte 280 add r4, r3 ; r4: pte
283 ; pte_data = (unsigned long)pte_val(*pte); 281 ; pte_data = (unsigned long)pte_val(*pte);
284 ld r1, @r4 ; r1: pte_data 282 ld r1, @r4 ; r1: pte_data
285 .fillinsn 283 and3 r3, r1, #2 ; _PAGE_PRESENT(=2) check
284 beqz r3, 3f
286 285
286 .fillinsn
287;; set tlb 287;; set tlb
288; r0: address, r1: pte_data, r2: entry 288; r0: address, r1: pte_data, r2: entry
289; r3,r4: (free) 289; r3,r4: (free)
@@ -295,8 +295,7 @@ ENTRY(tme_handler)
295 and3 r4, r4, #(MMU_CONTEXT_ASID_MASK) 295 and3 r4, r4, #(MMU_CONTEXT_ASID_MASK)
296 or r3, r4 296 or r3, r4
297 st r3, @r2 297 st r3, @r2
298 or3 r4, r1, #2 ; _PAGE_PRESENT(=2) 298 st r1, @(4,r2) ; set_tlb_data(entry, pte_data);
299 st r4, @(4,r2) ; set_tlb_data(entry, pte_data);
300 299
301 ld r4, @sp+ 300 ld r4, @sp+
302 ld r3, @sp+ 301 ld r3, @sp+
@@ -306,6 +305,11 @@ ENTRY(tme_handler)
306 ld sp, @sp+ 305 ld sp, @sp+
307 rte 306 rte
308 307
308 .fillinsn
3093:
310 ldi r1, #2 ; r1: pte_data = 0 | _PAGE_PRESENT(=2)
311 bra 5b
312
309#else 313#else
310#error unknown isa configuration 314#error unknown isa configuration
311#endif 315#endif
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 9ed4931af164..068377a2a8dc 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -173,7 +173,7 @@ void local_irq_restore(unsigned long en)
173 lv1_get_version_info(&tmp); 173 lv1_get_version_info(&tmp);
174 } 174 }
175 175
176 hard_irq_enable(); 176 __hard_irq_enable();
177} 177}
178#endif /* CONFIG_PPC64 */ 178#endif /* CONFIG_PPC64 */
179 179
diff --git a/arch/powerpc/kernel/swsusp.c b/arch/powerpc/kernel/swsusp.c
index 064a7ba4f02c..77b7b34b5955 100644
--- a/arch/powerpc/kernel/swsusp.c
+++ b/arch/powerpc/kernel/swsusp.c
@@ -36,8 +36,4 @@ void restore_processor_state(void)
36#ifdef CONFIG_PPC32 36#ifdef CONFIG_PPC32
37 set_context(current->active_mm->context.id, current->active_mm->pgd); 37 set_context(current->active_mm->context.id, current->active_mm->pgd);
38#endif 38#endif
39
40#ifdef CONFIG_PPC64
41 hard_irq_enable();
42#endif
43} 39}
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 8c20f0fb8651..812bf563ed65 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -43,12 +43,10 @@ static void cbe_power_save(void)
43 unsigned long ctrl, thread_switch_control; 43 unsigned long ctrl, thread_switch_control;
44 44
45 /* 45 /*
46 * We need to hard disable interrupts, but we also need to mark them 46 * We need to hard disable interrupts, the local_irq_enable() done by
47 * hard disabled in the PACA so that the local_irq_enable() done by 47 * our caller upon return will hard re-enable.
48 * our caller upon return propertly hard enables.
49 */ 48 */
50 hard_irq_disable(); 49 hard_irq_disable();
51 get_paca()->hard_enabled = 0;
52 50
53 ctrl = mfspr(SPRN_CTRLF); 51 ctrl = mfspr(SPRN_CTRLF);
54 52
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index b9c0f307a8fa..c504312219b4 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -277,7 +277,8 @@ config HIGHMEM
277 277
278config KERNEL_STACK_ORDER 278config KERNEL_STACK_ORDER
279 int "Kernel stack size order" 279 int "Kernel stack size order"
280 default 2 280 default 1 if 64BIT
281 default 0 if !64BIT
281 help 282 help
282 This option determines the size of UML kernel stacks. They will 283 This option determines the size of UML kernel stacks. They will
283 be 1 << order pages. The default is OK unless you're running Valgrind 284 be 1 << order pages. The default is OK unless you're running Valgrind
diff --git a/arch/um/defconfig b/arch/um/defconfig
index f938fa822146..a54d0efecae1 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -86,7 +86,7 @@ CONFIG_MCONSOLE=y
86# CONFIG_MAGIC_SYSRQ is not set 86# CONFIG_MAGIC_SYSRQ is not set
87CONFIG_NEST_LEVEL=0 87CONFIG_NEST_LEVEL=0
88# CONFIG_HIGHMEM is not set 88# CONFIG_HIGHMEM is not set
89CONFIG_KERNEL_STACK_ORDER=2 89CONFIG_KERNEL_STACK_ORDER=0
90CONFIG_UML_REAL_TIME_CLOCK=y 90CONFIG_UML_REAL_TIME_CLOCK=y
91 91
92# 92#
diff --git a/arch/um/include/common-offsets.h b/arch/um/include/common-offsets.h
index 5593a8027083..541f4a8ca512 100644
--- a/arch/um/include/common-offsets.h
+++ b/arch/um/include/common-offsets.h
@@ -28,3 +28,5 @@ DEFINE(UM_NR_CPUS, NR_CPUS);
28 28
29/* For crypto assembler code. */ 29/* For crypto assembler code. */
30DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); 30DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
31
32DEFINE(UM_THREAD_SIZE, THREAD_SIZE);
diff --git a/arch/um/include/kern_util.h b/arch/um/include/kern_util.h
index 50a49691e0e6..8d7f7c1cb9c6 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -117,4 +117,7 @@ extern void sigio_handler(int sig, union uml_pt_regs *regs);
117 117
118extern void copy_sc(union uml_pt_regs *regs, void *from); 118extern void copy_sc(union uml_pt_regs *regs, void *from);
119 119
120unsigned long to_irq_stack(int sig, unsigned long *mask_out);
121unsigned long from_irq_stack(int nested);
122
120#endif 123#endif
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 688d181b5f8a..4d9fb26387d5 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -272,7 +272,6 @@ extern void do_longjmp(void *p, int val);
272 272
273/* util.c */ 273/* util.c */
274extern void stack_protections(unsigned long address); 274extern void stack_protections(unsigned long address);
275extern void task_protections(unsigned long address);
276extern int raw(int fd); 275extern int raw(int fd);
277extern void setup_machinename(char *machine_out); 276extern void setup_machinename(char *machine_out);
278extern void setup_hostinfo(char *buf, int len); 277extern void setup_hostinfo(char *buf, int len);
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index e36f92b463ce..87a4e4427d8d 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -97,6 +97,8 @@ SECTIONS
97 .data : { 97 .data : {
98 . = ALIGN(KERNEL_STACK_SIZE); /* init_task */ 98 . = ALIGN(KERNEL_STACK_SIZE); /* init_task */
99 *(.data.init_task) 99 *(.data.init_task)
100 . = ALIGN(KERNEL_STACK_SIZE);
101 *(.data.init_irqstack)
100 *(.data .data.* .gnu.linkonce.d.*) 102 *(.data .data.* .gnu.linkonce.d.*)
101 SORT(CONSTRUCTORS) 103 SORT(CONSTRUCTORS)
102 } 104 }
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index cda91aa8e703..d4f1d1ab252b 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,intel.linux}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -33,28 +33,20 @@ EXPORT_SYMBOL(init_task);
33/* 33/*
34 * Initial thread structure. 34 * Initial thread structure.
35 * 35 *
36 * We need to make sure that this is 16384-byte aligned due to the 36 * We need to make sure that this is aligned due to the
37 * way process stacks are handled. This is done by having a special 37 * way process stacks are handled. This is done by having a special
38 * "init_task" linker map entry.. 38 * "init_task" linker map entry..
39 */ 39 */
40 40
41union thread_union init_thread_union 41union thread_union init_thread_union
42__attribute__((__section__(".data.init_task"))) = 42 __attribute__((__section__(".data.init_task"))) =
43{ INIT_THREAD_INFO(init_task) }; 43 { INIT_THREAD_INFO(init_task) };
44
45union thread_union cpu0_irqstack
46 __attribute__((__section__(".data.init_irqstack"))) =
47 { INIT_THREAD_INFO(init_task) };
44 48
45void unprotect_stack(unsigned long stack) 49void unprotect_stack(unsigned long stack)
46{ 50{
47 os_protect_memory((void *) stack, (1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE, 51 os_protect_memory((void *) stack, THREAD_SIZE, 1, 1, 0);
48 1, 1, 0);
49} 52}
50
51/*
52 * Overrides for Emacs so that we follow Linus's tabbing style.
53 * Emacs will notice this stuff at the end of the file and automatically
54 * adjust the settings for this buffer only. This must remain at the end
55 * of the file.
56 * ---------------------------------------------------------------------------
57 * Local variables:
58 * c-file-style: "linux"
59 * End:
60 */
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 8f2ed3690315..dba04d88b432 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c: 4 * Derived (i.e. mostly copied) from arch/i386/kernel/irq.c:
@@ -32,6 +32,7 @@
32#include "sigio.h" 32#include "sigio.h"
33#include "um_malloc.h" 33#include "um_malloc.h"
34#include "misc_constants.h" 34#include "misc_constants.h"
35#include "as-layout.h"
35 36
36/* 37/*
37 * Generic, controller-independent functions: 38 * Generic, controller-independent functions:
@@ -53,7 +54,7 @@ int show_interrupts(struct seq_file *p, void *v)
53 if (i < NR_IRQS) { 54 if (i < NR_IRQS) {
54 spin_lock_irqsave(&irq_desc[i].lock, flags); 55 spin_lock_irqsave(&irq_desc[i].lock, flags);
55 action = irq_desc[i].action; 56 action = irq_desc[i].action;
56 if (!action) 57 if (!action)
57 goto skip; 58 goto skip;
58 seq_printf(p, "%3d: ",i); 59 seq_printf(p, "%3d: ",i);
59#ifndef CONFIG_SMP 60#ifndef CONFIG_SMP
@@ -468,3 +469,113 @@ int init_aio_irq(int irq, char *name, irq_handler_t handler)
468 out: 469 out:
469 return err; 470 return err;
470} 471}
472
473/*
474 * IRQ stack entry and exit:
475 *
476 * Unlike i386, UML doesn't receive IRQs on the normal kernel stack
477 * and switch over to the IRQ stack after some preparation. We use
478 * sigaltstack to receive signals on a separate stack from the start.
479 * These two functions make sure the rest of the kernel won't be too
480 * upset by being on a different stack. The IRQ stack has a
481 * thread_info structure at the bottom so that current et al continue
482 * to work.
483 *
484 * to_irq_stack copies the current task's thread_info to the IRQ stack
485 * thread_info and sets the tasks's stack to point to the IRQ stack.
486 *
487 * from_irq_stack copies the thread_info struct back (flags may have
488 * been modified) and resets the task's stack pointer.
489 *
490 * Tricky bits -
491 *
492 * What happens when two signals race each other? UML doesn't block
493 * signals with sigprocmask, SA_DEFER, or sa_mask, so a second signal
494 * could arrive while a previous one is still setting up the
495 * thread_info.
496 *
497 * There are three cases -
498 * The first interrupt on the stack - sets up the thread_info and
499 * handles the interrupt
500 * A nested interrupt interrupting the copying of the thread_info -
501 * can't handle the interrupt, as the stack is in an unknown state
502 * A nested interrupt not interrupting the copying of the
503 * thread_info - doesn't do any setup, just handles the interrupt
504 *
505 * The first job is to figure out whether we interrupted stack setup.
506 * This is done by xchging the signal mask with thread_info->pending.
507 * If the value that comes back is zero, then there is no setup in
508 * progress, and the interrupt can be handled. If the value is
509 * non-zero, then there is stack setup in progress. In order to have
510 * the interrupt handled, we leave our signal in the mask, and it will
511 * be handled by the upper handler after it has set up the stack.
512 *
513 * Next is to figure out whether we are the outer handler or a nested
514 * one. As part of setting up the stack, thread_info->real_thread is
515 * set to non-NULL (and is reset to NULL on exit). This is the
516 * nesting indicator. If it is non-NULL, then the stack is already
517 * set up and the handler can run.
518 */
519
520static unsigned long pending_mask;
521
522unsigned long to_irq_stack(int sig, unsigned long *mask_out)
523{
524 struct thread_info *ti;
525 unsigned long mask, old;
526 int nested;
527
528 mask = xchg(&pending_mask, 1 << sig);
529 if(mask != 0){
530 /* If any interrupts come in at this point, we want to
531 * make sure that their bits aren't lost by our
532 * putting our bit in. So, this loop accumulates bits
533 * until xchg returns the same value that we put in.
534 * When that happens, there were no new interrupts,
535 * and pending_mask contains a bit for each interrupt
536 * that came in.
537 */
538 old = 1 << sig;
539 do {
540 old |= mask;
541 mask = xchg(&pending_mask, old);
542 } while(mask != old);
543 return 1;
544 }
545
546 ti = current_thread_info();
547 nested = (ti->real_thread != NULL);
548 if(!nested){
549 struct task_struct *task;
550 struct thread_info *tti;
551
552 task = cpu_tasks[ti->cpu].task;
553 tti = task_thread_info(task);
554 *ti = *tti;
555 ti->real_thread = tti;
556 task->stack = ti;
557 }
558
559 mask = xchg(&pending_mask, 0);
560 *mask_out |= mask | nested;
561 return 0;
562}
563
564unsigned long from_irq_stack(int nested)
565{
566 struct thread_info *ti, *to;
567 unsigned long mask;
568
569 ti = current_thread_info();
570
571 pending_mask = 1;
572
573 to = ti->real_thread;
574 current->stack = to;
575 ti->real_thread = NULL;
576 *to = *ti;
577
578 mask = xchg(&pending_mask, 0);
579 return mask & ~1;
580}
581
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index a96ae1a0610e..2a69a7ce5792 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -163,8 +163,12 @@ static int start_kernel_proc(void *unused)
163 163
164extern int userspace_pid[]; 164extern int userspace_pid[];
165 165
166extern char cpu0_irqstack[];
167
166int start_uml_skas(void) 168int start_uml_skas(void)
167{ 169{
170 stack_protections((unsigned long) &cpu0_irqstack);
171 set_sigstack(cpu0_irqstack, THREAD_SIZE);
168 if(proc_mm) 172 if(proc_mm)
169 userspace_pid[0] = start_userspace(0); 173 userspace_pid[0] = start_userspace(0);
170 174
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c
index 98e21743e604..40126cb51801 100644
--- a/arch/um/kernel/tt/exec_kern.c
+++ b/arch/um/kernel/tt/exec_kern.c
@@ -57,7 +57,7 @@ void flush_thread_tt(void)
57 enable_timer(); 57 enable_timer();
58 free_page(stack); 58 free_page(stack);
59 protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1); 59 protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 1, 0, 1);
60 task_protections((unsigned long) current_thread); 60 stack_protections((unsigned long) current_thread);
61 force_flush_all(); 61 force_flush_all();
62 unblock_signals(); 62 unblock_signals();
63} 63}
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c
index c631303cb800..74347adf81bf 100644
--- a/arch/um/kernel/tt/process_kern.c
+++ b/arch/um/kernel/tt/process_kern.c
@@ -209,7 +209,7 @@ void finish_fork_handler(int sig)
209 if(current->mm != current->parent->mm) 209 if(current->mm != current->parent->mm)
210 protect_memory(uml_reserved, high_physmem - uml_reserved, 1, 210 protect_memory(uml_reserved, high_physmem - uml_reserved, 1,
211 1, 0, 1); 211 1, 0, 1);
212 task_protections((unsigned long) current_thread); 212 stack_protections((unsigned long) current_thread);
213 213
214 free_page(current->thread.temp_stack); 214 free_page(current->thread.temp_stack);
215 local_irq_disable(); 215 local_irq_disable();
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 1cf954a47fd7..ecc458fe51b9 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -459,7 +459,7 @@ int __init linux_main(int argc, char **argv)
459 459
460 uml_postsetup(); 460 uml_postsetup();
461 461
462 task_protections((unsigned long) &init_thread_info); 462 stack_protections((unsigned long) &init_thread_info);
463 os_flush_stdout(); 463 os_flush_stdout();
464 464
465 return CHOOSE_MODE(start_uml_tt(), start_uml_skas()); 465 return CHOOSE_MODE(start_uml_tt(), start_uml_skas());
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index f6301274cf3c..bc59f97e34d0 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -59,6 +59,8 @@ SECTIONS
59 { 59 {
60 . = ALIGN(KERNEL_STACK_SIZE); /* init_task */ 60 . = ALIGN(KERNEL_STACK_SIZE); /* init_task */
61 *(.data.init_task) 61 *(.data.init_task)
62 . = ALIGN(KERNEL_STACK_SIZE);
63 *(.data.init_irqstack)
62 *(.data) 64 *(.data)
63 *(.gnu.linkonce.d*) 65 *(.gnu.linkonce.d*)
64 CONSTRUCTORS 66 CONSTRUCTORS
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 48d493415301..18e5c8b67eb8 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -61,15 +61,19 @@ void sig_handler(int sig, struct sigcontext *sc)
61 61
62static void real_alarm_handler(int sig, struct sigcontext *sc) 62static void real_alarm_handler(int sig, struct sigcontext *sc)
63{ 63{
64 union uml_pt_regs regs;
65
64 if(sig == SIGALRM) 66 if(sig == SIGALRM)
65 switch_timers(0); 67 switch_timers(0);
66 68
67 CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas, 69 if(sc != NULL)
68 sig, sc); 70 copy_sc(&regs, sc);
71 regs.skas.is_user = 0;
72 unblock_signals();
73 timer_handler(sig, &regs);
69 74
70 if(sig == SIGALRM) 75 if(sig == SIGALRM)
71 switch_timers(1); 76 switch_timers(1);
72
73} 77}
74 78
75void alarm_handler(int sig, struct sigcontext *sc) 79void alarm_handler(int sig, struct sigcontext *sc)
@@ -113,6 +117,46 @@ void remove_sigstack(void)
113 117
114void (*handlers[_NSIG])(int sig, struct sigcontext *sc); 118void (*handlers[_NSIG])(int sig, struct sigcontext *sc);
115 119
120void handle_signal(int sig, struct sigcontext *sc)
121{
122 unsigned long pending = 0;
123
124 do {
125 int nested, bail;
126
127 /*
128 * pending comes back with one bit set for each
129 * interrupt that arrived while setting up the stack,
130 * plus a bit for this interrupt, plus the zero bit is
131 * set if this is a nested interrupt.
132 * If bail is true, then we interrupted another
133 * handler setting up the stack. In this case, we
134 * have to return, and the upper handler will deal
135 * with this interrupt.
136 */
137 bail = to_irq_stack(sig, &pending);
138 if(bail)
139 return;
140
141 nested = pending & 1;
142 pending &= ~1;
143
144 while((sig = ffs(pending)) != 0){
145 sig--;
146 pending &= ~(1 << sig);
147 (*handlers[sig])(sig, sc);
148 }
149
150 /* Again, pending comes back with a mask of signals
151 * that arrived while tearing down the stack. If this
152 * is non-zero, we just go back, set up the stack
153 * again, and handle the new interrupts.
154 */
155 if(!nested)
156 pending = from_irq_stack(nested);
157 } while(pending);
158}
159
116extern void hard_handler(int sig); 160extern void hard_handler(int sig);
117 161
118void set_handler(int sig, void (*handler)(int), int flags, ...) 162void set_handler(int sig, void (*handler)(int), int flags, ...)
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 6a0e466d01e3..f9d2f8545afe 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -288,7 +288,8 @@ int start_userspace(unsigned long stub_stack)
288void userspace(union uml_pt_regs *regs) 288void userspace(union uml_pt_regs *regs)
289{ 289{
290 int err, status, op, pid = userspace_pid[0]; 290 int err, status, op, pid = userspace_pid[0];
291 int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/ 291 /* To prevent races if using_sysemu changes under us.*/
292 int local_using_sysemu;
292 293
293 while(1){ 294 while(1){
294 restore_registers(pid, regs); 295 restore_registers(pid, regs);
@@ -296,7 +297,8 @@ void userspace(union uml_pt_regs *regs)
296 /* Now we set local_using_sysemu to be used for one loop */ 297 /* Now we set local_using_sysemu to be used for one loop */
297 local_using_sysemu = get_using_sysemu(); 298 local_using_sysemu = get_using_sysemu();
298 299
299 op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL)); 300 op = SELECT_PTRACE_OPERATION(local_using_sysemu,
301 singlestepping(NULL));
300 302
301 err = ptrace(op, pid, 0, 0); 303 err = ptrace(op, pid, 0, 0);
302 if(err) 304 if(err)
@@ -490,8 +492,8 @@ void map_stub_pages(int fd, unsigned long code,
490void new_thread(void *stack, jmp_buf *buf, void (*handler)(void)) 492void new_thread(void *stack, jmp_buf *buf, void (*handler)(void))
491{ 493{
492 (*buf)[0].JB_IP = (unsigned long) handler; 494 (*buf)[0].JB_IP = (unsigned long) handler;
493 (*buf)[0].JB_SP = (unsigned long) stack + 495 (*buf)[0].JB_SP = (unsigned long) stack + UM_THREAD_SIZE -
494 (PAGE_SIZE << UML_CONFIG_KERNEL_STACK_ORDER) - sizeof(void *); 496 sizeof(void *);
495} 497}
496 498
497#define INIT_JMP_NEW_THREAD 0 499#define INIT_JMP_NEW_THREAD 0
@@ -533,8 +535,7 @@ int start_idle_thread(void *stack, jmp_buf *switch_buf)
533 case INIT_JMP_NEW_THREAD: 535 case INIT_JMP_NEW_THREAD:
534 (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler; 536 (*switch_buf)[0].JB_IP = (unsigned long) new_thread_handler;
535 (*switch_buf)[0].JB_SP = (unsigned long) stack + 537 (*switch_buf)[0].JB_SP = (unsigned long) stack +
536 (PAGE_SIZE << UML_CONFIG_KERNEL_STACK_ORDER) - 538 UM_THREAD_SIZE - sizeof(void *);
537 sizeof(void *);
538 break; 539 break;
539 case INIT_JMP_CALLBACK: 540 case INIT_JMP_CALLBACK:
540 (*cb_proc)(cb_arg); 541 (*cb_proc)(cb_arg);
diff --git a/arch/um/os-Linux/sys-i386/signal.c b/arch/um/os-Linux/sys-i386/signal.c
index 0d3eae518352..f311609f93da 100644
--- a/arch/um/os-Linux/sys-i386/signal.c
+++ b/arch/um/os-Linux/sys-i386/signal.c
@@ -1,15 +1,13 @@
1/* 1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h> 6#include <signal.h>
7 7
8extern void (*handlers[])(int sig, struct sigcontext *sc); 8extern void handle_signal(int sig, struct sigcontext *sc);
9 9
10void hard_handler(int sig) 10void hard_handler(int sig)
11{ 11{
12 struct sigcontext *sc = (struct sigcontext *) (&sig + 1); 12 handle_signal(sig, (struct sigcontext *) (&sig + 1));
13
14 (*handlers[sig])(sig, sc);
15} 13}
diff --git a/arch/um/os-Linux/sys-x86_64/signal.c b/arch/um/os-Linux/sys-x86_64/signal.c
index 3f369e5f976b..82a388822cd3 100644
--- a/arch/um/os-Linux/sys-x86_64/signal.c
+++ b/arch/um/os-Linux/sys-x86_64/signal.c
@@ -1,16 +1,16 @@
1/* 1/*
2 * Copyright (C) 2006 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2006 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h> 6#include <signal.h>
7 7
8extern void (*handlers[])(int sig, struct sigcontext *sc); 8extern void handle_signal(int sig, struct sigcontext *sc);
9 9
10void hard_handler(int sig) 10void hard_handler(int sig)
11{ 11{
12 struct ucontext *uc; 12 struct ucontext *uc;
13 asm("movq %%rdx, %0" : "=r" (uc)); 13 asm("movq %%rdx, %0" : "=r" (uc));
14 14
15 (*handlers[sig])(sig, (struct sigcontext *) &uc->uc_mcontext); 15 handle_signal(sig, (struct sigcontext *) &uc->uc_mcontext);
16} 16}
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index c307a89ed259..7cbcf484e13d 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -33,25 +33,8 @@
33 33
34void stack_protections(unsigned long address) 34void stack_protections(unsigned long address)
35{ 35{
36 int prot = PROT_READ | PROT_WRITE | PROT_EXEC; 36 if(mprotect((void *) address, UM_THREAD_SIZE,
37 37 PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
38 if(mprotect((void *) address, UM_KERN_PAGE_SIZE, prot) < 0)
39 panic("protecting stack failed, errno = %d", errno);
40}
41
42void task_protections(unsigned long address)
43{
44 unsigned long guard = address + UM_KERN_PAGE_SIZE;
45 unsigned long stack = guard + UM_KERN_PAGE_SIZE;
46 int prot = 0, pages;
47
48#ifdef notdef
49 if(mprotect((void *) stack, UM_KERN_PAGE_SIZE, prot) < 0)
50 panic("protecting guard page failed, errno = %d", errno);
51#endif
52 pages = (1 << UML_CONFIG_KERNEL_STACK_ORDER) - 2;
53 prot = PROT_READ | PROT_WRITE | PROT_EXEC;
54 if(mprotect((void *) stack, pages * UM_KERN_PAGE_SIZE, prot) < 0)
55 panic("protecting stack failed, errno = %d", errno); 38 panic("protecting stack failed, errno = %d", errno);
56} 39}
57 40
@@ -72,7 +55,7 @@ int raw(int fd)
72 55
73 /* XXX tcsetattr could have applied only some changes 56 /* XXX tcsetattr could have applied only some changes
74 * (and cfmakeraw() is a set of changes) */ 57 * (and cfmakeraw() is a set of changes) */
75 return(0); 58 return 0;
76} 59}
77 60
78void setup_machinename(char *machine_out) 61void setup_machinename(char *machine_out)
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index f21068378272..52be79beb306 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -716,4 +716,7 @@ ia32_sys_call_table:
716 .quad sys_getcpu 716 .quad sys_getcpu
717 .quad sys_epoll_pwait 717 .quad sys_epoll_pwait
718 .quad compat_sys_utimensat /* 320 */ 718 .quad compat_sys_utimensat /* 320 */
719 .quad sys_signalfd
720 .quad sys_timerfd
721 .quad sys_eventfd
719ia32_syscall_end: 722ia32_syscall_end:
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
index 213d90e04755..6c34bdd22e26 100644
--- a/arch/x86_64/kernel/head64.c
+++ b/arch/x86_64/kernel/head64.c
@@ -62,13 +62,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
62{ 62{
63 int i; 63 int i;
64 64
65 /*
66 * Make sure kernel is aligned to 2MB address. Catching it at compile
67 * time is better. Change your config file and compile the kernel
68 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
69 */
70 BUILD_BUG_ON(CONFIG_PHYSICAL_START & (__KERNEL_ALIGN - 1));
71
72 /* clear bss before set_intr_gate with early_idt_handler */ 65 /* clear bss before set_intr_gate with early_idt_handler */
73 clear_bss(); 66 clear_bss();
74 67