class PmmChecker
Defined at line 37 of file ../../zircon/kernel/vm/include/vm/pmm_checker.h
|PmmChecker| is used to detect memory corruption. It is logically part of |PmmNode|.
Usage is as follows:
PmmChecker checker;
// Check only the first 16 bytes of each page.
checker.SetFillSize(16);
// For all free pages...
for (...) {
checker.FillPattern(page);
}
// Now that all free pages have been filled with a pattern, we can arm the checker.
checker.Arm();
...
checker.AssertPattern(page);
Public Members
static CheckFailAction kDefaultAction
Public Methods
bool IsValidFillSize (size_t fill_size)
Returns true if |fill_size| is a valid value. Valid values are mutliples of 8 between 8 and
kPageSize, inclusive.
Defined at line 56 of file ../../zircon/kernel/vm/pmm_checker.cc
size_t GetFillSize ()
Returns the fill size.
Defined at line 57 of file ../../zircon/kernel/vm/include/vm/pmm_checker.h
void SetAction (CheckFailAction action)
Defined at line 59 of file ../../zircon/kernel/vm/include/vm/pmm_checker.h
CheckFailAction GetAction ()
Defined at line 60 of file ../../zircon/kernel/vm/include/vm/pmm_checker.h
void SetFillSize (size_t fill_size)
Sets the size of the pattern to be written / validated.
It is an error to call this method with an invalid fill size (see |IsValidFillSize|.
It is an error to call this method if the checker |IsArmed|. After changing the fill size, be
sure to re-fill any free pages to ensure that a future call to |ValidatePattern| or
|AssertPattern| won't supriously report corruption.
Defined at line 60 of file ../../zircon/kernel/vm/pmm_checker.cc
bool IsArmed ()
Returns true if armed.
Defined at line 63 of file ../../zircon/kernel/vm/include/vm/pmm_checker.h
void Arm ()
Defined at line 66 of file ../../zircon/kernel/vm/pmm_checker.cc
void PrintStatus (FILE * f)
Defined at line 105 of file ../../zircon/kernel/vm/pmm_checker.cc
void FillPattern (vm_page_t * page)
Fills |page| with a pattern.
Defined at line 68 of file ../../zircon/kernel/vm/pmm_checker.cc
bool ValidatePattern (vm_page_t * page)
Returns true if |page| contains the expected fill pattern or |IsArmed| is false.
Otherwise, returns false.
Defined at line 74 of file ../../zircon/kernel/vm/pmm_checker.cc
void AssertPattern (vm_page_t * page)
Panics the kernel if |page| does not contain the expected fill pattern and |IsArmed| is true.
Otherwise, does nothing.
Defined at line 90 of file ../../zircon/kernel/vm/pmm_checker.cc
int64_t get_validation_failed_count ()
Defined at line 112 of file ../../zircon/kernel/vm/pmm_checker.cc