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

📄 exception.cpp

📁 浙江大学的悟空嵌入式系统模拟器
💻 CPP
字号:
/**
*  Copyright (c) 2005 Zhejiang University, P.R.China
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

///==================================================
/**
* @file        Exception.cpp
* @brief      
* @author      Chenfeng Zhou <ini_autumn@163.com> 
*
* Created    : <2005-03-07 19:50:41 by Cheney Chow>
* Last update: <2005-03-07 19:59:13 by Cheney Chow>
*
* $Id: Exception.cpp,v 1.1 2005/06/16 06:01:44 qilj Exp $
*/
///==================================================

#include "Reg_Utils.h"
#include "Exception.h"


namespace PPC {
	Exception_Handler * Exception::exception_handler_table_[EXC_NR] = {
			new DSI_Handler(),
			new ISI_Handler(),
			new DEC_Handler(),
			new EXT_INT_Handler(),
			new SC_Handler(),
			new NO_FPU_Handler(),
			new PROGRAM_Handler(),
			new FLOAT_ASSIT_Handler(),
			new MACHINE_CHECK_Handler(),
			new TRACE_Handler(),
			new INSTR_TLB_Handler(),
			new DATA_TLB_Handler()
	};

	Exception::Exception()
	{
		exception_pending_ = false;
		exception_flags_.reset();
	}

	void Exception::pend_exception(size_t exc_type)
	{
		PPC_ASSERT(exc_type < EXC_NR);

		//if (REG_BIT_IS_SET(MSR, Reg_Flag::MSR_EE)) {
			exception_pending_ = true;
			exception_flags_.set(exc_type, true);
		//}
	}

	void Exception::handle_pending_exception()
	{
		if (exception_pending_ == false)
			return;

		// Allow external exception;
		//if (REG_BIT_IS_SET(MSR, Reg_Flag::MSR_EE)) {
			if (exception_flags_.test(EXC_DEC)) {
				Exception_Mgr::instance()->handle(EXC_DEC);
				exception_pending_ = false;
			}
		//}
	}

} //namespace PPC

⌨️ 快捷键说明

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