uml: kernel_thread shouldn't panic
[pv_ops_mirror.git] / arch / um / include / kern_util.h
blobae434a9b400da97584a149bea48c8ae93d599064
1 /*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #ifndef __KERN_UTIL_H__
7 #define __KERN_UTIL_H__
9 #include "sysdep/ptrace.h"
10 #include "sysdep/faultinfo.h"
11 #include "uml-config.h"
13 typedef void (*kern_hndl)(int, union uml_pt_regs *);
15 struct kern_handlers {
16 kern_hndl relay_signal;
17 kern_hndl winch;
18 kern_hndl bus_handler;
19 kern_hndl page_fault;
20 kern_hndl sigio_handler;
21 kern_hndl timer_handler;
24 extern const struct kern_handlers handlinfo_kern;
26 extern int ncpus;
27 extern char *gdb_init;
28 extern int kmalloc_ok;
29 extern int jail;
30 extern int nsyscalls;
32 #define UML_ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK))
33 #define UML_ROUND_UP(addr) \
34 UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1)
36 extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg);
37 #ifdef UML_CONFIG_MODE_TT
38 extern unsigned long stack_sp(unsigned long page);
39 #endif
40 extern int kernel_thread_proc(void *data);
41 extern void syscall_segv(int sig);
42 extern int current_pid(void);
43 extern unsigned long alloc_stack(int order, int atomic);
44 extern int do_signal(void);
45 extern int is_stack_fault(unsigned long sp);
46 extern unsigned long segv(struct faultinfo fi, unsigned long ip,
47 int is_user, void *sc);
48 extern int handle_page_fault(unsigned long address, unsigned long ip,
49 int is_write, int is_user, int *code_out);
50 extern void syscall_ready(void);
51 extern void set_tracing(void *t, int tracing);
52 extern int is_tracing(void *task);
53 extern int segv_syscall(void);
54 extern void kern_finish_exec(void *task, int new_pid, unsigned long stack);
55 extern unsigned long page_mask(void);
56 extern int need_finish_fork(void);
57 extern void free_stack(unsigned long stack, int order);
58 extern void add_input_request(int op, void (*proc)(int), void *arg);
59 extern char *current_cmd(void);
60 extern void timer_handler(int sig, union uml_pt_regs *regs);
61 extern int set_signals(int enable);
62 extern int pid_to_processor_id(int pid);
63 extern void deliver_signals(void *t);
64 extern int next_trap_index(int max);
65 extern void default_idle(void);
66 extern void finish_fork(void);
67 extern void paging_init(void);
68 extern void init_flush_vm(void);
69 extern void *syscall_sp(void *t);
70 extern void syscall_trace(union uml_pt_regs *regs, int entryexit);
71 extern int hz(void);
72 extern unsigned int do_IRQ(int irq, union uml_pt_regs *regs);
73 extern void interrupt_end(void);
74 extern void initial_thread_cb(void (*proc)(void *), void *arg);
75 extern int debugger_signal(int status, int pid);
76 extern void debugger_parent_signal(int status, int pid);
77 extern void child_signal(int pid, int status);
78 extern int init_ptrace_proxy(int idle_pid, int startup, int stop);
79 extern int init_parent_proxy(int pid);
80 extern int singlestepping(void *t);
81 extern void check_stack_overflow(void *ptr);
82 extern void relay_signal(int sig, union uml_pt_regs *regs);
83 extern int user_context(unsigned long sp);
84 extern void timer_irq(union uml_pt_regs *regs);
85 extern void unprotect_stack(unsigned long stack);
86 extern void do_uml_exitcalls(void);
87 extern int attach_debugger(int idle_pid, int pid, int stop);
88 extern int config_gdb(char *str);
89 extern int remove_gdb(void);
90 extern char *uml_strdup(char *string);
91 extern void unprotect_kernel_mem(void);
92 extern void protect_kernel_mem(void);
93 extern void uml_cleanup(void);
94 extern void lock_signalled_task(void *t);
95 extern void IPI_handler(int cpu);
96 extern int jail_setup(char *line, int *add);
97 extern void *get_init_task(void);
98 extern int clear_user_proc(void *buf, int size);
99 extern int copy_to_user_proc(void *to, void *from, int size);
100 extern int copy_from_user_proc(void *to, void *from, int size);
101 extern int strlen_user_proc(char *str);
102 extern long execute_syscall(void *r);
103 extern int smp_sigio_handler(void);
104 extern void *get_current(void);
105 extern struct task_struct *get_task(int pid, int require);
106 extern void machine_halt(void);
107 extern int is_syscall(unsigned long addr);
109 extern void free_irq(unsigned int, void *);
110 extern int cpu(void);
112 extern void time_init_kern(void);
114 /* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */
115 extern int __cant_sleep(void);
116 extern void sigio_handler(int sig, union uml_pt_regs *regs);
118 #endif