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