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

> Manual commit: bug fix for test.add

U201614531
recolic
Linux RECOLICPC 5.4.2-arch1-1 #1 SMP PREEMPT Thu, 05 Dec 2019 12:29:40 +0000 x86_64 GNU/Linux
 14:11:21 up 4 days, 19:19,  1 user,  load average: 0.86, 1.43, 2.84
1b5a120de407e3cada65f71714e36e047bb0c4d
parent 3949ce4c
No related branches found
No related tags found
No related merge requests found
......@@ -217,7 +217,7 @@ static inline void rtl_update_ZF(const rtlreg_t* result, int width) {
// eflags.ZF <- is_zero(result[width * 8 - 1 .. 0])
RLIB_MACRO_DEBUG_ASSERT((unsigned)width < 5);
static const uint32_t niddles [5] {0, 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff};
cpu_eflags::get<cpu_eflags::ZF>() = (*result & niddles[width]);
cpu_eflags::get<cpu_eflags::ZF>() = !(*result & niddles[width]);
}
static inline void rtl_update_SF(const rtlreg_t* result, int width) {
......
......@@ -282,6 +282,8 @@ make_DHelper(a2O) {
make_DHelper(J) {
make_DopHelper_funcname(SI)(eip, id_dest, false);
rlib::println("debug: J decoder: id_dest=", *id_dest);
rtl_sext(&id_dest->imm, &id_dest->imm, id_dest->width);
// the target address can be computed in the decode stage
decoding.jmp_eip = id_dest->simm + *eip;
}
......
......@@ -19,8 +19,8 @@ ISA_DEF = __ISA_$(shell echo $(ISA) | tr a-z A-Z)__
INCLUDES = $(addprefix -I, $(INC_DIR)) -I$(AM_HOME)/am/
INCLUDES += -I$(AM_HOME)/am/arch/$(ARCH)/include
CFLAGS += -std=gnu11 -O2 -MMD -Wall -Werror -ggdb $(INCLUDES) -D$(ISA_DEF) -fno-builtin
CXXFLAGS += -std=c++11 -O2 -MMD -Wall -Werror -ggdb $(INCLUDES) -D$(ISA_DEF) -fno-builtin
CFLAGS += -std=gnu11 -O2 -MMD -Wall -ggdb $(INCLUDES) -D$(ISA_DEF) -fno-builtin
CXXFLAGS += -std=c++11 -O2 -MMD -Wall -ggdb $(INCLUDES) -D$(ISA_DEF) -fno-builtin
ASFLAGS += -MMD $(INCLUDES) -D$(ISA_DEF)
ifeq ($(ISA), native)
......
#include "trap.h"
int add(int a, int b) {
int c = a + b;
return c;
}
int test_data[] = {0, 1, 2};
int ans[] = {0, 1, 2,1,2,3,2,3,4};
#define NR_DATA (sizeof(test_data) / sizeof(test_data[0]))
int main() {
int i, j, ans_idx = 0;
for(i = 0; i < NR_DATA; i ++) {
for(j = 0; j < NR_DATA; j ++) {
nemu_assert(1);
}
nemu_assert(j == NR_DATA);
}
nemu_assert(i == NR_DATA);
return 0;
}
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