operating-systemfilesystemshexfat32

What do ? mean when looking at hexadecimal numbers for FAT entry values for the FAT32 filesystem?


I am writing an operating system, therefore I need to implement a filesystem. So I chose FAT32. I was looking up FAT entry values and for the values it gave numbers like: 0x?0000000. So my question is what does the ? mean?

I have tried googling the answer but it only shows tutorials on hexadecimal, which don't include the answer to my question


Solution

  • It's probably time to read the official specification?

    fatgen103.doc says:

    A FAT32 FAT entry is actually only a 28-bit entry. The high 4 bits of a FAT32 FAT entry are reserved. The only time that the high 4 bits of FAT32 FAT entries should ever be changed is when the volume is formatted, at which time the whole 32-bit FAT entry should be zeroed, including the high 4 bits.

    A bit more explanation is in order here, because this point about FAT32 FAT entries seems to cause a great deal of confusion. Basically 32-bit FAT entries are not really 32-bit values; they are only 28-bit values. For example, all of these 32-bit cluster entry values: 0x10000000, 0xF0000000, and 0x00000000 all indicate that the cluster is FREE, because you ignore the high 4 bits when you read the cluster entry value. If the 32-bit free cluster value is currently 0x30000000 and you want to mark this cluster as bad by storing the value 0x0FFFFFF7 in it. Then the 32-bit entry will contain the value 0x3FFFFFF7 when you are done, because you must preserve the high 4 bits when you write in the 0x0FFFFFF7 bad cluster mark.