From: Luke Kenneth Casson Leighton Date: Mon, 17 May 2021 13:04:24 +0000 (+0100) Subject: must not add to read regs unless in the authorised list X-Git-Tag: xlen-bcd~606 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6969e56933164c46a5aa6ffd68601ead5b3d4ad9;p=openpower-isa.git must not add to read regs unless in the authorised list --- diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index acbfc942..763b0ace 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -73,7 +73,7 @@ REG_SORT_ORDER = { "MSR": 0, "SVSTATE": 0, - "overflow": 1, + "overflow": 1, # should definitely be last } fregs = ['FRA', 'FRB', 'FRC', 'FRS', 'FRT'] @@ -81,7 +81,7 @@ fregs = ['FRA', 'FRB', 'FRC', 'FRS', 'FRT'] def create_args(reglist, extra=None): retval = list(OrderedSet(reglist)) - retval.sort(key=lambda reg: REG_SORT_ORDER[reg]) + retval.sort(key=lambda reg: REG_SORT_ORDER.get(reg, 0)) if extra is not None: return [extra] + retval return retval diff --git a/src/openpower/decoder/pseudo/parser.py b/src/openpower/decoder/pseudo/parser.py index 3428d27c..d403a089 100644 --- a/src/openpower/decoder/pseudo/parser.py +++ b/src/openpower/decoder/pseudo/parser.py @@ -425,7 +425,8 @@ class PowerParser: idx = p[1].args[0].id ridx = ast.Name("_%s" % idx, ast.Load()) p[1] = ast.Subscript(p[1].func, ridx, ast.Load()) - self.read_regs.add(idx) # add to list of regs to read + if idx in self.gprs: + self.read_regs.add(idx) # add to list of regs to read elif isinstance(p[1], ast.Call) and p[1].func.id == 'MEM': print("mem assign") print(astor.dump_tree(p[1]))