/* @(#)73 1.5 src/avs/fs/mmfs/ts/kernext/gpl-linux/power/ss_ppc.c, mmfs, avs_rgpfs24, rgpfs240610b 7/28/05 10:38:39 */ /* * Implementation of shared segment for GPFS daemon and GPFS kernel code. * */ #include #include #include #include #include #include #include #include #include #if LINUX_KERNEL_VERSION < 2060000 #include #endif #include int kxSaveThreadInfo(int tid, void* regP) { struct task_struct *g, *t; int rc = ENOENT; unsigned long sp; read_lock(&tasklist_lock); DO_EACH_THREAD(g,t) { if (t->pid != tid) continue; rc = 0; goto found_it; } WHILE_EACH_THREAD(g,t); found_it: read_unlock(&tasklist_lock); if (rc == 0) { if (t->thread.regs != NULL) copy_to_user(regP, t->thread.regs, sizeof(struct pt_regs)); else { #if LINUX_KERNEL_VERSION < 2060000 sp = (unsigned long)t + sizeof(union task_union); #else /* ??? */ sp = (unsigned long)t->thread_info + THREAD_SIZE; #endif sp -= sizeof(struct pt_regs); copy_to_user(regP, (void*)sp, sizeof(struct pt_regs)); } } return rc; }