From: David Howells <dhowells@redhat.com>
To: Blesson Paul <blessonpaul@usa.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [Re: __asm__ ]
Date: Wed, 23 May 2001 11:50:30 +0100 [thread overview]
Message-ID: <20987.990615030@warthog.cambridge.redhat.com> (raw)
In-Reply-To: Your message of "23 May 2001 03:00:46 MDT." <20010523090046.13756.qmail@nw177.netaddress.usa.net>
Okay,
"current" is a macro on i386 that expands to "get_current()". This gets the
task_struct for the task currently running on the CPU executing the code.
It does this by masking out the bottom bits of its kernel stack pointer.
For example, assuming that some running process has the following task record
stored in an 8KB-aligned 8KB block.
0xD520BFFF +---------------+
| |
| kernel stack |
| |
0xD520B498 +---- TOS ------+ <-- stack pointer: %esp
| |
| empty space |
| |
+---------------+
| |
| task_struct |
| |
0xD520A000 +---------------+ <-- get_current()
get_current() can work out where the base of this block is because the kernel
(1) stack pointer is always within it, (2) it's aligned in memory with respect
to its size:
get_current() { return %esp & ~8191; }
get_current() { return 0xD520B498 & 0xFFFFE000; }
get_current() = 0xD520A000
So "current->fs" is a structure that holds the current task's idea of its root
filesystem (chroot), current working directory (chdir) and current umask.
And so "current->fs->root" is the task's filesystem root dentry.
David
next prev parent reply other threads:[~2001-05-23 10:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-23 9:00 [Re: __asm__ ] Blesson Paul
2001-05-23 10:50 ` David Howells [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-05-23 9:33 ÀÌÈ£
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20987.990615030@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=blessonpaul@usa.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox