Rev | Line | |
---|
[16] | 1 | /* @(#)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 */ |
---|
| 2 | /* |
---|
| 3 | * Implementation of shared segment for GPFS daemon and GPFS kernel code. |
---|
| 4 | * |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #include <Shark-gpl.h> |
---|
| 8 | #include <cxiSystem.h> |
---|
| 9 | #include <cxiSharedSeg.h> |
---|
| 10 | |
---|
| 11 | #include <linux/types.h> |
---|
| 12 | #include <linux/version.h> |
---|
| 13 | #include <linux/kernel.h> |
---|
| 14 | #include <linux/module.h> |
---|
| 15 | #include <linux/sched.h> |
---|
| 16 | #include <linux/types.h> |
---|
| 17 | #if LINUX_KERNEL_VERSION < 2060000 |
---|
| 18 | #include <linux/compatmac.h> |
---|
| 19 | #endif |
---|
| 20 | |
---|
| 21 | #include <verdep.h> |
---|
| 22 | |
---|
| 23 | int |
---|
| 24 | kxSaveThreadInfo(int tid, void* regP) |
---|
| 25 | { |
---|
| 26 | struct task_struct *g, *t; |
---|
| 27 | int rc = ENOENT; |
---|
| 28 | unsigned long sp; |
---|
| 29 | |
---|
| 30 | read_lock(&tasklist_lock); |
---|
| 31 | DO_EACH_THREAD(g,t) |
---|
| 32 | { |
---|
| 33 | if (t->pid != tid) |
---|
| 34 | continue; |
---|
| 35 | |
---|
| 36 | rc = 0; |
---|
| 37 | goto found_it; |
---|
| 38 | } WHILE_EACH_THREAD(g,t); |
---|
| 39 | found_it: |
---|
| 40 | read_unlock(&tasklist_lock); |
---|
| 41 | if (rc == 0) |
---|
| 42 | { |
---|
| 43 | if (t->thread.regs != NULL) |
---|
| 44 | copy_to_user(regP, t->thread.regs, sizeof(struct pt_regs)); |
---|
| 45 | else |
---|
| 46 | { |
---|
| 47 | #if LINUX_KERNEL_VERSION < 2060000 |
---|
| 48 | sp = (unsigned long)t + sizeof(union task_union); |
---|
| 49 | #else |
---|
| 50 | /* ??? */ |
---|
| 51 | sp = (unsigned long)t->thread_info + THREAD_SIZE; |
---|
| 52 | #endif |
---|
| 53 | sp -= sizeof(struct pt_regs); |
---|
| 54 | copy_to_user(regP, (void*)sp, sizeof(struct pt_regs)); |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | return rc; |
---|
| 58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.