pseudo_inst.cc (9457:a4739b6f799d) pseudo_inst.cc (9659:403a4d20799a)
1/*
1/*
2 * Copyright (c) 2010-2011 ARM Limited
2 * Copyright (c) 2010-2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

42 */
43
44#include <fcntl.h>
45#include <unistd.h>
46
47#include <cerrno>
48#include <fstream>
49#include <string>
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

42 */
43
44#include <fcntl.h>
45#include <unistd.h>
46
47#include <cerrno>
48#include <fstream>
49#include <string>
50#include <vector>
50
51#include "arch/kernel_stats.hh"
51
52#include "arch/kernel_stats.hh"
53#include "arch/utility.hh"
52#include "arch/vtophys.hh"
53#include "base/debug.hh"
54#include "base/output.hh"
55#include "config/the_isa.hh"
56#include "cpu/base.hh"
57#include "cpu/quiesce_event.hh"
58#include "cpu/thread_context.hh"
59#include "debug/Loader.hh"

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

78namespace PseudoInst {
79
80static inline void
81panicFsOnlyPseudoInst(const char *name)
82{
83 panic("Pseudo inst \"%s\" is only available in Full System mode.");
84}
85
54#include "arch/vtophys.hh"
55#include "base/debug.hh"
56#include "base/output.hh"
57#include "config/the_isa.hh"
58#include "cpu/base.hh"
59#include "cpu/quiesce_event.hh"
60#include "cpu/thread_context.hh"
61#include "debug/Loader.hh"

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

80namespace PseudoInst {
81
82static inline void
83panicFsOnlyPseudoInst(const char *name)
84{
85 panic("Pseudo inst \"%s\" is only available in Full System mode.");
86}
87
88uint64_t
89pseudoInst(ThreadContext *tc, uint8_t func, uint8_t subfunc)
90{
91 uint64_t args[4];
92
93 // We need to do this in a slightly convoluted way since
94 // getArgument() might have side-effects on arg_num. We could have
95 // used the Argument class, but due to the possible side effects
96 // from getArgument, it'd most likely break.
97 int arg_num(0);
98 for (int i = 0; i < sizeof(args) / sizeof(*args); ++i)
99 args[arg_num++] = getArgument(tc, arg_num, sizeof(uint64_t), false);
100
101 switch (func) {
102 case 0x00: // arm_func
103 arm(tc);
104 break;
105
106 case 0x01: // quiesce_func
107 quiesce(tc);
108 break;
109
110 case 0x02: // quiescens_func
111 quiesceSkip(tc);
112 break;
113
114 case 0x03: // quiescecycle_func
115 quiesceNs(tc, args[0]);
116 break;
117
118 case 0x04: // quiescetime_func
119 return quiesceTime(tc);
120
121 case 0x07: // rpns_func
122 return rpns(tc);
123
124 case 0x09: // wakecpu_func
125 wakeCPU(tc, args[0]);
126 break;
127
128 case 0x21: // exit_func
129 m5exit(tc, args[0]);
130 break;
131
132 case 0x30: // initparam_func
133 return initParam(tc);
134
135 case 0x31: // loadsymbol_func
136 loadsymbol(tc);
137 break;
138
139 case 0x40: // resetstats_func
140 resetstats(tc, args[0], args[1]);
141 break;
142
143 case 0x41: // dumpstats_func
144 dumpstats(tc, args[0], args[1]);
145 break;
146
147 case 0x42: // dumprststats_func
148 dumpresetstats(tc, args[0], args[1]);
149 break;
150
151 case 0x43: // ckpt_func
152 m5checkpoint(tc, args[0], args[1]);
153 break;
154
155 case 0x4f: // writefile_func
156 return writefile(tc, args[0], args[1], args[2], args[3]);
157
158 case 0x50: // readfile_func
159 return readfile(tc, args[0], args[1], args[2]);
160
161 case 0x51: // debugbreak_func
162 debugbreak(tc);
163 break;
164
165 case 0x52: // switchcpu_func
166 switchcpu(tc);
167 break;
168
169 case 0x53: // addsymbol_func
170 addsymbol(tc, args[0], args[1]);
171 break;
172
173 case 0x54: // panic_func
174 panic("M5 panic instruction called at %s\n", tc->pcState());
175
176 case 0x5a: // work_begin_func
177 workbegin(tc, args[0], args[1]);
178 break;
179
180 case 0x5b: // work_end_func
181 workend(tc, args[0], args[1]);
182 break;
183
184 case 0x55: // annotate_func
185 case 0x56: // reserved2_func
186 case 0x57: // reserved3_func
187 case 0x58: // reserved4_func
188 case 0x59: // reserved5_func
189 warn("Unimplemented m5 op (0x%x)\n", func);
190 break;
191
192 default:
193 warn("Unhandled m5 op: 0x%x\n", func);
194 break;
195 }
196
197 return 0;
198}
199
86void
87arm(ThreadContext *tc)
88{
89 if (!FullSystem)
90 panicFsOnlyPseudoInst("arm");
91
92 if (tc->getKernelStats())
93 tc->getKernelStats()->arm();

--- 467 unchanged lines hidden ---
200void
201arm(ThreadContext *tc)
202{
203 if (!FullSystem)
204 panicFsOnlyPseudoInst("arm");
205
206 if (tc->getKernelStats())
207 tc->getKernelStats()->arm();

--- 467 unchanged lines hidden ---