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 10import gdb 11 12from linux import utils 13from linux import constants 14 15def xa_is_internal(entry): 16 ulong_type = utils.get_ulong_type() 17 return ((entry.cast(ulong_type) & 3) == 2) 18 19def xa_mk_internal(v): 20 return ((v << 2) | 2) 21 22def xa_is_zero(entry): 23 ulong_type = utils.get_ulong_type() 24 return entry.cast(ulong_type) == xa_mk_internal(257) 25 26def xa_is_node(entry): 27 ulong_type = utils.get_ulong_type() 28 return xa_is_internal(entry) and (entry.cast(ulong_type) > 4096) 29