5.6.5 Reading a resource

The semantics of reading a resource are peek rather than architectural read. If possible, all instance implementations should try to achieve side-effect free reads. This is required for non-intrusive debug.

  • The resource_read() function supports reporting bits in registers with an undefined value. It is optional for instances to support this.

  • It is not always possible to return the exact value of a resource, for example when the instance that exposes the resource is not in a debuggable state. The resource_read() function supports reporting approximate values.

  • The resource_read() function does not fail with an error for existing resources that could not be read. Instead, such read errors are reported in the error member of ResourceReadResult, for each resource.

Examples

resource_read() returns one ResourceReadResult object, which contains the read result for all resources that were read, comprising values and errors. Numeric resource values and string resource values are split into two different arrays. Numeric resource values occupy one or more NumberU64 values in the array, depending on their width. For example:

  • Reading 3 32-bit resources with the values 1, 2, and 0xf00daaaa respectively:
    ResourceReadResult.data = [1, 2, 0xf00daaaa]
  • Reading one 8-bit, one 64-bit, and one 32-bit resource, with values 1, 2, and 3 respectively:
    ResourceReadResult.data = [1, 2, 3]
  • Reading one 132-bit wide resource which has the value 0x9_ffeeddcc_bbaa9988_77665544_33221100:
    ResourceReadResult.data = [0x7766554433221100, 0xffeeddccbbaa9988, 9]
  • Reading a string resource containing the string "abc":
    ResourceReadResult.data = [] 
    ResourceReadResult.strings = ["abc"]
  • Reading a 32-bit resource with value 1, a string resource with value "abc", and a 32-bit resource with value 3:

    ResourceReadResult.data = [1, 3]
    ResourceReadResult.strings = ["abc"]

    Note:

    The following resource_read() operations give the same result as this example:

    • Reading a string resource with value "abc", a 32-bit resource with value 1, and a 32-bit resource with value 3.
    • Reading a 32-bit resource with value 1, a 32-bit resource with value 3, and a string resource with value "abc".
  • Reading a 32-bit resource with value 1, a noValue resource, and a 32-bit resource with value 3:
     ResourceReadResult.data = [1, 3] 
Non-ConfidentialPDF file icon PDF version101196_0100_03_en
Copyright © 2018, 2019 Arm Limited or its affiliates. All rights reserved.