[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kernel_stack_page






On Fri, 5 Jan 2001, Rik van Riel wrote:

> On Fri, 5 Jan 2001, Sourav Sen wrote:
> 
> > Or is it something in task_struct itself that is tracking the
> > per process kernel stack, if yes, whats that??
> 
> You're getting close...
> 
> On 2.2 and 2.4, the task_struct and the kernel stack of each
> process share the same 2 pages of memory.
> 
>  8kB ----------------------
>          kernel stack
>          (grows down)
>              |
>              V
>          .... 
> 		<- stack pointer at random address
> 
> 800B     end of task_struct == stack limit
>          ...
>          ...
>          ...
>  0kB     start of task_struct
> 
> 
> Because this area is always 8kB aligned and physically
> contiguous (automatically contiguous in kernel VM space)
> all you need to do is look at the stack pointer and go

	Ok, Thanks, But how u grab the stack ptr. at the first place? Also
what is it that keeps the saved value of stack pointer on a context
switch? 

> down to the nearest 8kB boundary to get the start of the
> current task_struct.
> 

	Also, what happens in an interrupt context? Which stack is used?

> regards,
> 
> Rik
> --

	Regards
		Sourav

> Virtual memory is like a game you can't win;
> However, without VM there's truly nothing to loose...
> 
> 		http://www.surriel.com/
> http://www.conectiva.com/	http://distro.conectiva.com.br/
> 
> -
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/
> IRC Channel:   irc.openprojects.net / #kernelnewbies
> Web Page:      http://www.surriel.com/kernelnewbies.shtml
> 

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.surriel.com/kernelnewbies.shtml