⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrupt.cc

📁 一个mips虚拟机非常好代码,使用C++来编写的,希望大家多学学,
💻 CC
字号:
#include <checkpoint.hh>#include <cpu.hh>#include <inttypes.hh>// An event representing external MIPS interrupts.SerialType<CPU::InterruptEvent> CPU::InterruptEvent::type(    "CPU::InterruptEvent");CPU::InterruptEvent::InterruptEvent(Checkpoint& cp)    : Serializable(cp), Event(cp){    SerialID cid = extract<SerialID>(cp);    cpu = dynamic_cast<CPU *>(find_object(cid));    if (!cpu)	throw Checkpoint::SyntaxError(cp, "%d is not a valid CPU ID",				      UInt32(cid));    num = extract<Int16>(cp);}voidCPU::InterruptEvent::invoke(){    cpu->deliver_interrupt(num);}voidCPU::InterruptEvent::checkpoint(Checkpoint& cp, bool parent) const{    if (parent)	cp << type << ' ' << id << '\n';    Event::checkpoint(cp);    cp << cpu->id << ' ' << num << '\n';}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -