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 6851765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:17:17+00:00 2026-05-27T01:17:17+00:00

On Microsoft’s site can be found some details of the __addgsbyte ( offset, data

  • 0

On Microsoft’s site can be found some details of the

__addgsbyte  ( offset, data )
__addgsword  ( offset, data )
__addgsdword ( offset, data )
__addgsqword ( offset, data )

intrinsic functions. It is stated that offset is

the offset from the beginning of GS. I presume that GS refers to the processor register.

How does GS relate to the stack, if at all? Alternatively, how can I calculate an offset with respect to GS?

(And, are there any ‘gotchas’ relating to this and particular calling conventions, such as __fastcall?)

  • 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-27T01:17:17+00:00Added an answer on May 27, 2026 at 1:17 am

    The GS register does not relate to the stack at all and therefore no relation to callign convensions. On x64 versions of Windows it is used to point to operating system data:

    From wikipedia:

    Instead of FS segment descriptor on x86 versions of the Windows NT
    family, GS segment descriptor is used to point to two operating system
    defined structures: Thread Information Block (NT_TIB) in user mode and
    Processor Control Region (KPCR) in kernel mode. Thus, for example, in
    user mode GS:0 is the address of the first member of the Thread
    Information Block. Maintaining this convention made the x86-64 port
    easier, but required AMD to retain the function of the FS and GS
    segments in long mode — even though segmented addressing per se is not
    really used by any modern operating system.

    Note that those intrinsics are only available in kernel mode (e.g. device drivers). To calculate an offset, you would need to know what segment of memory GS is pointing to. So in kernel mode you would need to know the layout of the Processor Control Region.

    Personally I don’t know what the use of these would be.

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

Sidebar

Related Questions

Microsoft Report Viewer 2008 Redistributable for Server 2008 R2 Enterprise.The report data can't display.
Microsoft Access is a slick way to access data in a MS SQL Server
Microsoft Speech Recognition comes with a Speech Reference Card. It consists in some pre-determined
Microsoft Enterprise Library has somewhat controversial feedback. Some developers like it, some say it
Microsoft DxDiag can detect whether a system has Direct3D Acceleration. If the system has
Microsoft already has a Windows 7 Beta Customer Preview Program on their MSDN site
Microsoft make this piece of software called Visual Studio 2008 Professional. I have found
Microsoft's Unity dependency injection framework can be configured either through code or through the
Microsoft Books Online (BOL) on Using Change Data explains a misleading error messages for
Does Microsoft implementation of C# runtime offer some localization mechanism to translate common strings

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.