blob: 3c341222d2525e740a5beda96fa09c8819d97323 [file] [log] [blame]
Gennady Sharapovea2ba7d2006-01-08 01:01:31 -08001/*
Jeff Dikeba180fd2007-10-16 01:27:00 -07002 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * Licensed under the GPL
4 */
5
6#ifndef __KERN_UTIL_H__
7#define __KERN_UTIL_H__
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include "sysdep/ptrace.h"
Bodo Stroesserc5784552005-05-05 16:15:31 -070010#include "sysdep/faultinfo.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Jeff Dike0983a882008-02-04 22:31:08 -080012extern int uml_exitcode;
13
Linus Torvalds1da177e2005-04-16 15:20:36 -070014extern int ncpus;
Linus Torvalds1da177e2005-04-16 15:20:36 -070015extern int kmalloc_ok;
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#define UML_ROUND_UP(addr) \
Jeff Dikeedea1382008-02-04 22:30:46 -080018 ((((unsigned long) addr) + PAGE_SIZE - 1) & PAGE_MASK)
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Linus Torvalds1da177e2005-04-16 15:20:36 -070020extern unsigned long alloc_stack(int order, int atomic);
Jeff Dikeedea1382008-02-04 22:30:46 -080021extern void free_stack(unsigned long stack, int order);
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023extern int do_signal(void);
Jeff Dikeedea1382008-02-04 22:30:46 -080024extern void copy_sc(struct uml_pt_regs *regs, void *from);
25extern void interrupt_end(void);
26extern void relay_signal(int sig, struct uml_pt_regs *regs);
27
Bodo Stroesserc5784552005-05-05 16:15:31 -070028extern unsigned long segv(struct faultinfo fi, unsigned long ip,
Jeff Dike77bf4402007-10-16 01:26:58 -070029 int is_user, struct uml_pt_regs *regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070030extern int handle_page_fault(unsigned long address, unsigned long ip,
31 int is_write, int is_user, int *code_out);
Jeff Dikeedea1382008-02-04 22:30:46 -080032
Jeff Dike77bf4402007-10-16 01:26:58 -070033extern unsigned int do_IRQ(int irq, struct uml_pt_regs *regs);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034extern int smp_sigio_handler(void);
Jeff Dikeedea1382008-02-04 22:30:46 -080035extern void initial_thread_cb(void (*proc)(void *), void *arg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070036extern int is_syscall(unsigned long addr);
Jeff Dikeedea1382008-02-04 22:30:46 -080037extern void timer_handler(int sig, struct uml_pt_regs *regs);
Paolo 'Blaisorblade' Giarrusso972410b2006-03-31 02:30:21 -080038
Jeff Dikeedea1382008-02-04 22:30:46 -080039extern void timer_handler(int sig, struct uml_pt_regs *regs);
Paolo 'Blaisorblade' Giarrussob6316292006-01-18 17:42:58 -080040
Jeff Dike77bf4402007-10-16 01:26:58 -070041extern int start_uml(void);
Jeff Dikeedea1382008-02-04 22:30:46 -080042extern void paging_init(void);
43
44extern void uml_cleanup(void);
45extern void do_uml_exitcalls(void);
46
47/*
48 * Are we disallowed to sleep? Used to choose between GFP_KERNEL and
49 * GFP_ATOMIC.
50 */
51extern int __cant_sleep(void);
52extern void *get_current(void);
53extern int copy_from_user_proc(void *to, void *from, int size);
54extern int cpu(void);
55extern char *uml_strdup(const char *string);
56
57extern unsigned long to_irq_stack(unsigned long *mask_out);
58extern unsigned long from_irq_stack(int nested);
59
60extern void syscall_trace(struct uml_pt_regs *regs, int entryexit);
61extern int singlestepping(void *t);
62
63extern void segv_handler(int sig, struct uml_pt_regs *regs);
64extern void bus_handler(int sig, struct uml_pt_regs *regs);
65extern void winch(int sig, struct uml_pt_regs *regs);
Jeff Dike3e6f2ac2008-02-04 22:30:58 -080066extern void fatal_sigsegv(void) __attribute__ ((noreturn));
Jeff Dikeedea1382008-02-04 22:30:46 -080067
68
Linus Torvalds1da177e2005-04-16 15:20:36 -070069#endif