Hi Dave,
On Tue, 2007-04-24 at 16:27 -0400, Dave Anderson wrote:
> Hi Mike,
>
> I don't think you need to go through all the STRUCT_EXISTS()
> and MEMBER_OFFSET() gyrations, do you?
>
>
How about this (uncompiled/untested):
Indead, that's better! Here the patch, which compiles and works:
Thanks!
Michael
---
diff -Naurp crash-4.0-3.22/s390.c crash-4.0-3.22-s390-rq-fix/s390.c
--- crash-4.0-3.22/s390.c 2007-04-10 16:27:20.000000000 +0200
+++ crash-4.0-3.22-s390-rq-fix/s390.c 2007-04-25 10:43:14.000000000 +0200
@@ -538,10 +538,11 @@ s390_has_cpu(unsigned long task)
/* Linux 2.6 */
unsigned long runqueue_addr, runqueue_offset;
unsigned long cpu_offset, per_cpu_offset_addr, running_task;
- char runqueue[4096];
+ char *runqueue;
int cpu;
cpu = s390_cpu_of_task(task);
+ runqueue = GETBUF(SIZE(runqueue));
runqueue_offset=symbol_value("per_cpu__runqueues");
per_cpu_offset_addr=symbol_value("__per_cpu_offset");
@@ -549,10 +550,10 @@ s390_has_cpu(unsigned long task)
&cpu_offset, sizeof(long),"per_cpu_offset",
FAULT_ON_ERROR);
runqueue_addr=runqueue_offset + cpu_offset;
- readmem(runqueue_addr,KVADDR,&runqueue,sizeof(runqueue),
+ readmem(runqueue_addr,KVADDR,runqueue,SIZE(runqueue),
"runqueue", FAULT_ON_ERROR);
- running_task = *((unsigned long*)&runqueue[MEMBER_OFFSET(
- "runqueue", "curr")]);
+ running_task = ULONG(runqueue + OFFSET(runqueue_curr));
+ FREEBUF(runqueue);
if(running_task == task)
return TRUE;
else
diff -Naurp crash-4.0-3.22/s390x.c crash-4.0-3.22-s390-rq-fix/s390x.c
--- crash-4.0-3.22/s390x.c 2007-04-10 16:27:20.000000000 +0200
+++ crash-4.0-3.22-s390-rq-fix/s390x.c 2007-04-25 10:43:19.000000000 +0200
@@ -572,10 +572,11 @@ s390x_has_cpu(unsigned long task)
/* Linux 2.6 */
unsigned long runqueue_addr, runqueue_offset;
unsigned long cpu_offset, per_cpu_offset_addr, running_task;
- char runqueue[4096];
+ char *runqueue;
int cpu;
cpu = s390x_cpu_of_task(task);
+ runqueue = GETBUF(SIZE(runqueue));
runqueue_offset=symbol_value("per_cpu__runqueues");
per_cpu_offset_addr=symbol_value("__per_cpu_offset");
@@ -583,10 +584,10 @@ s390x_has_cpu(unsigned long task)
&cpu_offset, sizeof(long),"per_cpu_offset",
FAULT_ON_ERROR);
runqueue_addr=runqueue_offset + cpu_offset;
- readmem(runqueue_addr,KVADDR,&runqueue,sizeof(runqueue),
+ readmem(runqueue_addr,KVADDR,runqueue,SIZE(runqueue),
"runqueue", FAULT_ON_ERROR);
- running_task = *((unsigned long*)&runqueue[MEMBER_OFFSET(
- "runqueue", "curr")]);
+ running_task = ULONG(runqueue + OFFSET(runqueue_curr));
+ FREEBUF(runqueue);
if(running_task == task)
return TRUE;
else