Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44908
b: refs/heads/master
c: 8701ea9
h: refs/heads/master
v: v3
  • Loading branch information
Jeremy Fitzhardinge authored and Linus Torvalds committed Dec 22, 2006
1 parent 883e532 commit 155680c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7c7e9425f114a109b07be2c2c1c6c169e34e9bb3
refs/heads/master: 8701ea957dd2a7c309e17c8dcde3a64b92d8aec0
21 changes: 10 additions & 11 deletions trunk/arch/i386/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
/*
* Offset of eflags on child stack..
*/
#define EFL_OFFSET ((EFL-2)*4-sizeof(struct pt_regs))
#define EFL_OFFSET offsetof(struct pt_regs, eflags)

static inline struct pt_regs *get_child_regs(struct task_struct *task)
{
Expand All @@ -54,32 +54,32 @@ static inline struct pt_regs *get_child_regs(struct task_struct *task)
}

/*
* this routine will get a word off of the processes privileged stack.
* the offset is how far from the base addr as stored in the TSS.
* this routine assumes that all the privileged stacks are in our
* This routine will get a word off of the processes privileged stack.
* the offset is bytes into the pt_regs structure on the stack.
* This routine assumes that all the privileged stacks are in our
* data space.
*/
static inline int get_stack_long(struct task_struct *task, int offset)
{
unsigned char *stack;

stack = (unsigned char *)task->thread.esp0;
stack = (unsigned char *)task->thread.esp0 - sizeof(struct pt_regs);
stack += offset;
return (*((int *)stack));
}

/*
* this routine will put a word on the processes privileged stack.
* the offset is how far from the base addr as stored in the TSS.
* this routine assumes that all the privileged stacks are in our
* This routine will put a word on the processes privileged stack.
* the offset is bytes into the pt_regs structure on the stack.
* This routine assumes that all the privileged stacks are in our
* data space.
*/
static inline int put_stack_long(struct task_struct *task, int offset,
unsigned long data)
{
unsigned char * stack;

stack = (unsigned char *) task->thread.esp0;
stack = (unsigned char *)task->thread.esp0 - sizeof(struct pt_regs);
stack += offset;
*(unsigned long *) stack = data;
return 0;
Expand Down Expand Up @@ -114,7 +114,7 @@ static int putreg(struct task_struct *child,
}
if (regno > ES*4)
regno -= 1*4;
put_stack_long(child, regno - sizeof(struct pt_regs), value);
put_stack_long(child, regno, value);
return 0;
}

Expand All @@ -137,7 +137,6 @@ static unsigned long getreg(struct task_struct *child,
default:
if (regno > ES*4)
regno -= 1*4;
regno = regno - sizeof(struct pt_regs);
retval &= get_stack_long(child, regno);
}
return retval;
Expand Down

0 comments on commit 155680c

Please sign in to comment.