thread_context.hh (2682:52ac6338355d) thread_context.hh (2683:d6b72bb2ed97)
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;

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

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
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;

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

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
29#ifndef __CPU_CHECKER_EXEC_CONTEXT_HH__
30#define __CPU_CHECKER_EXEC_CONTEXT_HH__
29#ifndef __CPU_CHECKER_THREAD_CONTEXT_HH__
30#define __CPU_CHECKER_THREAD_CONTEXT_HH__
31
32#include "cpu/checker/cpu.hh"
31
32#include "cpu/checker/cpu.hh"
33#include "cpu/cpu_exec_context.hh"
33#include "cpu/simple_thread.hh"
34#include "cpu/thread_context.hh"
35
36class EndQuiesceEvent;
37namespace Kernel {
38 class Statistics;
39};
40
41/**
42 * Derived ThreadContext class for use with the Checker. The template
43 * parameter is the ThreadContext class used by the specific CPU being
34#include "cpu/thread_context.hh"
35
36class EndQuiesceEvent;
37namespace Kernel {
38 class Statistics;
39};
40
41/**
42 * Derived ThreadContext class for use with the Checker. The template
43 * parameter is the ThreadContext class used by the specific CPU being
44 * verified. This CheckerThreadContext is then used by the main CPU in
45 * place of its usual ThreadContext class. It handles updating the
46 * checker's state any time state is updated through the ThreadContext.
44 * verified. This CheckerThreadContext is then used by the main CPU
45 * in place of its usual ThreadContext class. It handles updating the
46 * checker's state any time state is updated externally through the
47 * ThreadContext.
47 */
48template <class TC>
49class CheckerThreadContext : public ThreadContext
50{
51 public:
52 CheckerThreadContext(TC *actual_tc,
48 */
49template <class TC>
50class CheckerThreadContext : public ThreadContext
51{
52 public:
53 CheckerThreadContext(TC *actual_tc,
53 CheckerCPU *checker_cpu)
54 : actualTC(actual_tc), checkerTC(checker_cpu->cpuXC),
54 CheckerCPU *checker_cpu)
55 : actualTC(actual_tc), checkerTC(checker_cpu->thread),
55 checkerCPU(checker_cpu)
56 { }
57
58 private:
56 checkerCPU(checker_cpu)
57 { }
58
59 private:
60 /** The main CPU's ThreadContext, or class that implements the
61 * ThreadContext interface. */
59 TC *actualTC;
62 TC *actualTC;
60 CPUExecContext *checkerTC;
63 /** The checker's own SimpleThread. Will be updated any time
64 * anything uses this ThreadContext to externally update a
65 * thread's state. */
66 SimpleThread *checkerTC;
67 /** Pointer to the checker CPU. */
61 CheckerCPU *checkerCPU;
62
63 public:
64
65 BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
66
67 void setCpuId(int id)
68 {

--- 222 unchanged lines hidden ---
68 CheckerCPU *checkerCPU;
69
70 public:
71
72 BaseCPU *getCpuPtr() { return actualTC->getCpuPtr(); }
73
74 void setCpuId(int id)
75 {

--- 222 unchanged lines hidden ---