pc_event.cc (2665:a124942bacb8) pc_event.cc (2680:246e7104f744)
1/*
2 * Copyright (c) 2002-2005 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;

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

32#include <algorithm>
33#include <map>
34#include <string>
35#include <utility>
36
37#include "base/trace.hh"
38#include "config/full_system.hh"
39#include "cpu/base.hh"
1/*
2 * Copyright (c) 2002-2005 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;

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

32#include <algorithm>
33#include <map>
34#include <string>
35#include <utility>
36
37#include "base/trace.hh"
38#include "config/full_system.hh"
39#include "cpu/base.hh"
40#include "cpu/exec_context.hh"
40#include "cpu/thread_context.hh"
41#include "cpu/pc_event.hh"
42#include "sim/debug.hh"
43#include "sim/root.hh"
44#include "sim/system.hh"
45
46using namespace std;
47
48PCEventQueue::PCEventQueue()

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

76
77 DPRINTF(PCEvent, "PC based event scheduled for %#x: %s\n",
78 event->pc(), event->descr());
79
80 return true;
81}
82
83bool
41#include "cpu/pc_event.hh"
42#include "sim/debug.hh"
43#include "sim/root.hh"
44#include "sim/system.hh"
45
46using namespace std;
47
48PCEventQueue::PCEventQueue()

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

76
77 DPRINTF(PCEvent, "PC based event scheduled for %#x: %s\n",
78 event->pc(), event->descr());
79
80 return true;
81}
82
83bool
84PCEventQueue::doService(ExecContext *xc)
84PCEventQueue::doService(ThreadContext *tc)
85{
85{
86 Addr pc = xc->readPC() & ~0x3;
86 Addr pc = tc->readPC() & ~0x3;
87 int serviced = 0;
88 range_t range = equal_range(pc);
89 for (iterator i = range.first; i != range.second; ++i) {
90 // Make sure that the pc wasn't changed as the side effect of
91 // another event. This for example, prevents two invocations
92 // of the SkipFuncEvent. Maybe we should have separate PC
93 // event queues for each processor?
87 int serviced = 0;
88 range_t range = equal_range(pc);
89 for (iterator i = range.first; i != range.second; ++i) {
90 // Make sure that the pc wasn't changed as the side effect of
91 // another event. This for example, prevents two invocations
92 // of the SkipFuncEvent. Maybe we should have separate PC
93 // event queues for each processor?
94 if (pc != (xc->readPC() & ~0x3))
94 if (pc != (tc->readPC() & ~0x3))
95 continue;
96
97 DPRINTF(PCEvent, "PC based event serviced at %#x: %s\n",
98 (*i)->pc(), (*i)->descr());
99
95 continue;
96
97 DPRINTF(PCEvent, "PC based event serviced at %#x: %s\n",
98 (*i)->pc(), (*i)->descr());
99
100 (*i)->process(xc);
100 (*i)->process(tc);
101 ++serviced;
102 }
103
104 return serviced > 0;
105}
106
107void
108PCEventQueue::dump() const

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

123
124BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr,
125 bool del)
126 : PCEvent(q, desc, addr), remove(del)
127{
128}
129
130void
101 ++serviced;
102 }
103
104 return serviced > 0;
105}
106
107void
108PCEventQueue::dump() const

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

123
124BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr,
125 bool del)
126 : PCEvent(q, desc, addr), remove(del)
127{
128}
129
130void
131BreakPCEvent::process(ExecContext *xc)
131BreakPCEvent::process(ThreadContext *tc)
132{
132{
133 StringWrap name(xc->getCpuPtr()->name() + ".break_event");
133 StringWrap name(tc->getCpuPtr()->name() + ".break_event");
134 DPRINTFN("break event %s triggered\n", descr());
135 debug_break();
136 if (remove)
137 delete this;
138}
139
140#if FULL_SYSTEM
141extern "C"

--- 17 unchanged lines hidden ---
134 DPRINTFN("break event %s triggered\n", descr());
135 debug_break();
136 if (remove)
137 delete this;
138}
139
140#if FULL_SYSTEM
141extern "C"

--- 17 unchanged lines hidden ---