nativetrace.hh revision 8229
16365Sgblack@eecs.umich.edu/* 26365Sgblack@eecs.umich.edu * Copyright (c) 2007-2009 The Regents of The University of Michigan 36365Sgblack@eecs.umich.edu * All rights reserved. 46365Sgblack@eecs.umich.edu * 56365Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without 66365Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are 76365Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright 86365Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer; 96365Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright 106365Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the 116365Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution; 126365Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its 136365Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from 146365Sgblack@eecs.umich.edu * this software without specific prior written permission. 156365Sgblack@eecs.umich.edu * 166365Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 176365Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 186365Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 196365Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 206365Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 216365Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 226365Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 236365Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 246365Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 256365Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 266365Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 276365Sgblack@eecs.umich.edu * 286365Sgblack@eecs.umich.edu * Authors: Gabe Black 296365Sgblack@eecs.umich.edu */ 306365Sgblack@eecs.umich.edu 316365Sgblack@eecs.umich.edu#ifndef __ARCH_X86_NATIVETRACE_HH__ 326365Sgblack@eecs.umich.edu#define __ARCH_X86_NATIVETRACE_HH__ 336365Sgblack@eecs.umich.edu 346365Sgblack@eecs.umich.edu#include "base/types.hh" 356365Sgblack@eecs.umich.edu#include "cpu/nativetrace.hh" 366365Sgblack@eecs.umich.edu 376365Sgblack@eecs.umich.educlass ThreadContext; 386365Sgblack@eecs.umich.edu 396365Sgblack@eecs.umich.edunamespace Trace { 406365Sgblack@eecs.umich.edu 416365Sgblack@eecs.umich.educlass X86NativeTrace : public NativeTrace 426365Sgblack@eecs.umich.edu{ 436365Sgblack@eecs.umich.edu protected: 446365Sgblack@eecs.umich.edu bool checkRcx; 456365Sgblack@eecs.umich.edu bool checkR11; 466365Sgblack@eecs.umich.edu uint64_t oldRcxVal, oldR11Val; 476365Sgblack@eecs.umich.edu uint64_t oldRealRcxVal, oldRealR11Val; 486365Sgblack@eecs.umich.edu 496365Sgblack@eecs.umich.edu struct ThreadState { 506365Sgblack@eecs.umich.edu uint64_t rax; 516365Sgblack@eecs.umich.edu uint64_t rcx; 526365Sgblack@eecs.umich.edu uint64_t rdx; 536365Sgblack@eecs.umich.edu uint64_t rbx; 546365Sgblack@eecs.umich.edu uint64_t rsp; 556365Sgblack@eecs.umich.edu uint64_t rbp; 566365Sgblack@eecs.umich.edu uint64_t rsi; 576365Sgblack@eecs.umich.edu uint64_t rdi; 586365Sgblack@eecs.umich.edu uint64_t r8; 596365Sgblack@eecs.umich.edu uint64_t r9; 606365Sgblack@eecs.umich.edu uint64_t r10; 616365Sgblack@eecs.umich.edu uint64_t r11; 626365Sgblack@eecs.umich.edu uint64_t r12; 636365Sgblack@eecs.umich.edu uint64_t r13; 646365Sgblack@eecs.umich.edu uint64_t r14; 656365Sgblack@eecs.umich.edu uint64_t r15; 666365Sgblack@eecs.umich.edu uint64_t rip; 676365Sgblack@eecs.umich.edu //This should be expanded to 16 if x87 registers are considered 686365Sgblack@eecs.umich.edu uint64_t mmx[8]; 696365Sgblack@eecs.umich.edu uint64_t xmm[32]; 706365Sgblack@eecs.umich.edu 716365Sgblack@eecs.umich.edu void update(NativeTrace *parent); 726365Sgblack@eecs.umich.edu void update(ThreadContext *tc); 736365Sgblack@eecs.umich.edu }; 746365Sgblack@eecs.umich.edu 756365Sgblack@eecs.umich.edu ThreadState nState; 766365Sgblack@eecs.umich.edu ThreadState mState; 776365Sgblack@eecs.umich.edu 786365Sgblack@eecs.umich.edu bool checkRcxReg(const char * regName, uint64_t &, uint64_t &); 796365Sgblack@eecs.umich.edu bool checkR11Reg(const char * regName, uint64_t &, uint64_t &); 806365Sgblack@eecs.umich.edu bool checkXMM(int num, uint64_t mXmmBuf[], uint64_t nXmmBuf[]); 816365Sgblack@eecs.umich.edu 826365Sgblack@eecs.umich.edu public: 836365Sgblack@eecs.umich.edu X86NativeTrace(const Params *p); 846365Sgblack@eecs.umich.edu 856365Sgblack@eecs.umich.edu void check(NativeTraceRecord *record); 866365Sgblack@eecs.umich.edu}; 876365Sgblack@eecs.umich.edu 887811Ssteve.reinhardt@amd.com} // namespace Trace 896365Sgblack@eecs.umich.edu 906365Sgblack@eecs.umich.edu#endif // __ARCH_X86_NATIVETRACE_HH__ 91