Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3432732
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:29:13+00:00 2026-05-18T07:29:13+00:00

I am currently reading ‘Linux Kernel Development’ by Robert Love and I do not

  • 0

I am currently reading ‘Linux Kernel Development’ by Robert Love and I do not understand what this bit of assembly is doing.

Basically, in each process kernel stack, there is a struct thread_info which resides at the end of the stack. Now, on the x86 architecture, we can apparently grab this (assuming 8KB stack size) by using the following assembly

movl $-8192, %eax
andl %esp, %eax

So basically ANDing the stack pointer by 0xffffe000. I’m confused as to what is going on here? I don’t see why masking the least significant 13 bits of %esp takes us to the struct. I know I’ll feel stupid once it is explained, but it is bugging me.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:29:13+00:00Added an answer on May 18, 2026 at 7:29 am

    The stack grows downwards, so the end of the stack is the lowest address in the stack, and the structure’s starting address. And stacks are stored at multiples of 8KB. Therefore, erasing the 13 least significant bits gets the lowest address of the stack and therefore the start of the structure. Does this make sense?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently reading some C++ source code, and I came across this: double
Currently reading quite a heavy WCF book. I have used it myself in production
I am currently reading Beginning CakePHP:From Novice to Professional by David Golding. At one
I'm currently reading, Design Patterns:Elements of Reusable Object-Oriented Software by Erich Gamma and others.
I'm currently evaluating CodeRush and one thing that I liked most when reading the
Currently I'm doing some unit tests which are executed from bash. Unit tests are
Im currently reading Code Complete by Steve McConnell, specifically page 295 on floating-point numbers.
I am currently reading the book called "Programming ActionScript 3.0" available from Adobe. After
I'm currently reading in a list of tables in a SQL database and populating
I'm Currently reading two excellent books Working Effectively with Legacy Code and Clean Code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.