[lkml]   [2002]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: 2.5.4 Compile Error
On Mon, 2002-02-11 at 01:02, John Weber wrote:

> The function thread_saved_pc() is a mystery to me. It is declared with
> a return type of unsigned long, and yet return this:
> ((unsigned long *)tsk->thread->esp)[3]
> This is confusing to me in many ways:
> - the "thread" member of task struct is not a pointer
> - esp is of type unsigned long, so I don't understand the cast, and
> I certainly don't understand the [3] here.
> Can anyone explain this code to me?

The problem is an interdependency between processor.h and sched.h.

The old code was the same, except it did


where t was a thread_struct, instead of what we do now


where t is a task_struct. And thus whereby before we passed


as the argument, now you pass just `p'. I.e., its the same net-affect.
The error is because the function needs access to both task_struct (in
sched.h) and thread_struct (in processor.h) but the two are interrelated
so we can't include them in each other.

The contents of esp is a memory address, so typecasting it to (unsigned
long *) is OK.

As for the [3], p[3] is the same as
so that is legal.

So the fix, aside from reverting this change and the kernel/sched.c
change and the sparc64 changes ... would be to solve the dependency

Robert Love

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:24    [W:0.074 / U:6.732 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site