Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/56502 )
Change subject: arch-x86: Move 'initEnv' initialization into X86Macroop.
......................................................................
arch-x86: Move 'initEnv' initialization into X86Macroop.
Don't rely on the ISA description and cues from the emulation
environment to set this field when the macroop is emitted. This makes
the macroops more self contained.
Change-Id: I8cf5915b4823a00d8200f5b785ac04cf95f2c6cf
---
M src/arch/x86/insts/static_inst.cc
M src/arch/x86/isa/macroop.isa
M src/arch/x86/isa/specialize.isa
M src/arch/x86/ucasmlib/arch/x86/macroop.py
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/src/arch/x86/insts/static_inst.cc
b/src/arch/x86/insts/static_inst.cc
index 01e62f1..4874edb 100644
--- a/src/arch/x86/insts/static_inst.cc
+++ b/src/arch/x86/insts/static_inst.cc
@@ -156,7 +156,7 @@
switch (reg.classValue()) {
case IntRegClass:
{
- const char * suffix = "";
+ const char *suffix = "";
bool fold = reg_idx & IntFoldBit;
reg_idx &= ~IntFoldBit;
diff --git a/src/arch/x86/isa/macroop.isa b/src/arch/x86/isa/macroop.isa
index f356fdd..631cd4d 100644
--- a/src/arch/x86/isa/macroop.isa
+++ b/src/arch/x86/isa/macroop.isa
@@ -47,7 +47,6 @@
self.addressSize = "ADDRSIZE"
self.dataSize = "OPSIZE"
self.stackSize = "STACKSIZE"
- self.doModRM = False
self.firstArgument = True
self.useStackSize = False
self.memoryInst = False
@@ -99,18 +98,12 @@
}};
let {{
- doModRMString = "env.doModRM(machInst);\n"
- noModRMString = "env.setSeg(machInst);\n"
def genMacroop(Name, env):
blocks = OutputBlocks()
if not Name in macroopDict:
raise Exception("Unrecognized instruction: {}".format(Name))
macroop = macroopDict[Name]
if not macroop.declared:
- if env.doModRM:
- macroop.initEnv = doModRMString
- else:
- macroop.initEnv = noModRMString
blocks.header_output = macroop.getDeclaration()
blocks.decoder_output = macroop.getDefinition(env)
macroop.declared = True
diff --git a/src/arch/x86/isa/specialize.isa
b/src/arch/x86/isa/specialize.isa
index a74dd92..bf4331a 100644
--- a/src/arch/x86/isa/specialize.isa
+++ b/src/arch/x86/isa/specialize.isa
@@ -157,7 +157,6 @@
elif op_type.tag == 'M':
# This refers to memory. The macroop constructor sets up
modrm
# addressing. Non memory modrm settings should cause an
error.
- env.doModRM = True
return doSplitDecode('MODRM_MOD',
{'3' : doBadInstDecode()},
doRipRelativeDecode(Name, op_type_iter, env))
@@ -200,7 +199,6 @@
# modrm addressing.
mem_env = copy.copy(env)
- mem_env.doModRM = True
if op_type.tag == 'Q':
reg_format = 'ccprintf(out, "MMX%%d", %s);\n'
reg_suffix = '_MMX'
diff --git a/src/arch/x86/ucasmlib/arch/x86/macroop.py
b/src/arch/x86/ucasmlib/arch/x86/macroop.py
index d80c0cc..779ad3b 100644
--- a/src/arch/x86/ucasmlib/arch/x86/macroop.py
+++ b/src/arch/x86/ucasmlib/arch/x86/macroop.py
@@ -158,6 +158,9 @@
else:
raise ValueError(f'Unrecognized arg type "{arg}"')
+ if arg in ('M', 'P'):
+ self.init_env = "env.doModRM(machInst);"
+
self.name += f'_{arg}'
self.disassembly.append(code)
@@ -179,7 +182,7 @@
self.disassembly = []
self.declared = False
self.adjust_env = ""
- self.init_env = ""
+ self.init_env = "env.setSeg(machInst);"
self.adjust_imm = '[[maybe_unused]] uint64_t adjustedImm =
IMMEDIATE;'
self.adjust_disp = \
'[[maybe_unused]] uint64_t adjustedDisp = DISPLACEMENT;'
@@ -261,7 +264,7 @@
'adjust_disp' : self.adjust_disp,
'disassembly' : 'out << ", ";\n'.join(self.disassembly),
'reg_size' : reg_size,
- 'init_env' : self.initEnv
+ 'init_env' : self.init_env
}
return MacroConstructor.format(**subst) + \
MacroDisassembly.format(**subst)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/56502
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8cf5915b4823a00d8200f5b785ac04cf95f2c6cf
Gerrit-Change-Number: 56502
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s