2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #ifndef __KERN_UTIL_H__
7 #define __KERN_UTIL_H__
9 #include "linux/threads.h"
10 #include "sysdep/ptrace.h"
11 #include "sysdep/faultinfo.h"
14 extern char *linux_prog
;
15 extern char *gdb_init
;
16 extern int kmalloc_ok
;
17 extern int timer_irq_inited
;
21 extern struct task_struct
*idle_threads
[NR_CPUS
];
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)
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
);
35 extern unsigned long segv(struct faultinfo fi
, unsigned long ip
,
36 int is_user
, void *sc
);
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
);
54 extern void block_signals(void);
55 extern void unblock_signals(void);
56 extern void deliver_signals(void *t
);
57 extern int next_syscall_index(int max
);
58 extern int next_trap_index(int max
);
59 extern void default_idle(void);
60 extern void finish_fork(void);
61 extern void paging_init(void);
62 extern void init_flush_vm(void);
63 extern void *syscall_sp(void *t
);
64 extern void syscall_trace(union uml_pt_regs
*regs
, int entryexit
);
66 extern void uml_idle_timer(void);
67 extern unsigned int do_IRQ(int irq
, union uml_pt_regs
*regs
);
68 extern int external_pid(void *t
);
69 extern void boot_timer_handler(int sig
);
70 extern void interrupt_end(void);
71 extern void initial_thread_cb(void (*proc
)(void *), void *arg
);
72 extern int debugger_signal(int status
, int pid
);
73 extern void debugger_parent_signal(int status
, int pid
);
74 extern void child_signal(int pid
, int status
);
75 extern int init_ptrace_proxy(int idle_pid
, int startup
, int stop
);
76 extern int init_parent_proxy(int pid
);
77 extern int singlestepping(void *t
);
78 extern void check_stack_overflow(void *ptr
);
79 extern void relay_signal(int sig
, union uml_pt_regs
*regs
);
80 extern void not_implemented(void);
81 extern int user_context(unsigned long sp
);
82 extern void timer_irq(union uml_pt_regs
*regs
);
83 extern void unprotect_stack(unsigned long stack
);
84 extern void do_uml_exitcalls(void);
85 extern int attach_debugger(int idle_pid
, int pid
, int stop
);
86 extern void bad_segv(struct faultinfo fi
, unsigned long ip
);
87 extern int config_gdb(char *str
);
88 extern int remove_gdb(void);
89 extern char *uml_strdup(char *string
);
90 extern void unprotect_kernel_mem(void);
91 extern void protect_kernel_mem(void);
92 extern void uml_cleanup(void);
93 extern void set_current(void *t
);
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 void bus_handler(int sig
, union uml_pt_regs
*regs
);
103 extern void winch(int sig
, union uml_pt_regs
*regs
);
104 extern long execute_syscall(void *r
);
105 extern int smp_sigio_handler(void);
106 extern void *get_current(void);
107 extern struct task_struct
*get_task(int pid
, int require
);
108 extern void machine_halt(void);
109 extern int is_syscall(unsigned long addr
);
110 extern void arch_switch(void);
111 extern void free_irq(unsigned int, void *);
112 extern int um_in_interrupt(void);
113 extern int cpu(void);
118 * Overrides for Emacs so that we follow Linus's tabbing style.
119 * Emacs will notice this stuff at the end of the file and automatically
120 * adjust the settings for this buffer only. This must remain at the end
122 * ---------------------------------------------------------------------------
124 * c-file-style: "linux"