int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs)
{
- struct thread_info *ti = tsk->thread_info;
- long ksp = (unsigned long)ti + THREAD_SIZE - 32;
- elf_dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1);
+ elf_dump_regs(*regs, task_pt_regs(tsk));
return 1;
}
if (!access_ok(VERIFY_WRITE, data, 38 * 8))
return -EIO;
- regs = (struct pt_regs *) ((unsigned long) child->thread_info +
- THREAD_SIZE - 32 - sizeof(struct pt_regs));
+ regs = task_pt_regs(child);
for (i = 0; i < 32; i++)
__put_user (regs->regs[i], data + i);
if (!access_ok(VERIFY_READ, data, 38 * 8))
return -EIO;
- regs = (struct pt_regs *) ((unsigned long) child->thread_info +
- THREAD_SIZE - 32 - sizeof(struct pt_regs));
+ regs = task_pt_regs(child);
for (i = 0; i < 32; i++)
__get_user (regs->regs[i], data + i);
struct pt_regs *regs;
unsigned long tmp = 0;
- regs = (struct pt_regs *) ((unsigned long) child->thread_info +
- THREAD_SIZE - 32 - sizeof(struct pt_regs));
+ regs = task_pt_regs(child);
ret = 0; /* Default return value. */
switch (addr) {
case PTRACE_POKEUSR: {
struct pt_regs *regs;
ret = 0;
- regs = (struct pt_regs *) ((unsigned long) child->thread_info +
- THREAD_SIZE - 32 - sizeof(struct pt_regs));
+ regs = task_pt_regs(child);
switch (addr) {
case 0 ... 31:
struct pt_regs *regs;
unsigned int tmp;
- regs = (struct pt_regs *) ((unsigned long) child->thread_info +
- THREAD_SIZE - 32 - sizeof(struct pt_regs));
+ regs = task_pt_regs(child);
ret = 0; /* Default return value. */
switch (addr) {
case PTRACE_POKEUSR: {
struct pt_regs *regs;
ret = 0;
- regs = (struct pt_regs *) ((unsigned long) child->thread_info +
- THREAD_SIZE - 32 - sizeof(struct pt_regs));
+ regs = task_pt_regs(child);
switch (addr) {
case 0 ... 31:
unsigned long get_wchan(struct task_struct *p);
-#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs))
#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32)
-#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc)))
-#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29])))
-#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status)))
+#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
+#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
#define cpu_relax() barrier()
do { \
if (cpu_has_dsp) \
__save_dsp(prev); \
- (last) = resume(prev, next, next->thread_info); \
+ (last) = resume(prev, next, task_thread_info(next)); \
if (cpu_has_dsp) \
__restore_dsp(current); \
} while(0)