1 /* 2 Compatibility with the linux kernel environment 3 */ 4 5 #include <nlist.h> 6 #include <errno.h> 7 #include <string.h> 8 #include <sys/types.h> 9 10 #if 0 11 struct module 12 { 13 struct module *next; 14 char *name; 15 }; 16 extern struct module *module_list; 17 #endif 18 19 struct thread 20 { 21 unsigned long esp; 22 }; 23 24 struct task_struct 25 { 26 struct thread thread; 27 struct task_struct *next; 28 }; 29 30 unsigned long __get_free_page(int type); 31 void *kmalloc(size_t size, int type); 32 #define GFP_KERNEL 1 33 void free_page(unsigned long page); 34 void kfree(void *mem); 35 void vfree(void *mem); 36 37 size_t strncpy_from_user(char *addr, const char *user_name, size_t size); 38 39 void lock_kernel(void); 40 void unlock_kernel(void); 41 42 /* void __asm__(char *str); */ 43 44 #define for_each_task(t) for(t= task_list; t; t=t->next) 45 extern struct task_struct *task_list; 46 47 typedef struct { int foo; } pgprot_t; 48 extern void *__vmalloc(unsigned long size, int gfp_mask, pgprot_t prot); 49 50 #define ElfW(type) Elf_ ## type 51 typedef unsigned long Elf_Addr; 52 typedef unsigned long Elf_Word; 53 54 void kallsyms_sections(void *infop, 55 int (*fp)(void *token, const char *modname, const char *secname, 56 ElfW(Addr) secstart, ElfW(Addr) secend, ElfW(Word) secflags)); 57 58 unsigned long __generic_copy_to_user(void *, const void *, unsigned long); 59 unsigned long __generic_copy_from_user(void *, const void *, unsigned long); 60 61 struct lock { int dummy; }; 62 extern struct lock tasklist_lock; 63 void read_lock(struct lock *lock); 64 void read_unlock(struct lock *lock); 65 66 void udelay(unsigned long usecs); 67 68 int copy_to_user(void * result_record, void *res, size_t size); 69 70 void panic(char *str); 71 72 #define PAGE_SIZE (0x1000) 73 #define PAGE_MASK (0x0fff) 74 #define PAGE_OFFSET 0 /* What does this do? */ 75 #define TASK_SIZE 0 /* What does this do? */ 76 77 void printk(char *fmt, ...); 78 79 #include "ddb.h" 80 #include "db_machdep.h" 81 int kallsyms_address_to_symbol(db_expr_t off, 82 const char * *mod_name, unsigned long *mod_start, unsigned long *mod_end, 83 const char * *sec_name, unsigned long *sec_start, unsigned long *sec_end, 84 const char * *sym_name, unsigned long *sym_start, unsigned long *sym_end); 85 86 int read_nlist(const char *filenamer, struct nlist **nlist_table); 87 88 unsigned long text_read_ul(void *addr); 89 unsigned char text_read_ub(void *addr); 90 void text_write_ul(void *addr, unsigned long value); 91 void text_write_ub(void *addr, unsigned char value); 92 93 extern pid_t victim_pid; 94 extern char *victim_exe; 95 96 void load_nlist(char *exe_name, unsigned long *btextp, unsigned long *etextp); 97