xarray.py 636 B

12345678910111213141516171819202122232425262728
  1. # SPDX-License-Identifier: GPL-2.0
  2. #
  3. # Xarray helpers
  4. #
  5. # Copyright (c) 2025 Broadcom
  6. #
  7. # Authors:
  8. # Florian Fainelli <florian.fainelli@broadcom.com>
  9. import gdb
  10. from linux import utils
  11. from linux import constants
  12. def xa_is_internal(entry):
  13. ulong_type = utils.get_ulong_type()
  14. return ((entry.cast(ulong_type) & 3) == 2)
  15. def xa_mk_internal(v):
  16. return ((v << 2) | 2)
  17. def xa_is_zero(entry):
  18. ulong_type = utils.get_ulong_type()
  19. return entry.cast(ulong_type) == xa_mk_internal(257)
  20. def xa_is_node(entry):
  21. ulong_type = utils.get_ulong_type()
  22. return xa_is_internal(entry) and (entry.cast(ulong_type) > 4096)