thread_state.hh (8793:5f25086326ac) thread_state.hh (8806:669e93d79ed9)
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;

--- 61 unchanged lines hidden (view full) ---

70 * thus able to be externally updated without squashing.
71 */
72 bool trapPending;
73
74 O3ThreadState(O3CPU *_cpu, int _thread_num, Process *_process)
75 : ThreadState(_cpu, _thread_num, _process),
76 cpu(_cpu), inSyscall(0), trapPending(0)
77 {
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;

--- 61 unchanged lines hidden (view full) ---

70 * thus able to be externally updated without squashing.
71 */
72 bool trapPending;
73
74 O3ThreadState(O3CPU *_cpu, int _thread_num, Process *_process)
75 : ThreadState(_cpu, _thread_num, _process),
76 cpu(_cpu), inSyscall(0), trapPending(0)
77 {
78 if (FullSystem) {
79 if (cpu->params()->profile) {
80 profile = new FunctionProfile(
81 cpu->params()->system->kernelSymtab);
82 Callback *cb =
83 new MakeCallback<O3ThreadState,
84 &O3ThreadState::dumpFuncProfile>(this);
85 registerExitCallback(cb);
86 }
78 if (!FullSystem)
79 return;
87
80
88 // let's fill with a dummy node for now so we don't get a segfault
89 // on the first cycle when there's no node available.
90 static ProfileNode dummyNode;
91 profileNode = &dummyNode;
92 profilePC = 3;
81 if (cpu->params()->profile) {
82 profile = new FunctionProfile(
83 cpu->params()->system->kernelSymtab);
84 Callback *cb =
85 new MakeCallback<O3ThreadState,
86 &O3ThreadState::dumpFuncProfile>(this);
87 registerExitCallback(cb);
93 }
88 }
89
90 // let's fill with a dummy node for now so we don't get a segfault
91 // on the first cycle when there's no node available.
92 static ProfileNode dummyNode;
93 profileNode = &dummyNode;
94 profilePC = 3;
94 }
95
96 /** Pointer to the ThreadContext of this thread. */
97 ThreadContext *tc;
98
99 /** Returns a pointer to the TC of this thread. */
100 ThreadContext *getTC() { return tc; }
101
102 /** Handles the syscall. */
103 void syscall(int64_t callnum) { process->syscall(callnum, tc); }
104
105 void dumpFuncProfile()
106 {
107 std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name()));
108 profile->dump(tc, *os);
109 }
110};
111
112#endif // __CPU_O3_THREAD_STATE_HH__
95 }
96
97 /** Pointer to the ThreadContext of this thread. */
98 ThreadContext *tc;
99
100 /** Returns a pointer to the TC of this thread. */
101 ThreadContext *getTC() { return tc; }
102
103 /** Handles the syscall. */
104 void syscall(int64_t callnum) { process->syscall(callnum, tc); }
105
106 void dumpFuncProfile()
107 {
108 std::ostream *os = simout.create(csprintf("profile.%s.dat", cpu->name()));
109 profile->dump(tc, *os);
110 }
111};
112
113#endif // __CPU_O3_THREAD_STATE_HH__