From: Dmitry Selyutin Date: Tue, 19 Sep 2023 17:13:21 +0000 (+0300) Subject: syscalls: support identifiers iteration X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3ffe6ea29fa0b840778b2be65b11ac79dda5d295;p=openpower-isa.git syscalls: support identifiers iteration --- diff --git a/src/openpower/syscalls/__init__.py b/src/openpower/syscalls/__init__.py index 053e45f3..569655d2 100644 --- a/src/openpower/syscalls/__init__.py +++ b/src/openpower/syscalls/__init__.py @@ -54,6 +54,12 @@ class Dispatcher: return super().__init__() + def __iter__(self): + identifiers = sorted(map(int, filter(str.isnumeric, self.__guest))) + for identifier in identifiers: + entry = self.__guest[str(identifier)][1][0] + yield (identifier, entry) + def __getitem__(self, identifier): if not isinstance(identifier, int): raise ValueError(identifier)