cpuevent.hh (3530:149c119b67a2) | cpuevent.hh (3886:d55c97419444) |
---|---|
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; --- 22 unchanged lines hidden (view full) --- 31#ifndef __CPU_CPUEVENT_HH__ 32#define __CPU_CPUEVENT_HH__ 33 34#include <vector> 35#include "sim/eventq.hh" 36 37class ThreadContext; 38 | 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; --- 22 unchanged lines hidden (view full) --- 31#ifndef __CPU_CPUEVENT_HH__ 32#define __CPU_CPUEVENT_HH__ 33 34#include <vector> 35#include "sim/eventq.hh" 36 37class ThreadContext; 38 |
39/** This class creates a global list of events that need a pointer to a 40 * thread context. When a switchover takes place the events can be migrated 41 * to the new thread context, otherwise you could have a wake timer interrupt 42 * go off on a switched out cpu or other unfortunate events. This object MUST be 43 * dynamically allocated to avoid it being deleted after a cpu switch happens. 44 * */ | 39/** 40 * This class creates a global list of events that need a pointer to a 41 * thread context. When a switchover takes place the events can be 42 * migrated to the new thread context, otherwise you could have a wake 43 * timer interrupt go off on a switched out cpu or other unfortunate 44 * events. This object MUST be dynamically allocated to avoid it being 45 * deleted after a cpu switch happens. 46 */ |
45class CpuEvent : public Event 46{ 47 protected: 48 /** type of global list of cpu events. */ 49 typedef std::vector<CpuEvent *> CpuEventList; 50 51 /** Static list of cpu events that is searched every time a cpu switch 52 * happens. */ --- 20 unchanged lines hidden (view full) --- 73 74template <class T, void (T::* F)(ThreadContext *tc)> 75class CpuEventWrapper : public CpuEvent 76{ 77 private: 78 T *object; 79 80 public: | 47class CpuEvent : public Event 48{ 49 protected: 50 /** type of global list of cpu events. */ 51 typedef std::vector<CpuEvent *> CpuEventList; 52 53 /** Static list of cpu events that is searched every time a cpu switch 54 * happens. */ --- 20 unchanged lines hidden (view full) --- 75 76template <class T, void (T::* F)(ThreadContext *tc)> 77class CpuEventWrapper : public CpuEvent 78{ 79 private: 80 T *object; 81 82 public: |
81 CpuEventWrapper(T *obj, ThreadContext *_tc, EventQueue *q = &mainEventQueue, 82 Priority p = Default_Pri) | 83 CpuEventWrapper(T *obj, ThreadContext *_tc, 84 EventQueue *q = &mainEventQueue, Priority p = Default_Pri) |
83 : CpuEvent(q, _tc, p), object(obj) 84 { } 85 void process() { (object->*F)(tc); } 86}; 87 88#endif // __CPU_CPUEVENT_HH__ 89 | 85 : CpuEvent(q, _tc, p), object(obj) 86 { } 87 void process() { (object->*F)(tc); } 88}; 89 90#endif // __CPU_CPUEVENT_HH__ 91 |