Skip to content
Snippets Groups Projects
Verified Commit 5b11c6b8 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

trial

parent 6f8b0120
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,8 @@ include Makefile.git
CXX ?= g++
LD = $(CXX)
INCLUDES = $(addprefix -I, $(INC_DIR))
CFLAGS += -O2 -MMD -Wall -ggdb3 $(INCLUDES) -fomit-frame-pointer -std=c++17
CFLAGS += -DDIFF_TEST_QEMU
CFLAGS += -O3 -MMD -Wall -ggdb $(INCLUDES) -fomit-frame-pointer -std=c++17
# CFLAGS += -DDIFF_TEST_QEMU
# Source code generation before any targets.
SUBDIRS = src/monitor/debug/expr_impl
......
#ifndef __COMMON_H__
#define __COMMON_H__
#define DEBUG
//#define DEBUG
//#define DIFF_TEST
#if _SHARE
......
......@@ -14,10 +14,8 @@ typedef struct {
#define EMPTY EX(inv)
static inline void set_width(int width) {
if (width == 0) {
width = decoding.is_operand_size_16 ? 2 : 4;
}
decoding.src.width = decoding.dest.width = decoding.src2.width = width;
const auto tmp = width == 0 ? (decoding.is_operand_size_16 ? 2 : 4) : width;
decoding.src.width = decoding.dest.width = decoding.src2.width = tmp;
}
/* Instruction Decode and EXecute */
......@@ -211,7 +209,7 @@ namespace EHelperImpl {
idex(eip, &opcode_table[opcode]);
}
make_EHelper(real) {
__attribute__((hot)) make_EHelper(real) {
uint32_t opcode = instr_fetch(eip, 1);
decoding.opcode = opcode;
set_width(opcode_table[opcode].width);
......
......@@ -11,7 +11,14 @@ uint8_t pmem[PMEM_SIZE];
/* Memory accessing interfaces */
uint32_t paddr_read(paddr_t addr, int len) {
__attribute__((hot)) uint32_t paddr_read(paddr_t addr, int len) {
switch(len) {
case 4: return pmem_rw(addr, uint32_t);
case 2: return pmem_rw(addr, uint32_t) & 0x0000ffff;
case 1: return pmem_rw(addr, uint32_t) & 0x000000ff;
case 3: return pmem_rw(addr, uint32_t) & 0x00ffffff;
case 0: return 0;
}
return pmem_rw(addr, uint32_t) & (~0u >> ((4 - len) << 3));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment