Hi,
Thank you very much for your help. I'm using the Android image which is provided at the web page of the Android-x86 project:
http://android-x86.googlecode.com/files/eeepc-v0.9.iso You can run this image in marss by using this command:$ qemu/qemu-system-x86_64 -soundhw es1370 -net nic -net user -cdrom eeepc-v0.9.iso
The Android image works well in emulation mode. However, in simulation mode it crashes because of the POP instructions. After patching the decoder in order to implement these instructions Android seems to work fine in simulation mode too.
I have tried to correct the code by following your instructions, this is my last attempt:
Line 62 - file ptlsim/x86/decode-fast.cpp
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;
// 1. Load data from stack into temporary register
this << TransOp(OP_ld, r, REG_rsp, REG_imm, REG_zero, sizeshift, 0);
// 2. Store data from temporary register to CPU Context's
segment register
TransOp stp(OP_st, REG_mem, REG_ctx, REG_imm, r, size,
offsetof_t(Context, segs[seg_reg].selector));
stp.internal = 1;
this << stp;
// 3. Increase the stack pointer
this << TransOp(OP_add, REG_rsp, REG_rsp, REG_imm, REG_zero, 3, size);
push_op = true;
break;
}
I think that now I'm writing the top of the stack into the
corresponding segment register. However, this patch has not been
heavily tested, if someone with more experience with marss can review
it I will be very grateful.
Thank you very much, jarnau Quoting avadh patel <[email protected]>:
On Wed, Dec 8, 2010 at 5:36 AM, <[email protected]> wrote: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 dsEndOfDecode();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 fsEndOfDecode();int sizeshift = 2; // fix 32 bit shift of stackint 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;}Thanks for finding the issue and try to fix it. One quick thing I noticedthat all these 'pop' instructions read from stack and store into CPU's Segment registers. So your code should be in following order: 1. Load data from stack into some temporary register: 2. Store data from temporary register to CPU Context's segment register (here you have load that value to REG_ctx which is incorrect) 3. Increase the stack pointer 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)? This is a great news that Android is working on Marss. If its possible, Iwould like to put the android disk image on our website for others to download, can you share that image with us? - AvadhThank you very much, jarnau _______________________________________________ http://www.marss86.org Marss86-Devel mailing list [email protected] https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
_______________________________________________ http://www.marss86.org Marss86-Devel mailing list [email protected] https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
