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=b3d426282cafabd414ded35742b932d508f06782;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)