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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:50:46+00:00 2026-05-28T17:50:46+00:00

I know the spinlock is exported by hal.dll in Windows, so I reverse engineered

  • 0

I know the spinlock is exported by hal.dll in Windows, so I reverse engineered the code for the spin lock. The results are below.

Windows XP’s decompiled spinlock.

unsigned __int32 __thiscall KfAcquireSpinLock(signed __int32 *this)
{
  unsigned __int32 result; // eax@1

  result = __readfsdword(36);
  __writefsdword(36, 2u);
  while ( _interlockedbittestandset(this, 0) )
  {
    while ( *this & 1 )
      _mm_pause();
  }
  return result;
}

Windows 7’s decompiled spinlock.

unsigned __int32 __fastcall KeAcquireSpinLockRaiseToSynch(signed __int32 *a1)
{
  unsigned __int32 result; // eax@1
  int v2; // edx@4
  unsigned __int32 v3; // ST0C_4@7
  signed __int32 *v4; // ST08_4@7
  int v5; // ST04_4@7

  result = __readfsdword(36);
  __writefsbyte(36, 0x1Bu);
  while ( _interlockedbittestandset(a1, 0) )
  {
    v2 = 0;
    do
    {
      ++v2;
     if ( !(v2 & dword_8002D1B0) )
      {
        if ( dword_8002D19C & 0x40 )
        {
          v3 = result;
          v4 = a1;
          v5 = v2;
          dword_8002D1B4(v2);
          v2 = v5;
          a1 = v4;
          result = v3;
        }
      }
      _mm_pause();
    }
    while ( *a1 & 1 );
 }
  return result;
}

Why is the code different between the versions? In particular, I don’t see how the code added in the Windows 7 version improves the spinlock’s performance in virtualization.

  • 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-28T17:50:47+00:00Added an answer on May 28, 2026 at 5:50 pm

    KeAcquireSpinLockRaiseToSynch is not the same as KeAcquireSpinLock.

    KeAcquireSpinLockRaiseToSynch is reserved for system use, not meant to be used by interfacing drivers.

    Thus the difference.

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

Sidebar

Related Questions

Know of a way to mock %[]? I'm writing tests for code that makes
I know how to cause it to be in hex: unsigned char myNum =
I know you can minify/condense Javascript or CSS code, but can you do this
Anyone know what type of JSON (if even that!) the following code is? I'm
Know of an OCAML/CAML IDE? Especially one that runs on Linux?
Know of any good libraries for this? I did some searches and didn't come
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I know in certain circumstances, such as long running processes, it is important to
I know Microsoft has made efforts in the direction of semantic and cross-browser compliant

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.