提交 c7584fb6 编写于 作者: A Al Viro 提交者: Linus Torvalds

[PATCH] s390: task_pt_regs()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 579b3ea5
...@@ -112,7 +112,7 @@ static inline int dump_regs32(struct pt_regs *ptregs, elf_gregset_t *regs) ...@@ -112,7 +112,7 @@ static inline int dump_regs32(struct pt_regs *ptregs, elf_gregset_t *regs)
static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs) static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs)
{ {
struct pt_regs *ptregs = __KSTK_PTREGS(tsk); struct pt_regs *ptregs = task_pt_regs(tsk);
int i; int i;
memcpy(&regs->psw.mask, &ptregs->psw.mask, 4); memcpy(&regs->psw.mask, &ptregs->psw.mask, 4);
......
...@@ -217,8 +217,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp, ...@@ -217,8 +217,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
struct pt_regs childregs; struct pt_regs childregs;
} *frame; } *frame;
frame = ((struct fake_frame *) frame = container_of(task_pt_regs(p), struct fake_frame, childregs);
(THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
p->thread.ksp = (unsigned long) frame; p->thread.ksp = (unsigned long) frame;
/* Store access registers to kernel stack of new process. */ /* Store access registers to kernel stack of new process. */
frame->childregs = *regs; frame->childregs = *regs;
......
...@@ -52,7 +52,7 @@ FixPerRegisters(struct task_struct *task) ...@@ -52,7 +52,7 @@ FixPerRegisters(struct task_struct *task)
struct pt_regs *regs; struct pt_regs *regs;
per_struct *per_info; per_struct *per_info;
regs = __KSTK_PTREGS(task); regs = task_pt_regs(task);
per_info = (per_struct *) &task->thread.per_info; per_info = (per_struct *) &task->thread.per_info;
per_info->control_regs.bits.em_instruction_fetch = per_info->control_regs.bits.em_instruction_fetch =
per_info->single_step | per_info->instruction_fetch; per_info->single_step | per_info->instruction_fetch;
...@@ -150,7 +150,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data) ...@@ -150,7 +150,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
/* /*
* psw and gprs are stored on the stack * psw and gprs are stored on the stack
*/ */
tmp = *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr); tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);
if (addr == (addr_t) &dummy->regs.psw.mask) if (addr == (addr_t) &dummy->regs.psw.mask)
/* Remove per bit from user psw. */ /* Remove per bit from user psw. */
tmp &= ~PSW_MASK_PER; tmp &= ~PSW_MASK_PER;
...@@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data) ...@@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
/* /*
* orig_gpr2 is stored on the kernel stack * orig_gpr2 is stored on the kernel stack
*/ */
tmp = (addr_t) __KSTK_PTREGS(child)->orig_gpr2; tmp = (addr_t) task_pt_regs(child)->orig_gpr2;
} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
/* /*
...@@ -243,7 +243,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data) ...@@ -243,7 +243,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
high order bit but older gdb's rely on it */ high order bit but older gdb's rely on it */
data |= PSW_ADDR_AMODE; data |= PSW_ADDR_AMODE;
#endif #endif
*(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr) = data; *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
} else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
/* /*
...@@ -267,7 +267,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data) ...@@ -267,7 +267,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
/* /*
* orig_gpr2 is stored on the kernel stack * orig_gpr2 is stored on the kernel stack
*/ */
__KSTK_PTREGS(child)->orig_gpr2 = data; task_pt_regs(child)->orig_gpr2 = data;
} else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
/* /*
...@@ -393,15 +393,15 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) ...@@ -393,15 +393,15 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
*/ */
if (addr == (addr_t) &dummy32->regs.psw.mask) { if (addr == (addr_t) &dummy32->regs.psw.mask) {
/* Fake a 31 bit psw mask. */ /* Fake a 31 bit psw mask. */
tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32); tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);
tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp); tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp);
} else if (addr == (addr_t) &dummy32->regs.psw.addr) { } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
/* Fake a 31 bit psw address. */ /* Fake a 31 bit psw address. */
tmp = (__u32) __KSTK_PTREGS(child)->psw.addr | tmp = (__u32) task_pt_regs(child)->psw.addr |
PSW32_ADDR_AMODE31; PSW32_ADDR_AMODE31;
} else { } else {
/* gpr 0-15 */ /* gpr 0-15 */
tmp = *(__u32 *)((addr_t) &__KSTK_PTREGS(child)->psw + tmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +
addr*2 + 4); addr*2 + 4);
} }
} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
...@@ -415,7 +415,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data) ...@@ -415,7 +415,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
/* /*
* orig_gpr2 is stored on the kernel stack * orig_gpr2 is stored on the kernel stack
*/ */
tmp = *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4); tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);
} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
/* /*
...@@ -472,15 +472,15 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) ...@@ -472,15 +472,15 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp)) if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp))
/* Invalid psw mask. */ /* Invalid psw mask. */
return -EINVAL; return -EINVAL;
__KSTK_PTREGS(child)->psw.mask = task_pt_regs(child)->psw.mask =
PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32); PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32);
} else if (addr == (addr_t) &dummy32->regs.psw.addr) { } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
/* Build a 64 bit psw address from 31 bit address. */ /* Build a 64 bit psw address from 31 bit address. */
__KSTK_PTREGS(child)->psw.addr = task_pt_regs(child)->psw.addr =
(__u64) tmp & PSW32_ADDR_INSN; (__u64) tmp & PSW32_ADDR_INSN;
} else { } else {
/* gpr 0-15 */ /* gpr 0-15 */
*(__u32*)((addr_t) &__KSTK_PTREGS(child)->psw *(__u32*)((addr_t) &task_pt_regs(child)->psw
+ addr*2 + 4) = tmp; + addr*2 + 4) = tmp;
} }
} else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
...@@ -494,7 +494,7 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data) ...@@ -494,7 +494,7 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
/* /*
* orig_gpr2 is stored on the kernel stack * orig_gpr2 is stored on the kernel stack
*/ */
*(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4) = tmp; *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp;
} else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
/* /*
......
...@@ -282,7 +282,7 @@ static inline void start_hz_timer(void) ...@@ -282,7 +282,7 @@ static inline void start_hz_timer(void)
{ {
if (!cpu_isset(smp_processor_id(), nohz_cpu_mask)) if (!cpu_isset(smp_processor_id(), nohz_cpu_mask))
return; return;
account_ticks(__KSTK_PTREGS(current)); account_ticks(task_pt_regs(current));
cpu_clear(smp_processor_id(), nohz_cpu_mask); cpu_clear(smp_processor_id(), nohz_cpu_mask);
} }
......
...@@ -240,7 +240,7 @@ char *task_show_regs(struct task_struct *task, char *buffer) ...@@ -240,7 +240,7 @@ char *task_show_regs(struct task_struct *task, char *buffer)
{ {
struct pt_regs *regs; struct pt_regs *regs;
regs = __KSTK_PTREGS(task); regs = task_pt_regs(task);
buffer += sprintf(buffer, "task: %p, ksp: %p\n", buffer += sprintf(buffer, "task: %p, ksp: %p\n",
task, (void *)task->thread.ksp); task, (void *)task->thread.ksp);
buffer += sprintf(buffer, "User PSW : %p %p\n", buffer += sprintf(buffer, "User PSW : %p %p\n",
......
...@@ -163,7 +163,7 @@ static inline int dump_regs(struct pt_regs *ptregs, elf_gregset_t *regs) ...@@ -163,7 +163,7 @@ static inline int dump_regs(struct pt_regs *ptregs, elf_gregset_t *regs)
static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
{ {
struct pt_regs *ptregs = __KSTK_PTREGS(tsk); struct pt_regs *ptregs = task_pt_regs(tsk);
memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs)); memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs));
memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs)); memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs));
regs->orig_gpr2 = ptregs->orig_gpr2; regs->orig_gpr2 = ptregs->orig_gpr2;
......
...@@ -191,10 +191,10 @@ extern void show_registers(struct pt_regs *regs); ...@@ -191,10 +191,10 @@ extern void show_registers(struct pt_regs *regs);
extern void show_trace(struct task_struct *task, unsigned long *sp); extern void show_trace(struct task_struct *task, unsigned long *sp);
unsigned long get_wchan(struct task_struct *p); unsigned long get_wchan(struct task_struct *p);
#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \ #define task_pt_regs(tsk) ((struct pt_regs *) \
((unsigned long) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs))) ((void *)(tsk)->thread_info + THREAD_SIZE) - 1)
#define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr)
#define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15]) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15])
/* /*
* Give up the time slice of the virtual PU. * Give up the time slice of the virtual PU.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册