Commit 04fe6faf authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] xtensa: task_pt_regs(), task_stack_page()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 30af7120
...@@ -145,7 +145,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, ...@@ -145,7 +145,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
int user_mode = user_mode(regs); int user_mode = user_mode(regs);
/* Set up new TSS. */ /* Set up new TSS. */
tos = (unsigned long)p->thread_info + THREAD_SIZE; tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;
if (user_mode) if (user_mode)
childregs = (struct pt_regs*)(tos - PT_USER_SIZE); childregs = (struct pt_regs*)(tos - PT_USER_SIZE);
else else
...@@ -217,7 +217,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) ...@@ -217,7 +217,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
unsigned long get_wchan(struct task_struct *p) unsigned long get_wchan(struct task_struct *p)
{ {
unsigned long sp, pc; unsigned long sp, pc;
unsigned long stack_page = (unsigned long) p->thread_info; unsigned long stack_page = (unsigned long) task_stack_page(p);
int count = 0; int count = 0;
if (!p || p == current || p->state == TASK_RUNNING) if (!p || p == current || p->state == TASK_RUNNING)
......
...@@ -72,7 +72,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -72,7 +72,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
struct pt_regs *regs; struct pt_regs *regs;
unsigned long tmp; unsigned long tmp;
regs = xtensa_pt_regs(child); regs = task_pt_regs(child);
tmp = 0; /* Default return value. */ tmp = 0; /* Default return value. */
switch(addr) { switch(addr) {
...@@ -149,7 +149,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -149,7 +149,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
case PTRACE_POKEUSR: case PTRACE_POKEUSR:
{ {
struct pt_regs *regs; struct pt_regs *regs;
regs = xtensa_pt_regs(child); regs = task_pt_regs(child);
switch (addr) { switch (addr) {
case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
...@@ -240,7 +240,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -240,7 +240,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
* elf_gregset_t format. */ * elf_gregset_t format. */
xtensa_gregset_t format; xtensa_gregset_t format;
struct pt_regs *regs = xtensa_pt_regs(child); struct pt_regs *regs = task_pt_regs(child);
do_copy_regs (&format, regs, child); do_copy_regs (&format, regs, child);
...@@ -257,7 +257,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -257,7 +257,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
* values in the elf_gregset_t format. */ * values in the elf_gregset_t format. */
xtensa_gregset_t format; xtensa_gregset_t format;
struct pt_regs *regs = xtensa_pt_regs(child); struct pt_regs *regs = task_pt_regs(child);
if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){ if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){
ret = -EFAULT; ret = -EFAULT;
...@@ -281,7 +281,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -281,7 +281,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
* elf_fpregset_t format. */ * elf_fpregset_t format. */
elf_fpregset_t fpregs; elf_fpregset_t fpregs;
struct pt_regs *regs = xtensa_pt_regs(child); struct pt_regs *regs = task_pt_regs(child);
do_save_fpregs (&fpregs, regs, child); do_save_fpregs (&fpregs, regs, child);
...@@ -299,7 +299,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ...@@ -299,7 +299,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
* values in the elf_fpregset_t format. * values in the elf_fpregset_t format.
*/ */
elf_fpregset_t fpregs; elf_fpregset_t fpregs;
struct pt_regs *regs = xtensa_pt_regs(child); struct pt_regs *regs = task_pt_regs(child);
ret = 0; ret = 0;
if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) { if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) {
......
...@@ -184,12 +184,12 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); ...@@ -184,12 +184,12 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
#define release_segments(mm) do { } while(0) #define release_segments(mm) do { } while(0)
#define forget_segments() do { } while (0) #define forget_segments() do { } while (0)
#define thread_saved_pc(tsk) (xtensa_pt_regs(tsk)->pc) #define thread_saved_pc(tsk) (task_pt_regs(tsk)->pc)
extern unsigned long get_wchan(struct task_struct *p); extern unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) (xtensa_pt_regs(tsk)->pc) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
#define KSTK_ESP(tsk) (xtensa_pt_regs(tsk)->areg[1]) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
#define cpu_relax() do { } while (0) #define cpu_relax() do { } while (0)
......
...@@ -113,8 +113,8 @@ struct pt_regs { ...@@ -113,8 +113,8 @@ struct pt_regs {
}; };
#ifdef __KERNEL__ #ifdef __KERNEL__
# define xtensa_pt_regs(tsk) ((struct pt_regs*) \ # define task_pt_regs(tsk) ((struct pt_regs*) \
(((long)(tsk)->thread_info + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4)) - 1) (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0) # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
# define instruction_pointer(regs) ((regs)->pc) # define instruction_pointer(regs) ((regs)->pc)
extern void show_regs(struct pt_regs *); extern void show_regs(struct pt_regs *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment