Cleanup of ptrace / ptregs.h

Pavel Machek (pavel@suse.cz)
Thu, 3 May 2001 21:51:01 +0200


Hi!

Magic constant like 17 is always bad... This gets rid of it.

Please apply,
Pavel
Index: arch/i386/kernel/ptrace.c
===================================================================
RCS file: /home/cvs/Repository/linux/arch/i386/kernel/ptrace.c,v
retrieving revision 1.1.1.2
diff -u -u -r1.1.1.2 ptrace.c
--- arch/i386/kernel/ptrace.c 2001/04/19 20:02:44 1.1.1.2
+++ arch/i386/kernel/ptrace.c 2001/05/03 18:50:15
@@ -229,7 +229,7 @@
break;

tmp = 0; /* Default return condition */
- if(addr < 17*sizeof(long))
+ if(addr < FRAME_SIZE*sizeof(long))
tmp = getreg(child, addr);
if(addr >= (long) &dummy->u_debugreg[0] &&
addr <= (long) &dummy->u_debugreg[7]){
@@ -256,7 +256,7 @@
addr > sizeof(struct user) - 3)
break;

- if (addr < 17*sizeof(long)) {
+ if (addr < FRAME_SIZE*sizeof(long)) {
ret = putreg(child, addr, data);
break;
}
@@ -369,11 +369,11 @@
}

case PTRACE_GETREGS: { /* Get all gp regs from the child. */
- if (!access_ok(VERIFY_WRITE, (unsigned *)data, 17*sizeof(long))) {
+ if (!access_ok(VERIFY_WRITE, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
ret = -EIO;
break;
}
- for ( i = 0; i < 17*sizeof(long); i += sizeof(long) ) {
+ for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) {
__put_user(getreg(child, i),(unsigned long *) data);
data += sizeof(long);
}
@@ -383,11 +383,11 @@

case PTRACE_SETREGS: { /* Set all gp regs in the child. */
unsigned long tmp;
- if (!access_ok(VERIFY_READ, (unsigned *)data, 17*sizeof(long))) {
+ if (!access_ok(VERIFY_READ, (unsigned *)data, FRAME_SIZE*sizeof(long))) {
ret = -EIO;
break;
}
- for ( i = 0; i < 17*sizeof(long); i += sizeof(long) ) {
+ for ( i = 0; i < FRAME_SIZE*sizeof(long); i += sizeof(long) ) {
__get_user(tmp, (unsigned long *) data);
putreg(child, i, tmp);
data += sizeof(long);
Index: include/asm-i386/ptrace.h
===================================================================
RCS file: /home/cvs/Repository/linux/include/asm-i386/ptrace.h,v
retrieving revision 1.1.1.2
diff -u -u -r1.1.1.2 ptrace.h
--- include/asm-i386/ptrace.h 2001/04/19 20:00:50 1.1.1.2
+++ include/asm-i386/ptrace.h 2001/05/03 18:50:15
@@ -18,7 +18,7 @@
#define EFL 14
#define UESP 15
#define SS 16
-
+#define FRAME_SIZE 17

/* this struct defines the way the registers are stored on the
stack during a system call. */

-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at discuss@linmodems.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/