nativetrace.hh revision 6398
1/* 2 * Copyright (c) 2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Gabe Black 29 */ 30 31#ifndef __ARCH_ARM_NATIVETRACE_HH__ 32#define __ARCH_ARM_NATIVETRACE_HH__ 33 34#include "base/types.hh" 35#include "cpu/nativetrace.hh" 36 37namespace Trace { 38 39class ArmNativeTrace : public NativeTrace 40{ 41 public: 42 enum StateID { 43 STATE_R0, 44 STATE_R1, 45 STATE_R2, 46 STATE_R3, 47 STATE_R4, 48 STATE_R5, 49 STATE_R6, 50 STATE_R7, 51 STATE_R8, 52 STATE_R9, 53 STATE_R10, 54 STATE_R11, 55 STATE_FP = STATE_R11, 56 STATE_R12, 57 STATE_R13, 58 STATE_SP = STATE_R13, 59 STATE_R14, 60 STATE_LR = STATE_R14, 61 STATE_R15, 62 STATE_PC = STATE_R15, 63 STATE_CPSR, 64 STATE_NUMVALS 65 }; 66 67 protected: 68 struct ThreadState { 69 bool changed[STATE_NUMVALS]; 70 uint32_t state[2][STATE_NUMVALS]; 71 uint32_t *newState; 72 uint32_t *oldState; 73 int current; 74 void update(NativeTrace *parent); 75 void update(ThreadContext *tc); 76 77 ThreadState() 78 { 79 for (int i = 0; i < STATE_NUMVALS; i++) { 80 changed[i] = false; 81 state[0][i] = state[1][i] = 0; 82 current = 0; 83 newState = state[0]; 84 oldState = state[1]; 85 } 86 } 87 }; 88 89 ThreadState nState, mState; 90 91 public: 92 ArmNativeTrace(const Params *p) : NativeTrace(p) 93 {} 94 95 void check(NativeTraceRecord *record); 96}; 97 98} /* namespace Trace */ 99 100#endif // __ARCH_ARM_NATIVETRACE_HH__ 101