Hi,
I've just started using marss. I've run simulations successfully with
the sample images. However, I have to use Android for my phd (the x86
version of Android). The Android image works fine with QEMU, but I get
this error when I run PTLSim:
Completed 249000 cycles, 81357 commits: 259706 Hz,
108557 insns/sec: rip 00000000c01f6e1cqemu-system-x86_64:
ptlsim/build/core/ooopipe.cpp:2181: int
OutOfOrderModel::ReorderBufferEntry::commit(): Assertion
`physreg->data' failed.
Aborted
After analyzing the log files generated by PTLSim (with loglevel set to
99) I realized that there was a problem with some x86 instructions that
are not implemented in marss:
0x07 - POP ES - Pop top of stack into ES; increment stack pointer.
0x1F - POP DS - Pop top of stack into DS; increment stack pointer.
0x1A1 - POP FS - Pop top of stack into FS; increment stack pointer.
So I modified the decoder in order to implement these x86 instructions.
I reviewed the code for the corresponding PUSH instructions, since the
PUSH ES, PUSH DS and PUSH FS were already implemented. These were the
modifications to the decode-fast.cpp file:
$ diff a/ptlsim/x86/decode-fast.cpp b/ptlsim/x86/decode-fast.cpp
61a62,83
case 7: {
// 0x07 pop es
// 0x17 pop ss
// 0x1f pop ds
EndOfDecode();
int sizeshift = 2;
int size = (1 << sizeshift);
int seg_reg = (op >> 3);
int r = REG_temp0;
TransOp ldp(OP_ld, r, REG_ctx, REG_imm, REG_zero, size,
offsetof_t(Context, segs[seg_reg].selector));
ldp.internal = 1;
this << ldp;
this << TransOp(OP_ld, REG_mem, REG_rsp, REG_imm, r,
sizeshift, -size);
this << TransOp(OP_add, REG_rsp, REG_rsp, REG_imm, REG_zero,
3, size);
push_op = true;
break;
}
907a930,948
case 0x1a1: {
// pop fs
EndOfDecode();
int sizeshift = 2; // fix 32 bit shift of stack
int size = (1 << sizeshift);
int seg_reg = (op >> 3) & 7;
int r = REG_temp0;
TransOp ldp(OP_ld, r, REG_ctx, REG_imm, REG_zero, size,
offsetof_t(Context, segs[seg_reg].selector));
ldp.internal = 1;
this << ldp;
this << TransOp(OP_ld, REG_mem, REG_rsp, REG_imm, r, sizeshift, -size);
this << TransOp(OP_add, REG_rsp, REG_rsp, REG_imm, REG_zero, 3, size);
break;
}
After applying these changes, the Android image works successfully.
Nevertheless, since this is the first time I've tried to modify marss
I'm not sure whether I've implemented these instructions correctly. Is
there any problem with these modifications? Is there any better way to
solve this problem (for example, by using assists)?
Thank you very much,
jarnau
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel