NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: kdx7214 on March 20, 2021, 12:31:23 AM

Title: Efficient bit array for kernel paging?
Post by: kdx7214 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?