Hi
Ubuntu 10.10 was crashing because "popcnt" was not implemented , attached is
the patch that implements it .
please note this patch is not fully tested .
-Furat
On Wed, Nov 24, 2010 at 5:15 PM, Adam Stambler <[email protected]> wrote:
> Hello Folks,
>
> I just started using Marrs. I have run simulations successfully with the
> sample images. However, when I try to use a Ubuntu server image that I
> created, the simulator aborts.
>
> Specifically, the simulator boots into the image correctly. Then when I do
> Alt-ctl-2 and run :
>
> simconfig -run -stopinsns 100m -stats test.stats
>
> The marss qemu dies with the following console log:
>
> Completed 321000 cycles, 83839 commits: 188175 Hz,
> 42908 Completed 359000 cycles, 92504 commits: 187729
> Hz, 42807 Completed 397000 cycles, 101181 commits:
> 188542 Hz, 43052 Completed 433000 cycles, 109340
> commits: 177576 Hz, 40245 Completed 463000 cycles,
> 122259 commits: 149484 Hz, 64373 Completed 490000
> cycles, 140952 commits: 130637 Hz, 90444 Completed
> 502000 cycles, 154972 commits: 59432 Hz, 69436
> Completed 531000 cycles, 169519 commits: 143453 Hz,
> 71959 Completed 549000 cycles, 200303 commits: 89441
> Hz, 152964 Completed 577000 cycles, 218816 commits:
> 139005 Hz, 91907 Completed 604000 cycles, 235698
> commits: 133130 Hz, 83240 Completed 637000 cycles,
> 247422 commits: 158629 Hz, 56356 Completed 676000
> cycles, 250429 commits: 191970 Hz, 14801 Completed
> 715000 cycles, 253955 commits: 189329 Hz, 17117
> Completed 752000 cycles, 257607 commits: 184994 Hz,
> 18259 Completed 792000 cycles, 260564 commits: 197667
> Hz, 14612 Completed 829000 cycles, 266180 commits:
> 180257 Hz, 27360 Completed 864000 cycles, 274524
> commits: 173711 Hz, 41412 Completed 901000 cycles,
> 280297 commits: 183640 Hz, 28652 Completed 938000
> cycles, 285198 commits: 183810 Hz, 24347
>
> insns/sec: rip ffffffff81122a92qemu-system-x86_64:
> ptlsim/build/core/default_core/defcore-pipe.cpp:2238: int
> DefaultCoreModel::ReorderBufferEntry::commit(): Assertion `physreg->data'
> failed.
> Aborted
>
>
> Does anyone have any experience with this kind of error? Is there anything
> special that must be done to the qemu image to make it run successfully in
> Marss?
>
> Regards,
> Adam Stambler
>
>
>
>
>
>
>
> _______________________________________________
> http://www.marss86.org
> Marss86-Devel mailing list
> [email protected]
> https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel
>
>
diff --git a/ptlsim/SConstruct b/ptlsim/SConstruct
index a1a4f5d..6d64e7c 100644
--- a/ptlsim/SConstruct
+++ b/ptlsim/SConstruct
@@ -84,10 +84,6 @@ for dir in dirs:
else:
objs.append(o)
-# Build Tools
-Export('dst_objs')
-SConscript('tools/SConscript', variant_dir='build/tools')
-
# Build ptlsim.dst.o
inc_str = ""
for i_s in env['CPPPATH']:
@@ -107,7 +103,14 @@ ptl_dst_o = env.Command('build/ptlsim.dst.o', ptl_dst,
"objcopy -I binary -O elf64-x86-64 -B i386 --rename-section "+
".data=.dst,alloc,load,readonly,data,contents $SOURCE $TARGET")
+# Build Tools
+dst_objs.append(ptl_dst_o)
+Export('dst_objs')
+SConscript('tools/SConscript', variant_dir='build/tools')
+
Depends(dst_tmp_cpp, dst_script)
+Requires(st_i, '../qemu/config-host.h')
+Requires(st_i, '../qemu/x86_64-softmmu/config-target.h')
Requires(dst_tmp_cpp, st_i)
Requires(dst_tmp, dst_tmp_cpp)
diff --git a/ptlsim/x86/decode-complex.cpp b/ptlsim/x86/decode-complex.cpp
index 4d25ead..6fd0f04 100644
--- a/ptlsim/x86/decode-complex.cpp
+++ b/ptlsim/x86/decode-complex.cpp
@@ -944,6 +944,16 @@ W64 l_assist_pause(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags,
return 0;
}
+W64 l_assist_popcnt(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags,
+ W16 rbflags, W16 rcflags, W16& flags) {
+ W64 sizeshift = rb;
+ setup_qemu_switch_except_ctx(ctx);
+ ctx.setup_qemu_switch();
+ helper_popcnt(ra,sizeshift);
+ setup_ptlsim_switch_all_ctx(ctx);
+
+ return 0;
+}
bool assist_mmx_emms(Context& ctx) {
ctx.eip = ctx.reg_selfrip;
ASSIST_IN_QEMU(helper_emms);
@@ -2625,6 +2635,27 @@ bool TraceDecoder::decode_complex() {
}
}
+ case 0x1b8: { //popcnt
+ DECODE(gform, rd, v_mode);
+ DECODE(eform, ra, v_mode);
+ EndOfDecode();
+ int sizeshift = (ra.type == OPTYPE_MEM) ? ra.mem.size : reginfo[ra.reg.reg].sizeshift;
+ int rdreg = arch_pseudo_reg_to_arch_reg[rd.reg.reg];
+ int rareg;
+
+ if (ra.type == OPTYPE_MEM) {
+ rareg = REG_temp0;
+ operand_load(REG_temp0, ra);
+ } else {
+ rareg = arch_pseudo_reg_to_arch_reg[ra.reg.reg];
+ }
+
+ TransOp ast(OP_ast, rdreg, rareg, REG_zero, REG_zero, sizeshift);
+ ast.riptaken = L_ASSIST_POPCNT;
+ this << ast;
+ break ;
+ }
+
case 0x1ba: { // bt|btc|btr|bts mem,imm
// Fast decoder handles only reg forms
// If the LOCK prefix is present, ld.acq and st.rel are used
diff --git a/ptlsim/x86/decode-core.cpp b/ptlsim/x86/decode-core.cpp
index cb8c6d0..466a433 100644
--- a/ptlsim/x86/decode-core.cpp
+++ b/ptlsim/x86/decode-core.cpp
@@ -202,6 +202,7 @@ const light_assist_func_t light_assistid_to_func[L_ASSIST_COUNT] = {
l_assist_ioport_in,
l_assist_ioport_out,
l_assist_pause,
+ l_assist_popcnt,
};
int light_assist_index(light_assist_func_t assist) {
@@ -444,7 +445,7 @@ static const byte twobyte_has_modrm[256] = {
/* 80 */ _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_, /* 8f */
/* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
/* a0 */ _,_,_,1,1,1,1,1,_,_,_,1,1,1,1,1, /* af */
- /* b0 */ 1,1,1,1,1,1,1,1,_,_,1,1,1,1,1,1, /* bf */
+ /* b0 */ 1,1,1,1,1,1,1,1,1,_,1,1,1,1,1,1, /* bf */
/* c0 */ 1,1,1,1,1,1,1,1,_,_,_,_,_,_,_,_, /* cf */
/* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
/* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
diff --git a/ptlsim/x86/decode.h b/ptlsim/x86/decode.h
index 1150d96..2fd5968 100644
--- a/ptlsim/x86/decode.h
+++ b/ptlsim/x86/decode.h
@@ -565,6 +565,7 @@ enum {
L_ASSIST_IOPORT_IN,
L_ASSIST_IOPORT_OUT,
L_ASSIST_PAUSE,
+ L_ASSIST_POPCNT,
L_ASSIST_COUNT
};
@@ -578,6 +579,7 @@ static const char* light_assist_names[L_ASSIST_COUNT] = {
"l_io_in",
"l_io_out",
"l_pause",
+ "l_popcnt"
};
//
@@ -712,6 +714,7 @@ W64 l_assist_popf(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags, W16 rbflags
W64 l_assist_ioport_in(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags, W16 rbflags, W16 rcflags, W16& flags);
W64 l_assist_ioport_out(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags, W16 rbflags, W16 rcflags, W16& flags);
W64 l_assist_pause(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags, W16 rbflags, W16 rcflags, W16& flags);
+W64 l_assist_popcnt(Context& ctx, W64 ra, W64 rb, W64 rc, W16 raflags, W16 rbflags, W16 rcflags, W16& flags);
//
// Global functions
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel