power_insn: support LK matching
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 1 Sep 2022 13:05:36 +0000 (16:05 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 2 Sep 2022 08:57:36 +0000 (11:57 +0300)
src/openpower/decoder/power_insn.py

index 2ab2da11275c44bb48660e9b16b5000d37bbb9bd..f0f476d7510921d721dac54c5f1e7bd5715a0bd3 100644 (file)
@@ -855,10 +855,20 @@ class PPCDatabase:
 
             return exact_match(key[:-1], record)
 
+        def LK_match(key, record):
+            if not key.endswith("l"):
+                return False
+
+            if "lk" not in record.flags:
+                return False
+
+            return exact_match(key[:-1], record)
+
         for (section, records) in self.__db.items():
             for record in records:
                 if (exact_match(key, record) or
-                        Rc_match(key, record)):
+                        Rc_match(key, record) or
+                        LK_match(key, record)):
                     return (section, record)
 
         return (None, None)