Understanding Linux Kernel O'Reiliy....
It gives a good insight.... but i think it explains an older version of kernel....[2.2]
ketan
SACHIN PRASAD wrote:
I was just looking at the code on the link http://www.kernelnewbies.org/faq/ and found a piece of code
static inline struct task_struct * get_current(void)
{
struct task_struct *current;
__asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
return current;
}
i am new to kernel prograaming and want an explantions for :-
1. "%0" is a macro that expands to the first input/output specification.
2.Basically, the task's task_struct and a task's kernel stack occupy an 8KB block that is 8KB aligned, with the task_struct at the beginning and the stack growing from the end downwards. So you can find the task_struct by clearing the bottom 13 bits of the stack pointer value.
I am a computer science graduate and have a C programming experience but still these are really proving qutie tuff for me , especially the stack architecture in memory
any replies and helps appreciated
regards
sachin
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 3 months FREE*. http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_stopmorespam_3mf
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/
-- "Only the paranoid survives." --- Andy Grove -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/