Re: about the macro "current" of i386 machines

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

 



Hi Paul...

Looks like it's me who learn from you :) But the positive side is, I
am forced to re-read about inline assembly :D

> finally translated into this:
>
> movl %1,%0
>
> or
>
> movl %%fs:%1,%0
>
> (that macro__percpu_seg() means "" on a non-SMP machine, or
> "%%fs:" on a SMP machine.)
>
> Let's say I have a non-SMP machine, how dose that give me the
> pointer? I googled my answer, found that, every CPU has a private
> data zone, it contains the pointer to current task_struct. And I still
> have a question: where is that segment (pointed by which segment
> register)? And where in that segment containes the pointer we want?

OK, you do better job than me on the macro expansion :) For your above
question, since I don't have 2.6.22.x source code in hand, I can only
offer a guess. I think the address is simply fetched from
per_cpu_current_task variable.

Kernel usually refer to DS when retrieving data. So it's DS:<offset>.
And since normally data segment starts from 0 address, it's equal to
access toward <address>.

Does that helps you?

NB: I see an important point here. Why "current" is no longer derived
by substracting kernel's %esp? Is it faster now by simply referencing
to (aligned?) in-RAM pointer?

regards,

Mulyadi

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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