Hi Paul, I'll give you two examples: On PPC the current is simply defined as the register r2. quoting from a vanilla 2.6.11 here (Linux/include/asm-ppc/current.h ) : register struct task_struct *current asm ("r2"); This is possible due to the large number of registers in that architecture, whereas in the not-so-lucky x86 architecture current is an inline function which dereferences the task member out of the current thread_info struct. ( return current_thread_info()->task; ) current_thread_info is calculating the address of thread_info, btw, by masking the 13 least significant bits of the stack pointer. ( assuming stack size is 8192 bytes size and the thread_info struct is indeed living on its bottom). "sacrificing" a register for the task is honorable, but not cheap :) hope that helps, Ohad. On 8/29/05, Paul Duplys <kernel_newbie@xxxxxx> wrote: > Hi all! > > As I already mentioned in my earlier emails, I am working on a linux port > for a new architecture. > > I'm now trying to define the "current" macro. I read that most architectures > keep a pointer to the thread_info instance in some processor register, so I > thought it will be perhaps ok if I'll do it too. > > Well, that's actually not a problem, since I can get the content of any > register using inline assembly instructions. But which register should I > use? > > I mean, where in the kernel is a macro or a function which stores the > pointer to thread_info in some register? In other words, how do I find out > which register is actually used by the kernel for storing that pointer? > > I also want to thank you all for your answers to my earlier emails. You have > really helped me a lot and I'm glad, that I joined this mailing list! > > Regards, Paul > > > -- > GMX DSL = Maximale Leistung zum minimalen Preis! > 2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/