From 8afd75d7b5e15d75f236166cbff57fdff8da59c7 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Fri, 20 Oct 2023 20:15:12 +0300 Subject: [PATCH] isa/caller: refactor sc logic --- src/openpower/decoder/isa/caller.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index 0c9b0e60..84456c26 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -1957,18 +1957,6 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): log("call", ins_name, asmop, kind=LogKind.InstrInOuts) - if asmop in ("sc", "scv"): - if self.syscall is not None: - identifier = self.gpr(0) - arguments = map(self.gpr, range(3, 9)) - result = self.syscall(identifier, *arguments) - self.gpr.write(3, result, False, self.namespace["XLEN"]) - self.update_pc_next() - return - else: - self.call_trap(0x700, PIb.ILLEG) - return - # sv.setvl is *not* a loop-function. sigh log("is_svp64_mode", self.is_svp64_mode, asmop) @@ -2065,6 +2053,13 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): self.update_pc_next() return + # Usermode system call emulation + if asmop in ("sc", "scv") and self.syscall is not None: + identifier = self.gpr(0) + arguments = map(self.gpr, range(3, 9)) + result = self.syscall(identifier, *arguments) + self.gpr.write(3, result, False, self.namespace["XLEN"]) + # get elwidths, defaults to 64 xlen = 64 ew_src = 64 -- 2.30.2