diff --git a/src/arch/micro_asm.py b/src/arch/micro_asm.py index 32dd79fdf..925e6b585 100644 --- a/src/arch/micro_asm.py +++ b/src/arch/micro_asm.py @@ -140,9 +140,9 @@ def handle_statement(parser, container, statement): raise try: for label in statement.labels: - container.labels[label.name] = microop + container.labels[label.text] = microop if label.extern: - container.externs[label.name] = microop + container.externs[label.text] = microop container.add_microop(microop) except: print_error("Error adding microop.") @@ -439,6 +439,11 @@ def p_labels_1(t): t[1].append(t[2]) t[0] = t[1] +# labels on lines by themselves are attached to the following instruction. +def p_labels_2(t): + 'labels : labels NEWLINE' + t[0] = t[1] + def p_label_0(t): 'label : ID COLON' label = Label() diff --git a/src/arch/x86/isa/insts/processor_information.py b/src/arch/x86/isa/insts/processor_information.py index f57bed494..4c18cb954 100644 --- a/src/arch/x86/isa/insts/processor_information.py +++ b/src/arch/x86/isa/insts/processor_information.py @@ -97,9 +97,10 @@ def macroop CPUID_R { # Standard functions. # +standardStart: # 0x00000000 -- Processor Vendor and Largest Standard Function Number -standardStart: limm rax, 0x00000001, dataSize=4 + limm rax, 0x00000001, dataSize=4 limm rbx, 0x68747541, dataSize=4 limm rdx, 0x69746e65, dataSize=4 limm rcx, 0x444d4163, dataSize=4 @@ -122,9 +123,10 @@ standardStart: limm rax, 0x00000001, dataSize=4 # Extended functions. # -# 0x80000000 -- Processor Vendor and Largest Extended Function Number +extendedStart: -extendedStart: limm rax, 0x80000018, dataSize=4 +# 0x80000000 -- Processor Vendor and Largest Extended Function Number + limm rax, 0x80000018, dataSize=4 limm rbx, 0x68747541, dataSize=4 limm rdx, 0x69746e65, dataSize=4 limm rcx, 0x444d4163, dataSize=4 @@ -400,6 +402,7 @@ extendedStart: limm rax, 0x80000018, dataSize=4 fault "NoFault" fault "NoFault" -end: fault "NoFault" +end: + fault "NoFault" }; ''' diff --git a/src/arch/x86/isa/macroop.isa b/src/arch/x86/isa/macroop.isa index 4675b9d56..fdfea6136 100644 --- a/src/arch/x86/isa/macroop.isa +++ b/src/arch/x86/isa/macroop.isa @@ -126,6 +126,8 @@ def template MacroDeclare {{ */ class %(class_name)s : public %(base_class)s { + private: + %(declareLabels)s public: // Constructor. %(class_name)s(ExtMachInst machInst, X86ISA::EmulEnv env); @@ -151,6 +153,9 @@ def template MacroConstructor {{ let {{ from micro_asm import Combinational_Macroop, Rom_Macroop class X86Macroop(Combinational_Macroop): + def add_microop(self, microop): + microop.micropc = len(self.microops) + self.microops.append(microop) def setAdjustEnv(self, val): self.adjust_env = val def __init__(self, name): @@ -166,7 +171,14 @@ let {{ def getDeclaration(self): #FIXME This first parameter should be the mnemonic. I need to #write some code which pulls that out - iop = InstObjParams(self.name, self.name, "Macroop", {"code" : ""}) + declareLabels = "" + for (label, microop) in self.labels.items(): + declareLabels += "const static uint64_t label_%s = %d;\n" \ + % (label, microop.micropc) + iop = InstObjParams(self.name, self.name, "Macroop", + {"code" : "", + "declareLabels" : declareLabels + }) return MacroDeclare.subst(iop); def getDefinition(self): #FIXME This first parameter should be the mnemonic. I need to