[SDK][CMLIB] Declare some BootType and BootRecover identifiers & Miscellaneous Stuff

=== DOCUMENTATION REMARKS ===

HBOOT_TYPE_REGULAR and HBOOT_TYPE_SELF_HEAL are boot type values set up by the CMLIB library (for the BootType field respectively). HBOOT_TYPE_REGULAR indicates a normal system boot whereas HBOOT_TYPE_SELF_HEAL indicates the system boot is assisted within self healing mode.

Whether the former or the latter value is set it's governed by both the kernel and the bootloader. The bootloader and the kernel negotiate together to determine if any of the registry properties (the hive, the base block, the registry base, etc) are so severed from corruption or not. In extreme cases where
registry healing is possible, the specific base block of the damaged hive will have its flags marked with HBOOT_TYPE_SELF_HEAL. At this point the boot phase procedure is orchestrated since the boot phase no longer goes on the default path but it's assisted, as I have already said above.

HBOOT_NO_BOOT_RECOVER, HBOOT_BOOT_RECOVERED_BY_HIVE_LOG and HBOOT_BOOT_RECOVERED_BY_ALTERNATE_HIVE on the other hand are identifiers for the BootRecover field of the BASE_BLOCK header structure. These are used exclusively by FreeLdr to tell the kernel if the bootloader recovered the SYSTEM hive or not. In case where the bootloader did recover the SYSTEM hive,
the kernel will perform a flush request on the dirty data down to disk. The (almost) worse case FreeLdr could not repair the main hive by applying log data, it will load the alternate mirror version of the hive.

In addition to that, declare other miscellaneous CMLIB identifiers for log transaction writes purposes.
This commit is contained in:
George Bișoc 2022-10-26 18:20:03 +02:00
parent 2cc7eeb939
commit 99fab7b905
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6

View file

@ -44,6 +44,17 @@
#define HV_LOG_HEADER_SIZE FIELD_OFFSET(HBASE_BLOCK, Reserved2)
//
// Clean Block identifier
//
#define HV_CLEAN_BLOCK 0U
//
// Hive Log identifiers
//
#define HV_LOG_DIRTY_BLOCK 0xFF
#define HV_LOG_DIRTY_SIGNATURE 0x54524944 // "DIRT"
//
// Hive structure identifiers
//
@ -70,6 +81,19 @@
//
#define HTYPE_COUNT 2
//
// Hive boot types
//
#define HBOOT_TYPE_REGULAR 0
#define HBOOT_TYPE_SELF_HEAL 4
//
// Hive boot recover types
//
#define HBOOT_NO_BOOT_RECOVER 0
#define HBOOT_BOOT_RECOVERED_BY_HIVE_LOG 1
#define HBOOT_BOOT_RECOVERED_BY_ALTERNATE_HIVE 2
/**
* @name HCELL_INDEX
*