mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Hanson, Jonathan M" <jonathan.m.hanson@intel.com>
To: <pageexec@freemail.hu>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: KSTK_EIP and KSTK_ESP
Date: Mon, 8 Nov 2004 10:36:04 -0700	[thread overview]
Message-ID: <C863B68032DED14E8EBA9F71EB8FE4C20542D290@azsmsx406> (raw)


>>  Can someone explain the structure of the memory that these two
>> macros are accessing? Specifically, where do the 1019 and 1022
offsets
>> come from? Also, what other things are stored at other offsets? Where
is
>> this stack structure defined?

> if you treat the second (upper) page of the kernel stack as an array
> of dwords and you realize that the initial kernel (ring-0) stack
pointer
> is set at element 1024 then the top elements look like this after a
ring
> transition:
>
> [1023] ring-3 SS
> [1022] ring-3 ESP
> [1021] ring-3 EFLAGS
> [1020] ring-3 CS
> [1019] ring-3 EIP
>
> the ring-0 ESP is stored in the TSS and the thread structure, and it's
> initialized in arch/i386/kernel/process.c:copy_thread().

	Thank you for your reply.
	If I dereference the address in 1022 (the ring 3 ESP address) it
does indeed return the value in EBX. I then thought that I could use
this address to feed to dump_thread() since EBX is the first thing in
the pt_regs structure, but that's not correct in this case because the
other registers are definitely incorrect. Shouldn't the ESP value
pointed to by KSTK_ESP() point to the beginning of the pt_regs structure
for the user space application?


             reply	other threads:[~2004-11-08 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08 17:36 Hanson, Jonathan M [this message]
2004-11-08 18:56 ` pageexec
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05 23:13 Hanson, Jonathan M
2004-11-06 12:54 ` Arjan van de Ven
2002-02-08 21:08 Balbir Singh
2002-02-08 20:36 Balbir Singh
2002-02-08 20:55 ` David S. Miller
2002-02-11  6:20 ` Albert D. Cahalan

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=C863B68032DED14E8EBA9F71EB8FE4C20542D290@azsmsx406 \
    --to=jonathan.m.hanson@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pageexec@freemail.hu \
    /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

all inboxes | Powered by JetHome®