Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) |
| 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
| 6 | #ifndef __KERN_UTIL_H__ |
| 7 | #define __KERN_UTIL_H__ |
| 8 | |
| 9 | #include "linux/threads.h" |
| 10 | #include "sysdep/ptrace.h" |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 11 | #include "sysdep/faultinfo.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
| 13 | extern int ncpus; |
| 14 | extern char *linux_prog; |
| 15 | extern char *gdb_init; |
| 16 | extern int kmalloc_ok; |
| 17 | extern int timer_irq_inited; |
| 18 | extern int jail; |
| 19 | extern int nsyscalls; |
| 20 | |
| 21 | extern struct task_struct *idle_threads[NR_CPUS]; |
| 22 | |
| 23 | #define UML_ROUND_DOWN(addr) ((void *)(((unsigned long) addr) & PAGE_MASK)) |
| 24 | #define UML_ROUND_UP(addr) \ |
| 25 | UML_ROUND_DOWN(((unsigned long) addr) + PAGE_SIZE - 1) |
| 26 | |
| 27 | extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg); |
| 28 | extern unsigned long stack_sp(unsigned long page); |
| 29 | extern int kernel_thread_proc(void *data); |
| 30 | extern void syscall_segv(int sig); |
| 31 | extern int current_pid(void); |
| 32 | extern unsigned long alloc_stack(int order, int atomic); |
| 33 | extern int do_signal(void); |
| 34 | extern int is_stack_fault(unsigned long sp); |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 35 | extern unsigned long segv(struct faultinfo fi, unsigned long ip, |
| 36 | int is_user, void *sc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | extern int handle_page_fault(unsigned long address, unsigned long ip, |
| 38 | int is_write, int is_user, int *code_out); |
| 39 | extern void syscall_ready(void); |
| 40 | extern void set_tracing(void *t, int tracing); |
| 41 | extern int is_tracing(void *task); |
| 42 | extern int segv_syscall(void); |
| 43 | extern void kern_finish_exec(void *task, int new_pid, unsigned long stack); |
| 44 | extern int page_size(void); |
| 45 | extern unsigned long page_mask(void); |
| 46 | extern int need_finish_fork(void); |
| 47 | extern void free_stack(unsigned long stack, int order); |
| 48 | extern void add_input_request(int op, void (*proc)(int), void *arg); |
| 49 | extern char *current_cmd(void); |
| 50 | extern void timer_handler(int sig, union uml_pt_regs *regs); |
| 51 | extern int set_signals(int enable); |
| 52 | extern void force_sigbus(void); |
| 53 | extern int pid_to_processor_id(int pid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | extern void deliver_signals(void *t); |
| 55 | extern int next_syscall_index(int max); |
| 56 | extern int next_trap_index(int max); |
| 57 | extern void default_idle(void); |
| 58 | extern void finish_fork(void); |
| 59 | extern void paging_init(void); |
| 60 | extern void init_flush_vm(void); |
| 61 | extern void *syscall_sp(void *t); |
| 62 | extern void syscall_trace(union uml_pt_regs *regs, int entryexit); |
| 63 | extern int hz(void); |
| 64 | extern void uml_idle_timer(void); |
| 65 | extern unsigned int do_IRQ(int irq, union uml_pt_regs *regs); |
| 66 | extern int external_pid(void *t); |
| 67 | extern void boot_timer_handler(int sig); |
| 68 | extern void interrupt_end(void); |
| 69 | extern void initial_thread_cb(void (*proc)(void *), void *arg); |
| 70 | extern int debugger_signal(int status, int pid); |
| 71 | extern void debugger_parent_signal(int status, int pid); |
| 72 | extern void child_signal(int pid, int status); |
| 73 | extern int init_ptrace_proxy(int idle_pid, int startup, int stop); |
| 74 | extern int init_parent_proxy(int pid); |
| 75 | extern int singlestepping(void *t); |
| 76 | extern void check_stack_overflow(void *ptr); |
| 77 | extern void relay_signal(int sig, union uml_pt_regs *regs); |
| 78 | extern void not_implemented(void); |
| 79 | extern int user_context(unsigned long sp); |
| 80 | extern void timer_irq(union uml_pt_regs *regs); |
| 81 | extern void unprotect_stack(unsigned long stack); |
| 82 | extern void do_uml_exitcalls(void); |
| 83 | extern int attach_debugger(int idle_pid, int pid, int stop); |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 84 | extern void bad_segv(struct faultinfo fi, unsigned long ip); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | extern int config_gdb(char *str); |
| 86 | extern int remove_gdb(void); |
| 87 | extern char *uml_strdup(char *string); |
| 88 | extern void unprotect_kernel_mem(void); |
| 89 | extern void protect_kernel_mem(void); |
| 90 | extern void uml_cleanup(void); |
| 91 | extern void set_current(void *t); |
| 92 | extern void lock_signalled_task(void *t); |
| 93 | extern void IPI_handler(int cpu); |
| 94 | extern int jail_setup(char *line, int *add); |
| 95 | extern void *get_init_task(void); |
| 96 | extern int clear_user_proc(void *buf, int size); |
| 97 | extern int copy_to_user_proc(void *to, void *from, int size); |
| 98 | extern int copy_from_user_proc(void *to, void *from, int size); |
| 99 | extern int strlen_user_proc(char *str); |
| 100 | extern void bus_handler(int sig, union uml_pt_regs *regs); |
| 101 | extern void winch(int sig, union uml_pt_regs *regs); |
| 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); |
| 108 | extern void arch_switch(void); |
| 109 | extern void free_irq(unsigned int, void *); |
| 110 | extern int um_in_interrupt(void); |
| 111 | extern int cpu(void); |
| 112 | |
| 113 | #endif |
| 114 | |
| 115 | /* |
| 116 | * Overrides for Emacs so that we follow Linus's tabbing style. |
| 117 | * Emacs will notice this stuff at the end of the file and automatically |
| 118 | * adjust the settings for this buffer only. This must remain at the end |
| 119 | * of the file. |
| 120 | * --------------------------------------------------------------------------- |
| 121 | * Local variables: |
| 122 | * c-file-style: "linux" |
| 123 | * End: |
| 124 | */ |