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

The Archive Base Latest Questions

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

Can anybody explain me this piece of assembly code? LINEAR_DATA_SEL equ $-gdt dw 0FFFFh

  • 0

Can anybody explain me this piece of assembly code?

LINEAR_DATA_SEL equ $-gdt
    dw 0FFFFh
    dw 0
    db 0
    db 92h      ; present, ring 0, data, expand-up, writable
    db 0CFh     ; page-granular (4 gig limit), 32-bit
    db 0

Here I have already googled about the command equ, dw and db but I can’t understand what this code actually do(especially the first line). what is this $-gdt and the parameters of dw and db? Kindly explain in detail if possible. Thanks in advance.

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

    It’s actually an 8-byte entry in the global descriptor table. It creates a descriptor addressing the entire 4G address space as a selector.

    The equ $-gdt sets up a value in the assembler equal to the difference between this location ($) and the gdt label. In other words, it’s the offset of this entry within the GDT itself.

    The structure of a GDT entry is as follows:

         alt text

    where the individual parts are explained below.

         alt text

    For your specific values:

    (a) dw FFFFh
    (b) dw 0
    (c) db 0
    (d) db 92h      ; present, ring 0, data, expand-up, writable
    (e) db CFh      ; page-granular (4 gig limit), 32-bit
    (f) db 0
    
    1. The base address is calculated from the f, c and b fields, from most significant to least – because these are all zero, the base is at zero.

    2. The selector limit is calculated from the rightmost 4 bits of e and all of a, to give 0xfffff in this case. This has 1 added to it to give 0x100000. See point 3 below for what this means.

    3. The top 4 bits of e (the flags) set the granularity (4K rather than 1 byte) and the operand size (32-bit). With a granularity of 4K (12 bits) and page count of 0x100000 (20 bits), that gives you your full 32-bit (4G) address space.

    4. The d field is the access byte and sets the following properties based on 0x92:

      • Pr present (in-memory) bit to true.
      • Privl privelege level to 0 (need to be ring 0 to get access).
      • Ex executable bit 0 (data selector).
      • DC, direction bit is 0, segment grows up.
      • RW of 1, memory is writable.
      • Ac accessed bit set to 0.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please can anybody explain this code from C++ Reference site : #include <iostream> #include
can anybody explain why this is? here my code: <script> $(document).ready(function() { refresh(); });
can anybody explain this why its happening int i=0; i=i++; i=i++; i=i++; System.out.println(i); it
Can anybody explain this error message: The composition remains unchanged. The changes were rejected
Can anybody explain in detail the reason the overloaded method print(Parent parent) is invoked
I can't seem to get my query to stop using filesort. This is my
So I have this code below for a Table object, and it has a
I have the following piece of SQL that does not work: declare @id INT;
I found this structure called OBJECT_ATTRIBUTE in one of the nt dll functions..I was
I am studying the HTTP methods. I read that GET request can be bookmarked

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.