LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-05-2012, 04:24 PM   #1
kingdubp
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
What does the register value REG_UESP contain?


I'm doing some novice work with ucontext and threading. I'm printing out certain register values just to practice doing it.

However, I'm confused about one of the register values in Linux, REG_UESP. For instance, I know that REG_EIP contains the address of the instruction pointer, and REG_ESP contains the address of the stack pointer.

I can't figure out what REG_UESP is, though. Is it an unsigned version of ESP? Is it the address of the last element popped off the stack?

When I print it out right now, it gives an address of 0. Does this mean it points to the first memory address, or that its value is null?

Last edited by kingdubp; 10-05-2012 at 04:26 PM.
 
Old 11-02-2012, 04:56 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
The UESP is the user stack pointer, which is only relevant when there has been a change in privilege level. If there hasn't been a change in privilege level, then this will not have been set. There is actually only one real stack pointer register, but the thread context has to keep the stack pointer from the user thread when it switches to a new stack pointer after the change in privilege level.

Note also that from the point of view of a stack pointer, '0' points to the end of virtual memory, not the beginning, since the stack pointer will predecrement. But this wouldn't be a normal value in most x86 contexts.

Last edited by neonsignal; 11-02-2012 at 04:57 AM.
 
Old 11-02-2012, 09:02 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by neonsignal View Post
Note also that from the point of view of a stack pointer, '0' points to the end of virtual memory, not the beginning, since the stack pointer will predecrement. But this wouldn't be a normal value in most x86 contexts.
Hmmm... I don't understand this last bit, Neon... You seem to be suggesting that the CPU does something other than simply copy the user-state SP value verbatim into this register as it performs the switch.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for Open-Source Asset Register Software, IT Equipment and Register Database boninebm Linux - Software 1 09-13-2011 04:56 AM
How to register new HD with OS? johnfman Linux - Hardware 4 03-19-2008 07:33 PM
cannot get scsi to register keithone Linux - Hardware 1 11-08-2007 11:11 PM
How to register 9.3 Pro Crito SUSE / openSUSE 3 06-29-2005 01:03 PM
domain name register amjad Linux - Software 1 01-31-2005 06:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration