Re: bochs on sparc/solaris

Brad Walker <[email protected]>
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <CAPKZHbXG8OdHnk-wfD5TZxAE2-HfiK129gndztjSKMUrcmG+iw@mail.gmail.com>
Okay, I tried a few things today.. And had various levels of success.

First, I think you are correct about the alignment. It is common for
CPU to not handle unaligned memory accesses in the CPU hardware. Most
cpus that worked this way have completed died off. But, SPARC is still
like this. Over the years a lot of software has been fixed to not have
this problem as it can really wreck performance on the x86 processor
pipeline. This is why I think it's always a good thing to port
software to a different platform/cpu combination. It increases the
robustness and fleshes out problems like these. But, I'm digressing
now.

...
00000000000i[     ] reset of 'extfpuirq' plugin device by virtual method
00000000000i[     ] reset of 'parallel' plugin device by virtual method
00000000000i[     ] reset of 'serial' plugin device by virtual method
00000000000i[XGUI ] Mouse capture off
[Switching to Thread 1 (LWP 1)]

Breakpoint 1, FetchWORD (iptr=0x104b82ff1 "\340") at fetchdecode.h:42
42         ReadHostWordFromLittleEndian(iptr, data);
1: x/i $pc
=> 0x100143768 <FetchWORD(Bit8u const*)+8>:     ldx  [ %fp + 0x87f ], %g1
(gdb) stepi
0x000000010014376c      42         ReadHostWordFromLittleEndian(iptr, data);
1: x/i $pc
=> 0x10014376c <FetchWORD(Bit8u const*)+12>:    lduh  [ %g1 ], %g1
(gdb) p/x $g1
$6 = 0x104b82ff1
(gdb) bt
#0  0x000000010014376c in FetchWORD (iptr=0x104b82ff1 "\340") at
fetchdecode.h:42
#1  0x0000000100142730 in BX_CPU_C::fetchDecode32 (iptr=0x104b82ff1
"\340", i=0x100a43240,
    remainingInPage=15) at fetchdecode.cc:1810
#2  0x000000010014046c in BX_CPU_C::serveICacheMiss (entry=0x0,
eipBiased=4080, pAddr=4294967280)
    at icache.cc:103
#3  0x000000010013d934 in BX_CPU_C::getICacheEntry () at cpu.cc:233
#4  0x000000010013d604 in BX_CPU_C::cpu_loop () at cpu.cc:95
#5  0x0000000100061660 in bx_begin_simulation (argc=3,
argv=0xffffffff7ffff1e8) at main.cc:1026
#6  0x000000010020f84c in bx_real_sim_c::begin_simulation
(this=0x10294bcd0, argc=3,
    argv=0xffffffff7ffff1e8) at siminterface.cc:858
#7  0x000000010021a1d0 in bx_config_interface (menu=8) at textconfig.cc:432
#8  0x000000010021a798 in bx_config_interface (menu=1) at textconfig.cc:476
#9  0x000000010021ea1c in ci_callback (userdata=0x0, command=CI_START)
at textconfig.cc:1095
#10 0x000000010020f7e4 in bx_real_sim_c::configuration_interface
(this=0x10294bcd0,
    ignore=0x100271b30 "textconfig", command=CI_START) at siminterface.cc:851
#11 0x000000010005f504 in bxmain () at main.cc:296
#12 0x000000010005f62c in main (argc=3, argv=0xffffffff7ffff1e8) at main.cc:511
(gdb) stepi

Program received signal SIGSEGV, Segmentation fault.
0x000000010014376c in FetchWORD (iptr=0x104b82ff1 "\340") at fetchdecode.h:42
42         ReadHostWordFromLittleEndian(iptr, data);
1: x/i $pc
=> 0x10014376c <FetchWORD(Bit8u const*)+12>:    lduh  [ %g1 ], %g1
(gdb) list
37      //
38
39      BX_CPP_INLINE Bit16u FetchWORD(const Bit8u *iptr)
40      {
41         Bit16u data;
42         ReadHostWordFromLittleEndian(iptr, data);
43         return data;
44      }
45
46      BX_CPP_INLINE Bit32u FetchDWORD(const Bit8u *iptr)
(gdb)

There is no option to GCC to tell it to use a library or trap to
handle unaligned memory accesses. I think at one time, years ago,
there was an option.

But, the Oracle Solaris compiler does have this option. So I tried to
use this compiler to build Bochs but was unsuccessful in building.

So I'm kinda stuck.

Ideas/comments?

BTW, thanks for the help.

-brad w.

On Thu, Dec 27, 2012 at 8:33 AM, Stanislav <[email protected]> wrote:
> I could have some guess already.
>
> I see that the ReadHostWordFromLittleEndian trying to read a word from
> non-aligned address.
> Does Sparc architecture supports unaligned accesses ?
> I now many big endian architectures have this issue and require some
> compiler switch to work it around.
>

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.