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

📄 decode.cpp

📁 RISC processor ARM-7 emulator
💻 CPP
字号:
/*************************************************************************
    Copyright (C) 2002,2003,2004,2005 Wei Qin
    See file COPYING for more information.

    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.
*************************************************************************/

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <armemul.h>
#include "syscall.h"
#include "dpi.h"
#include "syscall.h"
#include "branch.h"
#include "mult.h"
#include "ldst.h"
#include "statreg.h"
#include "decode.h"
#include "nwfpe.h"
#include "coproc.h"

#include "auto_disasm.h"
#include "arm_dec.h"

/*table to compress 4 bits into 2 bits
   00 01 11 10
00  *  x  x  *
01  *  x  x  *
11  *  o  o  *
10  *  v  o  *

* -- 0
x -- 1
o -- 2	signature of ld/st mode2
v -- 3	signature of swap/mult
*/

char *arm_disassemble(arm_inst_t inst, arm_addr_t pc, char *buf)
{
	return disasm_main(inst, pc, buf);
}

void impl_default(IMPL_FORMALS)
{
	fprintf(stderr, "Attempted to execute a bogus opcode at 0x%08x"
		" (inst = 0x%08x), ignored...\n", PC-8, inst);
}

char *disasm_default(arm_inst_t inst, arm_addr_t pc, char *buf)
{
	buf += sprintf(buf, "????\n");
	return buf;
}

void arm_disassemble_to_stream(arm_inst_t inst, arm_addr_t pc, FILE *stream)
{
	char buf[256];
	arm_disassemble(inst, pc, buf);
	fprintf(stream, "0x%08x : 0x%08x    %s", pc, inst, buf);
}

⌨️ 快捷键说明

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