Author Topic: Efficient bit array for kernel paging?  (Read 8779 times)

Offline kdx7214

  • New Member
  • Posts: 1
Efficient bit array for kernel paging?
« on: March 20, 2021, 12:31:23 AM »
I'm currently playing around with a 64-bit x86_64 kernel and am at the point where I need to do paging.
I've written bit arrays before in several languages but was wondering if there are more efficient ways to do
it in assembly.   It really only needs three operations:

1.  Set bit
2.  Clear bit
3.  Find first cleared bit

The set and clear bit functions are pretty straightforward, but the find first clear bit is a time hog.

I've google'd for this, but keep finding information on bit masking word sized values and the like.  Plus, I'm sure
my google-fu is weak.

Anyone come across information about optimizing this?