📄 armloader.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 ARM/SWI_Instruction.h
*
* $Id: ARMLoader.cpp,v 1.2 2005/06/08 08:36:24 qilj Exp $
*
* \author Lingjie Qi <lingjie_qi@163.com>
*/
//=============================================================================
#include "stdafx.h"
#include "Core/Global.h"
#include "Core/Datatype.h"
#include "Core/Memory.h"
#include "Core/Processor.h"
#include "Core/Log.h"
#include "Core/System.h"
#include "ARMLoader.h"
#include <iostream>
namespace ARM_LOADER{
//! load elf file
bool ARM_Loader::load_binary(std::string filepath)
{
//need modify
Core::u32 addr=0xa0200000;
std::ifstream fs((const char *)filepath.c_str(), std::ios::binary);
if (fs.fail())
{
return false;
}
Core::Bytecode_Type buffer;
char ch;
while(fs.get(ch))
{
buffer.push_back(ch);
}
((Core::CPU<Core::u32>*)(Core::Wukong_Get_System().get_cpu()))->get_mmu().access(Core::Memory_32Bit::MEMORY_WRITE, addr, buffer.size(), buffer);
return true;
}
void ARM_Loader::set_pc(Core::u32 pc)
{
((Core::CPU<Core::u32>*)(Core::Wukong_Get_System().get_cpu()))->set_pc(pc);
}
}//namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -