x86: minor cleanup for ptrace_32/64



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/



Relevant Pages

  • Re: Trying to set up a global directory in GT.M
    ... and I miss sorely in Cache. ... out of their stack. ... code in memory, it doesn't reload it until it is out of the process ... although since Cache's routine stack was ...
    (comp.lang.mumps)
  • Re: Fortran DLL-Interface to Delphi
    ... | in the Project Options for Code Generation ... the calling routine cleans the stack. ... pass string arguments. ...
    (comp.lang.fortran)
  • Re: A Brief Look at History
    ... That routine might require a pair of x,y coordinates. ... way to do it will sometimes have 8 items on the stack which is unwieldy. ... so now you need two libraries. ... Bang. ...
    (comp.lang.forth)
  • Re: GNAT parameter passing, C-style?
    ... Ada must evaluate and stack up parameters in some specific order, nor, ... > left and the calling routine popped the stack. ... > not to care how many arguments it was actually called with. ... its not the dress that makes you look fat. ...
    (comp.lang.ada)
  • Input Number Routine works from console but not from Program
    ... The routine works reliably when run interactively but crashes ... stack depth increased in file @<junk not copyable on ... Esp: SP@ 00126F74 stack ptr ...
    (comp.lang.forth)