x86: minor cleanup for ptrace_32/64

From: Jan Engelhardt
Date: Tue Jan 15 2008 - 07:47:58 EST


commit abd7e7b7e05f8af290e7a7e6c5f3cbb57192523a
Author: Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx>
Date: Tue Jan 15 03:31:39 2008 +0100

x86: minor cleanup

- let get_stack_long from ptrace_32 use long (not int) for consistency
- make put_stack_long() return void (return value not used anywhere)
- add const keyword to args

Signed-off-by: Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx>

diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index ff5431c..339a1fa 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -57,13 +57,14 @@ static inline struct pt_regs *get_child_regs(struct task_struct *task)
* 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)
+static inline unsigned long
+get_stack_long(const struct task_struct *task, int offset)
{
unsigned char *stack;

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

/*
@@ -72,7 +73,7 @@ static inline int get_stack_long(struct task_struct *task, int offset)
* 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,
+static inline void put_stack_long(const struct task_struct *task, int offset,
unsigned long data)
{
unsigned char * stack;
@@ -80,7 +81,6 @@ static inline int put_stack_long(struct task_struct *task, int offset,
stack = (unsigned char *)task->thread.esp0 - sizeof(struct pt_regs);
stack += offset;
*(unsigned long *) stack = data;
- return 0;
}

static int putreg(struct task_struct *child,
diff --git a/arch/x86/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index 607085f..b60ed76 100644
--- a/arch/x86/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
@@ -56,13 +56,14 @@
* this routine assumes that all the privileged stacks are in our
* data space.
*/
-static inline unsigned long get_stack_long(struct task_struct *task, int offset)
+static inline unsigned long
+get_stack_long(const struct task_struct *task, int offset)
{
unsigned char *stack;

stack = (unsigned char *)task->thread.rsp0;
stack += offset;
- return (*((unsigned long *)stack));
+ return *(unsigned long *)stack;
}

/*
@@ -71,7 +72,7 @@ static inline unsigned long get_stack_long(struct task_struct *task, int offset)
* this routine assumes that all the privileged stacks are in our
* data space.
*/
-static inline long put_stack_long(struct task_struct *task, int offset,
+static inline void put_stack_long(const struct task_struct *task, int offset,
unsigned long data)
{
unsigned char * stack;
@@ -79,7 +80,6 @@ static inline long put_stack_long(struct task_struct *task, int offset,
stack = (unsigned char *) task->thread.rsp0;
stack += offset;
*(unsigned long *) stack = data;
- return 0;
}

#define LDT_SEGMENT 4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/