Re: The current Macro

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

 



Hi Paul,

On 8/30/05, Paul Duplys <kernel_newbie@xxxxxx> wrote:
> Hi Ohad,
> 
> the architecture I'm working on, Infineon's Tricore microcontroller, has 16
> general purpose data registers and 16 general purpose address registers (pc,
> psw and so on are kept in special core registers). So I guess I have enough
> registers to sacrifice one for holding the "current" value.
> 
> You wrote:
> > 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");
> >
> 
> Then there must be a function (or an instruction in a function), which
> stores the pointer to the current task_struct in the register r2, right? Do
> you know, where that function/instruction can be found in kernel code, so I
> can modify it for my register set?

this function is very architecture dependant, is implemented in pure assembly,
and is located, on PPC,for example, in "arch/ppc/kernel/entry.S".
its beginning is marked by _GLOBAL(_switch), it's not short, but I guess
what you're looking for are the following lines:

/* save the old current 'last' for return value */
mr      r3,r2
addi    r2,r4,-THREAD   /* Update current */

note: on entry, r4 points to the THREAD for the new task.

hope it helps,
Ohad.
> 
> Thanks for your help,
> Paul
> 
> --
> 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
> +++ GMX - die erste Adresse für Mail, Message, More +++
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux