blob: 58c0b10fcf2ddbf2990956f3998c5bacce731221 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Stroesserc5784552005-05-05 16:15:31 -070011#include "sysdep/faultinfo.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13extern int ncpus;
14extern char *linux_prog;
15extern char *gdb_init;
16extern int kmalloc_ok;
17extern int timer_irq_inited;
18extern int jail;
19extern int nsyscalls;
20
21extern 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
27extern int kernel_fork(unsigned long flags, int (*fn)(void *), void * arg);
28extern unsigned long stack_sp(unsigned long page);
29extern int kernel_thread_proc(void *data);
30extern void syscall_segv(int sig);
31extern int current_pid(void);
32extern unsigned long alloc_stack(int order, int atomic);
33extern int do_signal(void);
34extern int is_stack_fault(unsigned long sp);
Bodo Stroesserc5784552005-05-05 16:15:31 -070035extern unsigned long segv(struct faultinfo fi, unsigned long ip,
36 int is_user, void *sc);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037extern int handle_page_fault(unsigned long address, unsigned long ip,
38 int is_write, int is_user, int *code_out);
39extern void syscall_ready(void);
40extern void set_tracing(void *t, int tracing);
41extern int is_tracing(void *task);
42extern int segv_syscall(void);
43extern void kern_finish_exec(void *task, int new_pid, unsigned long stack);
44extern int page_size(void);
45extern unsigned long page_mask(void);
46extern int need_finish_fork(void);
47extern void free_stack(unsigned long stack, int order);
48extern void add_input_request(int op, void (*proc)(int), void *arg);
49extern char *current_cmd(void);
50extern void timer_handler(int sig, union uml_pt_regs *regs);
51extern int set_signals(int enable);
52extern void force_sigbus(void);
53extern int pid_to_processor_id(int pid);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054extern void deliver_signals(void *t);
55extern int next_syscall_index(int max);
56extern int next_trap_index(int max);
57extern void default_idle(void);
58extern void finish_fork(void);
59extern void paging_init(void);
60extern void init_flush_vm(void);
61extern void *syscall_sp(void *t);
62extern void syscall_trace(union uml_pt_regs *regs, int entryexit);
63extern int hz(void);
64extern void uml_idle_timer(void);
65extern unsigned int do_IRQ(int irq, union uml_pt_regs *regs);
66extern int external_pid(void *t);
67extern void boot_timer_handler(int sig);
68extern void interrupt_end(void);
69extern void initial_thread_cb(void (*proc)(void *), void *arg);
70extern int debugger_signal(int status, int pid);
71extern void debugger_parent_signal(int status, int pid);
72extern void child_signal(int pid, int status);
73extern int init_ptrace_proxy(int idle_pid, int startup, int stop);
74extern int init_parent_proxy(int pid);
75extern int singlestepping(void *t);
76extern void check_stack_overflow(void *ptr);
77extern void relay_signal(int sig, union uml_pt_regs *regs);
78extern void not_implemented(void);
79extern int user_context(unsigned long sp);
80extern void timer_irq(union uml_pt_regs *regs);
81extern void unprotect_stack(unsigned long stack);
82extern void do_uml_exitcalls(void);
83extern int attach_debugger(int idle_pid, int pid, int stop);
Bodo Stroesserc5784552005-05-05 16:15:31 -070084extern void bad_segv(struct faultinfo fi, unsigned long ip);
Linus Torvalds1da177e2005-04-16 15:20:36 -070085extern int config_gdb(char *str);
86extern int remove_gdb(void);
87extern char *uml_strdup(char *string);
88extern void unprotect_kernel_mem(void);
89extern void protect_kernel_mem(void);
90extern void uml_cleanup(void);
91extern void set_current(void *t);
92extern void lock_signalled_task(void *t);
93extern void IPI_handler(int cpu);
94extern int jail_setup(char *line, int *add);
95extern void *get_init_task(void);
96extern int clear_user_proc(void *buf, int size);
97extern int copy_to_user_proc(void *to, void *from, int size);
98extern int copy_from_user_proc(void *to, void *from, int size);
99extern int strlen_user_proc(char *str);
100extern void bus_handler(int sig, union uml_pt_regs *regs);
101extern void winch(int sig, union uml_pt_regs *regs);
102extern long execute_syscall(void *r);
103extern int smp_sigio_handler(void);
104extern void *get_current(void);
105extern struct task_struct *get_task(int pid, int require);
106extern void machine_halt(void);
107extern int is_syscall(unsigned long addr);
108extern void arch_switch(void);
109extern void free_irq(unsigned int, void *);
110extern int um_in_interrupt(void);
111extern 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 */