exetrace.cc revision 3584
12SN/A/* 21762SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan 32SN/A * All rights reserved. 42SN/A * 52SN/A * Redistribution and use in source and binary forms, with or without 62SN/A * modification, are permitted provided that the following conditions are 72SN/A * met: redistributions of source code must retain the above copyright 82SN/A * notice, this list of conditions and the following disclaimer; 92SN/A * redistributions in binary form must reproduce the above copyright 102SN/A * notice, this list of conditions and the following disclaimer in the 112SN/A * documentation and/or other materials provided with the distribution; 122SN/A * neither the name of the copyright holders nor the names of its 132SN/A * contributors may be used to endorse or promote products derived from 142SN/A * this software without specific prior written permission. 152SN/A * 162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu * 282665Ssaidi@eecs.umich.edu * Authors: Steve Reinhardt 292665Ssaidi@eecs.umich.edu * Lisa Hsu 302665Ssaidi@eecs.umich.edu * Nathan Binkert 312665Ssaidi@eecs.umich.edu * Steve Raasch 322SN/A */ 332SN/A 342SN/A#include <fstream> 352SN/A#include <iomanip> 363506Ssaidi@eecs.umich.edu#include <sys/ipc.h> 373506Ssaidi@eecs.umich.edu#include <sys/shm.h> 382SN/A 392973Sgblack@eecs.umich.edu#include "arch/regfile.hh" 403584Ssaidi@eecs.umich.edu#include "arch/utility.hh" 4156SN/A#include "base/loader/symtab.hh" 421717SN/A#include "cpu/base.hh" 432518SN/A#include "cpu/exetrace.hh" 4456SN/A#include "cpu/static_inst.hh" 452518SN/A#include "sim/param.hh" 462518SN/A#include "sim/system.hh" 472SN/A 483065Sgblack@eecs.umich.edu//XXX This is temporary 493065Sgblack@eecs.umich.edu#include "arch/isa_specific.hh" 503506Ssaidi@eecs.umich.edu#include "cpu/m5legion_interface.h" 513065Sgblack@eecs.umich.edu 522SN/Ausing namespace std; 532973Sgblack@eecs.umich.eduusing namespace TheISA; 542SN/A 553506Ssaidi@eecs.umich.edunamespace Trace { 563506Ssaidi@eecs.umich.eduSharedData *shared_data = NULL; 573506Ssaidi@eecs.umich.edu} 583506Ssaidi@eecs.umich.edu 592SN/A//////////////////////////////////////////////////////////////////////// 602SN/A// 612SN/A// Methods for the InstRecord object 622SN/A// 632SN/A 642SN/A 652SN/Avoid 662SN/ATrace::InstRecord::dump(ostream &outs) 672SN/A{ 682973Sgblack@eecs.umich.edu if (flags[PRINT_REG_DELTA]) 692973Sgblack@eecs.umich.edu { 703065Sgblack@eecs.umich.edu#if THE_ISA == SPARC_ISA 713506Ssaidi@eecs.umich.edu#if 0 723380Sgblack@eecs.umich.edu //Don't print what happens for each micro-op, just print out 733380Sgblack@eecs.umich.edu //once at the last op, and for regular instructions. 743380Sgblack@eecs.umich.edu if(!staticInst->isMicroOp() || staticInst->isLastMicroOp()) 753380Sgblack@eecs.umich.edu { 763380Sgblack@eecs.umich.edu static uint64_t regs[32] = { 773380Sgblack@eecs.umich.edu 0, 0, 0, 0, 0, 0, 0, 0, 783380Sgblack@eecs.umich.edu 0, 0, 0, 0, 0, 0, 0, 0, 793380Sgblack@eecs.umich.edu 0, 0, 0, 0, 0, 0, 0, 0, 803380Sgblack@eecs.umich.edu 0, 0, 0, 0, 0, 0, 0, 0}; 813380Sgblack@eecs.umich.edu static uint64_t ccr = 0; 823380Sgblack@eecs.umich.edu static uint64_t y = 0; 833380Sgblack@eecs.umich.edu static uint64_t floats[32]; 843380Sgblack@eecs.umich.edu uint64_t newVal; 853380Sgblack@eecs.umich.edu static const char * prefixes[4] = {"G", "O", "L", "I"}; 863065Sgblack@eecs.umich.edu 873380Sgblack@eecs.umich.edu char buf[256]; 883380Sgblack@eecs.umich.edu sprintf(buf, "PC = 0x%016llx", thread->readNextPC()); 893059Sgblack@eecs.umich.edu outs << buf; 903380Sgblack@eecs.umich.edu sprintf(buf, " NPC = 0x%016llx", thread->readNextNPC()); 913059Sgblack@eecs.umich.edu outs << buf; 923380Sgblack@eecs.umich.edu newVal = thread->readMiscReg(SparcISA::MISCREG_CCR); 933380Sgblack@eecs.umich.edu if(newVal != ccr) 943059Sgblack@eecs.umich.edu { 953380Sgblack@eecs.umich.edu sprintf(buf, " CCR = 0x%016llx", newVal); 963380Sgblack@eecs.umich.edu outs << buf; 973380Sgblack@eecs.umich.edu ccr = newVal; 983380Sgblack@eecs.umich.edu } 993380Sgblack@eecs.umich.edu newVal = thread->readMiscReg(SparcISA::MISCREG_Y); 1003380Sgblack@eecs.umich.edu if(newVal != y) 1013380Sgblack@eecs.umich.edu { 1023380Sgblack@eecs.umich.edu sprintf(buf, " Y = 0x%016llx", newVal); 1033380Sgblack@eecs.umich.edu outs << buf; 1043380Sgblack@eecs.umich.edu y = newVal; 1053380Sgblack@eecs.umich.edu } 1063380Sgblack@eecs.umich.edu for(int y = 0; y < 4; y++) 1073380Sgblack@eecs.umich.edu { 1083380Sgblack@eecs.umich.edu for(int x = 0; x < 8; x++) 1093059Sgblack@eecs.umich.edu { 1103380Sgblack@eecs.umich.edu int index = x + 8 * y; 1113380Sgblack@eecs.umich.edu newVal = thread->readIntReg(index); 1123380Sgblack@eecs.umich.edu if(regs[index] != newVal) 1133380Sgblack@eecs.umich.edu { 1143380Sgblack@eecs.umich.edu sprintf(buf, " %s%d = 0x%016llx", prefixes[y], x, newVal); 1153380Sgblack@eecs.umich.edu outs << buf; 1163380Sgblack@eecs.umich.edu regs[index] = newVal; 1173380Sgblack@eecs.umich.edu } 1183059Sgblack@eecs.umich.edu } 1193059Sgblack@eecs.umich.edu } 1203380Sgblack@eecs.umich.edu for(int y = 0; y < 32; y++) 1213380Sgblack@eecs.umich.edu { 1223380Sgblack@eecs.umich.edu newVal = thread->readFloatRegBits(2 * y, 64); 1233380Sgblack@eecs.umich.edu if(floats[y] != newVal) 1243380Sgblack@eecs.umich.edu { 1253380Sgblack@eecs.umich.edu sprintf(buf, " F%d = 0x%016llx", 2 * y, newVal); 1263380Sgblack@eecs.umich.edu outs << buf; 1273380Sgblack@eecs.umich.edu floats[y] = newVal; 1283380Sgblack@eecs.umich.edu } 1293380Sgblack@eecs.umich.edu } 1303380Sgblack@eecs.umich.edu outs << endl; 1313059Sgblack@eecs.umich.edu } 1323065Sgblack@eecs.umich.edu#endif 1333506Ssaidi@eecs.umich.edu#endif 1342973Sgblack@eecs.umich.edu } 1352973Sgblack@eecs.umich.edu else if (flags[INTEL_FORMAT]) { 1361968SN/A#if FULL_SYSTEM 1373064Sgblack@eecs.umich.edu bool is_trace_system = (thread->getCpuPtr()->system->name() == trace_system); 1381968SN/A#else 1391968SN/A bool is_trace_system = true; 1401968SN/A#endif 1411968SN/A if (is_trace_system) { 1421967SN/A ccprintf(outs, "%7d ) ", cycle); 1431967SN/A outs << "0x" << hex << PC << ":\t"; 1441967SN/A if (staticInst->isLoad()) { 1451967SN/A outs << "<RD 0x" << hex << addr; 1461967SN/A outs << ">"; 1471967SN/A } else if (staticInst->isStore()) { 1481967SN/A outs << "<WR 0x" << hex << addr; 1491967SN/A outs << ">"; 1501967SN/A } 1511967SN/A outs << endl; 1521904SN/A } 1531904SN/A } else { 1541904SN/A if (flags[PRINT_CYCLE]) 1551904SN/A ccprintf(outs, "%7d: ", cycle); 156452SN/A 1573064Sgblack@eecs.umich.edu outs << thread->getCpuPtr()->name() << " "; 1582SN/A 1591904SN/A if (flags[TRACE_MISSPEC]) 1601904SN/A outs << (misspeculating ? "-" : "+") << " "; 1612SN/A 1621904SN/A if (flags[PRINT_THREAD_NUM]) 1633064Sgblack@eecs.umich.edu outs << "T" << thread->getThreadNum() << " : "; 1642SN/A 1652SN/A 1661904SN/A std::string sym_str; 1671904SN/A Addr sym_addr; 1681904SN/A if (debugSymbolTable 1692299SN/A && debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr) 1702299SN/A && flags[PC_SYMBOL]) { 1711904SN/A if (PC != sym_addr) 1721904SN/A sym_str += csprintf("+%d", PC - sym_addr); 1731904SN/A outs << "@" << sym_str << " : "; 1741904SN/A } 1751904SN/A else { 1761904SN/A outs << "0x" << hex << PC << " : "; 1771904SN/A } 178452SN/A 1791904SN/A // 1801904SN/A // Print decoded instruction 1811904SN/A // 1822SN/A 1832SN/A#if defined(__GNUC__) && (__GNUC__ < 3) 1841904SN/A // There's a bug in gcc 2.x library that prevents setw() 1851904SN/A // from working properly on strings 1861904SN/A string mc(staticInst->disassemble(PC, debugSymbolTable)); 1871904SN/A while (mc.length() < 26) 1881904SN/A mc += " "; 1891904SN/A outs << mc; 1902SN/A#else 1911904SN/A outs << setw(26) << left << staticInst->disassemble(PC, debugSymbolTable); 1922SN/A#endif 1932SN/A 1941904SN/A outs << " : "; 1952SN/A 1961904SN/A if (flags[PRINT_OP_CLASS]) { 1971904SN/A outs << opClassStrings[staticInst->opClass()] << " : "; 1981904SN/A } 1991904SN/A 2001904SN/A if (flags[PRINT_RESULT_DATA] && data_status != DataInvalid) { 2011904SN/A outs << " D="; 2021904SN/A#if 0 2031904SN/A if (data_status == DataDouble) 2041904SN/A ccprintf(outs, "%f", data.as_double); 2051904SN/A else 2061904SN/A ccprintf(outs, "%#018x", data.as_int); 2071904SN/A#else 2081904SN/A ccprintf(outs, "%#018x", data.as_int); 2091904SN/A#endif 2101904SN/A } 2111904SN/A 2121904SN/A if (flags[PRINT_EFF_ADDR] && addr_valid) 2131904SN/A outs << " A=0x" << hex << addr; 2141904SN/A 2151904SN/A if (flags[PRINT_INT_REGS] && regs_valid) { 2162525SN/A for (int i = 0; i < TheISA::NumIntRegs;) 2171904SN/A for (int j = i + 1; i <= j; i++) 2182525SN/A ccprintf(outs, "r%02d = %#018x%s", i, 2192525SN/A iregs->regs.readReg(i), 2202525SN/A ((i == j) ? "\n" : " ")); 2211904SN/A outs << "\n"; 2221904SN/A } 2231904SN/A 2241904SN/A if (flags[PRINT_FETCH_SEQ] && fetch_seq_valid) 2251904SN/A outs << " FetchSeq=" << dec << fetch_seq; 2261904SN/A 2271904SN/A if (flags[PRINT_CP_SEQ] && cp_seq_valid) 2281904SN/A outs << " CPSeq=" << dec << cp_seq; 2291967SN/A 2301967SN/A // 2311967SN/A // End of line... 2321967SN/A // 2331967SN/A outs << endl; 2342SN/A } 2353584Ssaidi@eecs.umich.edu#if THE_ISA == SPARC_ISA 2363506Ssaidi@eecs.umich.edu // Compare 2373506Ssaidi@eecs.umich.edu if (flags[LEGION_LOCKSTEP]) 2383506Ssaidi@eecs.umich.edu { 2393506Ssaidi@eecs.umich.edu bool compared = false; 2403506Ssaidi@eecs.umich.edu bool diffPC = false; 2413506Ssaidi@eecs.umich.edu bool diffInst = false; 2423506Ssaidi@eecs.umich.edu bool diffRegs = false; 2433506Ssaidi@eecs.umich.edu 2443584Ssaidi@eecs.umich.edu if(!staticInst->isMicroOp() || staticInst->isLastMicroOp()) { 2453584Ssaidi@eecs.umich.edu while (!compared) { 2463584Ssaidi@eecs.umich.edu if (shared_data->flags == OWN_M5) { 2473584Ssaidi@eecs.umich.edu if (shared_data->pc != PC) 2483584Ssaidi@eecs.umich.edu diffPC = true; 2493584Ssaidi@eecs.umich.edu if (shared_data->instruction != staticInst->machInst) 2503584Ssaidi@eecs.umich.edu diffInst = true; 2513584Ssaidi@eecs.umich.edu for (int i = 0; i < TheISA::NumIntRegs; i++) { 2523584Ssaidi@eecs.umich.edu if (thread->readIntReg(i) != shared_data->intregs[i]) 2533584Ssaidi@eecs.umich.edu diffRegs = true; 2543584Ssaidi@eecs.umich.edu } 2553584Ssaidi@eecs.umich.edu 2563584Ssaidi@eecs.umich.edu if (diffPC || diffInst || diffRegs ) { 2573584Ssaidi@eecs.umich.edu outs << "Differences found between M5 and Legion:"; 2583584Ssaidi@eecs.umich.edu if (diffPC) 2593584Ssaidi@eecs.umich.edu outs << " [PC]"; 2603584Ssaidi@eecs.umich.edu if (diffInst) 2613584Ssaidi@eecs.umich.edu outs << " [Instruction]"; 2623584Ssaidi@eecs.umich.edu if (diffRegs) 2633584Ssaidi@eecs.umich.edu outs << " [IntRegs]"; 2643584Ssaidi@eecs.umich.edu outs << endl << endl;; 2653584Ssaidi@eecs.umich.edu 2663584Ssaidi@eecs.umich.edu outs << setfill(' ') << setw(15) 2673584Ssaidi@eecs.umich.edu << "M5 PC: " << "0x"<< setw(16) << setfill('0') 2683584Ssaidi@eecs.umich.edu << hex << PC << endl; 2693584Ssaidi@eecs.umich.edu outs << setfill(' ') << setw(15) 2703584Ssaidi@eecs.umich.edu << "Legion PC: " << "0x"<< setw(16) << setfill('0') << hex 2713584Ssaidi@eecs.umich.edu << shared_data->pc << endl << endl; 2723584Ssaidi@eecs.umich.edu 2733584Ssaidi@eecs.umich.edu outs << setfill(' ') << setw(15) 2743584Ssaidi@eecs.umich.edu << "M5 Inst: " << "0x"<< setw(8) 2753584Ssaidi@eecs.umich.edu << setfill('0') << hex << staticInst->machInst 2763584Ssaidi@eecs.umich.edu << staticInst->disassemble(PC, debugSymbolTable) 2773584Ssaidi@eecs.umich.edu << endl; 2783584Ssaidi@eecs.umich.edu 2793584Ssaidi@eecs.umich.edu StaticInstPtr legionInst = StaticInst::decode(makeExtMI(shared_data->instruction, thread)); 2803584Ssaidi@eecs.umich.edu outs << setfill(' ') << setw(15) 2813584Ssaidi@eecs.umich.edu << " Legion Inst: " 2823584Ssaidi@eecs.umich.edu << "0x" << setw(8) << setfill('0') << hex 2833584Ssaidi@eecs.umich.edu << shared_data->instruction 2843584Ssaidi@eecs.umich.edu << legionInst->disassemble(shared_data->pc, debugSymbolTable) 2853584Ssaidi@eecs.umich.edu << endl; 2863584Ssaidi@eecs.umich.edu 2873584Ssaidi@eecs.umich.edu outs << endl; 2883584Ssaidi@eecs.umich.edu 2893584Ssaidi@eecs.umich.edu static const char * regtypes[4] = {"%g", "%o", "%l", "%i"}; 2903584Ssaidi@eecs.umich.edu for(int y = 0; y < 4; y++) 2913584Ssaidi@eecs.umich.edu { 2923584Ssaidi@eecs.umich.edu for(int x = 0; x < 8; x++) 2933584Ssaidi@eecs.umich.edu { 2943584Ssaidi@eecs.umich.edu outs << regtypes[y] << x << " " ; 2953584Ssaidi@eecs.umich.edu outs << "0x" << hex << setw(16) << thread->readIntReg(y*8+x); 2963584Ssaidi@eecs.umich.edu if (thread->readIntReg(y*8 + x) != shared_data->intregs[y*8+x]) 2973584Ssaidi@eecs.umich.edu outs << " X "; 2983584Ssaidi@eecs.umich.edu else 2993584Ssaidi@eecs.umich.edu outs << " | "; 3003584Ssaidi@eecs.umich.edu outs << "0x" << setw(16) << hex << shared_data->intregs[y*8+x] 3013584Ssaidi@eecs.umich.edu << endl; 3023584Ssaidi@eecs.umich.edu } 3033584Ssaidi@eecs.umich.edu } 3043584Ssaidi@eecs.umich.edu fatal("Differences found between Legion and M5\n"); 3053584Ssaidi@eecs.umich.edu } 3063584Ssaidi@eecs.umich.edu 3073584Ssaidi@eecs.umich.edu compared = true; 3083584Ssaidi@eecs.umich.edu shared_data->flags = OWN_LEGION; 3093506Ssaidi@eecs.umich.edu } 3103584Ssaidi@eecs.umich.edu } // while 3113584Ssaidi@eecs.umich.edu } // if not microop 3123506Ssaidi@eecs.umich.edu } 3133584Ssaidi@eecs.umich.edu#endif 3142SN/A} 3152SN/A 3162SN/A 3172SN/Avector<bool> Trace::InstRecord::flags(NUM_BITS); 3181967SN/Astring Trace::InstRecord::trace_system; 3192SN/A 3202SN/A//////////////////////////////////////////////////////////////////////// 3212SN/A// 3222SN/A// Parameter space for per-cycle execution address tracing options. 3232SN/A// Derive from ParamContext so we can override checkParams() function. 3242SN/A// 3252SN/Aclass ExecutionTraceParamContext : public ParamContext 3262SN/A{ 3272SN/A public: 3282SN/A ExecutionTraceParamContext(const string &_iniSection) 3292SN/A : ParamContext(_iniSection) 3302SN/A { 3312SN/A } 3322SN/A 3332SN/A void checkParams(); // defined at bottom of file 3342SN/A}; 3352SN/A 3362SN/AExecutionTraceParamContext exeTraceParams("exetrace"); 3372SN/A 3382SN/AParam<bool> exe_trace_spec(&exeTraceParams, "speculative", 3391413SN/A "capture speculative instructions", true); 3402SN/A 3412SN/AParam<bool> exe_trace_print_cycle(&exeTraceParams, "print_cycle", 3422SN/A "print cycle number", true); 3432SN/AParam<bool> exe_trace_print_opclass(&exeTraceParams, "print_opclass", 3442SN/A "print op class", true); 3452SN/AParam<bool> exe_trace_print_thread(&exeTraceParams, "print_thread", 3462SN/A "print thread number", true); 3472SN/AParam<bool> exe_trace_print_effaddr(&exeTraceParams, "print_effaddr", 3482SN/A "print effective address", true); 3492SN/AParam<bool> exe_trace_print_data(&exeTraceParams, "print_data", 3502SN/A "print result data", true); 3512SN/AParam<bool> exe_trace_print_iregs(&exeTraceParams, "print_iregs", 3522SN/A "print all integer regs", false); 3532SN/AParam<bool> exe_trace_print_fetchseq(&exeTraceParams, "print_fetchseq", 3542SN/A "print fetch sequence number", false); 3552SN/AParam<bool> exe_trace_print_cp_seq(&exeTraceParams, "print_cpseq", 3562SN/A "print correct-path sequence number", false); 3572973Sgblack@eecs.umich.eduParam<bool> exe_trace_print_reg_delta(&exeTraceParams, "print_reg_delta", 3582973Sgblack@eecs.umich.edu "print which registers changed to what", false); 3592299SN/AParam<bool> exe_trace_pc_symbol(&exeTraceParams, "pc_symbol", 3602299SN/A "Use symbols for the PC if available", true); 3611904SN/AParam<bool> exe_trace_intel_format(&exeTraceParams, "intel_format", 3621904SN/A "print trace in intel compatible format", false); 3633506Ssaidi@eecs.umich.eduParam<bool> exe_trace_legion_lockstep(&exeTraceParams, "legion_lockstep", 3643506Ssaidi@eecs.umich.edu "Compare sim state to legion state every cycle", 3653506Ssaidi@eecs.umich.edu false); 3661967SN/AParam<string> exe_trace_system(&exeTraceParams, "trace_system", 3671967SN/A "print trace of which system (client or server)", 3681967SN/A "client"); 3691904SN/A 3702SN/A 3712SN/A// 3722SN/A// Helper function for ExecutionTraceParamContext::checkParams() just 3732SN/A// to get us into the InstRecord namespace 3742SN/A// 3752SN/Avoid 3762SN/ATrace::InstRecord::setParams() 3772SN/A{ 3782SN/A flags[TRACE_MISSPEC] = exe_trace_spec; 3792SN/A 3802SN/A flags[PRINT_CYCLE] = exe_trace_print_cycle; 3812SN/A flags[PRINT_OP_CLASS] = exe_trace_print_opclass; 3822SN/A flags[PRINT_THREAD_NUM] = exe_trace_print_thread; 3832SN/A flags[PRINT_RESULT_DATA] = exe_trace_print_effaddr; 3842SN/A flags[PRINT_EFF_ADDR] = exe_trace_print_data; 3852SN/A flags[PRINT_INT_REGS] = exe_trace_print_iregs; 3862SN/A flags[PRINT_FETCH_SEQ] = exe_trace_print_fetchseq; 3872SN/A flags[PRINT_CP_SEQ] = exe_trace_print_cp_seq; 3882973Sgblack@eecs.umich.edu flags[PRINT_REG_DELTA] = exe_trace_print_reg_delta; 3892299SN/A flags[PC_SYMBOL] = exe_trace_pc_symbol; 3901904SN/A flags[INTEL_FORMAT] = exe_trace_intel_format; 3913506Ssaidi@eecs.umich.edu flags[LEGION_LOCKSTEP] = exe_trace_legion_lockstep; 3921967SN/A trace_system = exe_trace_system; 3933506Ssaidi@eecs.umich.edu 3943506Ssaidi@eecs.umich.edu // If were going to be in lockstep with Legion 3953506Ssaidi@eecs.umich.edu // Setup shared memory, and get otherwise ready 3963506Ssaidi@eecs.umich.edu if (flags[LEGION_LOCKSTEP]) { 3973506Ssaidi@eecs.umich.edu int shmfd = shmget(getuid(), sizeof(SharedData), 0777); 3983506Ssaidi@eecs.umich.edu if (shmfd < 0) 3993506Ssaidi@eecs.umich.edu fatal("Couldn't get shared memory fd. Is Legion running?"); 4003506Ssaidi@eecs.umich.edu 4013506Ssaidi@eecs.umich.edu shared_data = (SharedData*)shmat(shmfd, NULL, SHM_RND); 4023506Ssaidi@eecs.umich.edu if (shared_data == (SharedData*)-1) 4033506Ssaidi@eecs.umich.edu fatal("Couldn't allocate shared memory"); 4043506Ssaidi@eecs.umich.edu 4053506Ssaidi@eecs.umich.edu if (shared_data->flags != OWN_M5) 4063506Ssaidi@eecs.umich.edu fatal("Shared memory has invalid owner"); 4073506Ssaidi@eecs.umich.edu 4083506Ssaidi@eecs.umich.edu if (shared_data->version != VERSION) 4093506Ssaidi@eecs.umich.edu fatal("Shared Data is wrong version! M5: %d Legion: %d", VERSION, 4103506Ssaidi@eecs.umich.edu shared_data->version); 4113506Ssaidi@eecs.umich.edu 4123506Ssaidi@eecs.umich.edu } 4132SN/A} 4142SN/A 4152SN/Avoid 4162SN/AExecutionTraceParamContext::checkParams() 4172SN/A{ 4182SN/A Trace::InstRecord::setParams(); 4192SN/A} 4202SN/A 421