1 /* 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 3 * Licensed under the GPL 4 */ 5 6 #ifndef __KERN_UTIL_H__ 7 #define __KERN_UTIL_H__ 8 9 #include "sysdep/ptrace.h" 10 #include "sysdep/faultinfo.h" 11 12 extern int uml_exitcode; 13 14 extern int ncpus; 15 extern int kmalloc_ok; 16 17 #define UML_ROUND_UP(addr) \ 18 ((((unsigned long) addr) + PAGE_SIZE - 1) & PAGE_MASK) 19 20 extern unsigned long alloc_stack(int order, int atomic); 21 extern void free_stack(unsigned long stack, int order); 22 23 extern int do_signal(void); 24 extern void interrupt_end(void); 25 extern void relay_signal(int sig, struct uml_pt_regs *regs); 26 27 extern unsigned long segv(struct faultinfo fi, unsigned long ip, 28 int is_user, struct uml_pt_regs *regs); 29 extern int handle_page_fault(unsigned long address, unsigned long ip, 30 int is_write, int is_user, int *code_out); 31 32 extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs); 33 extern int smp_sigio_handler(void); 34 extern void initial_thread_cb(void (*proc)(void *), void *arg); 35 extern int is_syscall(unsigned long addr); 36 extern void timer_handler(int sig, struct uml_pt_regs *regs); 37 38 extern void timer_handler(int sig, struct uml_pt_regs *regs); 39 40 extern int start_uml(void); 41 extern void paging_init(void); 42 43 extern void uml_cleanup(void); 44 extern void do_uml_exitcalls(void); 45 46 /* 47 * Are we disallowed to sleep? Used to choose between GFP_KERNEL and 48 * GFP_ATOMIC. 49 */ 50 extern int __cant_sleep(void); 51 extern int get_current_pid(void); 52 extern int copy_from_user_proc(void *to, void *from, int size); 53 extern int cpu(void); 54 extern char *uml_strdup(const char *string); 55 56 extern unsigned long to_irq_stack(unsigned long *mask_out); 57 extern unsigned long from_irq_stack(int nested); 58 59 extern void syscall_trace(struct uml_pt_regs *regs, int entryexit); 60 extern int singlestepping(void *t); 61 62 extern void segv_handler(int sig, struct uml_pt_regs *regs); 63 extern void bus_handler(int sig, struct uml_pt_regs *regs); 64 extern void winch(int sig, struct uml_pt_regs *regs); 65 extern void fatal_sigsegv(void) __attribute__ ((noreturn)); 66 67 68 #endif 69