class StateVmoBank

Defined at line 45 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h

Shared-memory VMO bank for exposing internal driver state/telemetry and

host-tunable fault-injection knobs over `fuchsia.driver.lab` without custom

FIDL changes (Spec Phase 2 Section 3.2).

Also supports optional registration with the process-wide C singleton

(`driver_lab_global_set_state_u32` / `driver_lab_global_get_knob_u32`) so

legacy `.c` translation units can read knobs and write telemetry in one line

of C without plumbing C++ pointers through vendor structs.

Public Members

static const size_t kDefaultSize

Public Methods

zx::result<StateVmoBank> Create (size_t size, bool register_global)

Allocates a zero-initialized `zx::vmo` of `size` bytes, maps it read/write

into the current process root VMAR, and optionally registers it as the

process-wide global C state bank.

Defined at line 19 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

void ~StateVmoBank ()

Defined at line 46 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

void StateVmoBank (StateVmoBank && other)

Defined at line 48 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

void StateVmoBank ()

Defined at line 54 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h

StateVmoBank & operator= (StateVmoBank && other)

Defined at line 54 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

void StateVmoBank (const StateVmoBank & )

Defined at line 60 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h

StateVmoBank & operator= (const StateVmoBank & )

Defined at line 61 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h

void SetState32 (uint32_t offset, uint32_t value)

Atomically writes a 32-bit telemetry/state word at `offset` (must be

4-byte aligned and within `[0, size() - 4]`).

Defined at line 85 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

uint32_t GetState32 (uint32_t offset, uint32_t default_value)

Atomically reads a 32-bit telemetry/state word at `offset`.

Defined at line 93 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

void SetKnob32 (uint32_t offset, uint32_t value)

Atomically writes a 32-bit knob word at `offset`.

Defined at line 101 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

uint32_t GetKnob32 (uint32_t offset, uint32_t default_value)

Atomically reads a 32-bit host-tunable knob word at `offset`.

Defined at line 103 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

void RegisterGlobal ()

Registers this bank's mapped buffer with `driver_lab_global_*` C helpers.

Defined at line 78 of file ../../src/devices/driver-lab/cpp/driver_lab.cc

zx::unowned_vmo vmo ()

Defined at line 79 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h

size_t size ()

Defined at line 80 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h

uint8_t * data ()

Defined at line 81 of file ../../src/devices/driver-lab/cpp/include/lib/driver_lab/driver_lab.h