Re: Fwd: Bochs' "Bus error" in ARM32.

Егор Гаврилов <[email protected]> Sat, 9 Oct 2021 17:35:15 +0300
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <CAA3UnA7_0ZneLeZmD_i-ivqvAeZ7aHuue9ufKSaGstzHPqiziw@mail.gmail.com>
--===============7370196686271784261==
Content-Type: multipart/alternative; boundary="000000000000651a4205cdec68e0"

--000000000000651a4205cdec68e0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Ok, thanks.

=D1=81=D0=B1, 9 =D0=BE=D0=BA=D1=82. 2021 =D0=B3., 16:13 Stanislav Shwartsma=
n <[email protected]>:

> >Postscriptum: How to setting compiler to working with ANDROID directive?
>
> Define it manually in config.h :)
> We don't officially support it.
>
> On Fri, Oct 8, 2021 at 7:56 PM =D0=95=D0=B3=D0=BE=D1=80 =D0=93=D0=B0=D0=
=B2=D1=80=D0=B8=D0=BB=D0=BE=D0=B2 <[email protected]>
> wrote:
>
>>
>> ---------- Forwarded message ---------
>> =D0=9E=D1=82: =D0=95=D0=B3=D0=BE=D1=80 =D0=93=D0=B0=D0=B2=D1=80=D0=B8=D0=
=BB=D0=BE=D0=B2 <[email protected]>
>> Date: =D0=BF=D1=82, 8 =D0=BE=D0=BA=D1=82. 2021 =D0=B3., 17:38
>> Subject: Re: [Bochs-developers] Bochs' "Bus error" in ARM32.
>> To: Stanislav Shwartsman <[email protected]>
>>
>>
>> >But be prepared that Bochs will be really terribly slow (about 2x slowe=
r
>> than cheapest Intel Atom based Celeron) with this setting.
>>
>> This problem have on Termux for Android. I have ARM64 budget phone and
>> ARM32 budget phone, but Bochs working only on ARM64 phone with Termux.
>> Perfomance is equaly Pentium MMX/II (on ARM64 phone), and 486/Pentium on
>> ARM32 phone with Bochs native app.
>>
>> Postscriptum: How to setting compiler to working with ANDROID directive?
>>
>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 8 =D0=BE=D0=BA=D1=82=D1=8F=
=D0=B1=D1=80=D1=8F 2021 =D0=B3. =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=
=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Stanislav Shwartsman <
>> [email protected]> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>>> Seems like your host Arm system has problem top execute unaligned memor=
y
>>> access (happened on some old ARM based devices) of certain size.
>>>
>>> There is workaround for that.
>>>
>>> In misc/bswap.h you may see how ReadHostQWordFromLittleEndian is
>>> implemented:
>>>
>>>
>>>
>>> BX_CPP_INLINE Bit64u ReadHostQWordFromLittleEndian(Bit64u *hostPtr)
>>>
>>> {
>>>
>>> #ifdef ANDROID
>>>
>>> // Resolve problems with unaligned access
>>>
>>>   Bit64u nativeVar64 =3D ((Bit64u) ((Bit8u *)(hostPtr))[0]) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[1])<<8) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[2])<<16) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[3])<<24) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[4])<<32) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[5])<<40) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[6])<<48) |
>>>
>>>                        (((Bit64u) ((Bit8u *)(hostPtr))[7])<<56);
>>>
>>>   return nativeVar64;
>>>
>>> #else
>>>
>>>   return *(hostPtr);
>>>
>>> #endif
>>>
>>> }
>>>
>>>
>>>
>>> With #ifdef ANDROID you get slower version of the same memory access
>>> which doesn=E2=80=99t do unaligned access.
>>>
>>> If your host has problem with any unaligned accesses =E2=80=93 you shou=
ld enable
>>> similar handling for all methods of reading memory in that file.
>>>
>>> If it has problem only with QWord access -> so only
>>> ReadHostQWordFromLittleEndian and WriteHostQWordToLittleEndian.
>>>
>>>
>>>
>>> But be prepared that Bochs will be really terribly slow (about 2x slowe=
r
>>> than cheapest Intel Atom based Celeron) with this setting.
>>>
>>> Better to have capable host hardrware.
>>>
>>>
>>>
>>> Thanks
>>>
>>> Stanislav
>>>
>>>
>>>
>>> On Fri, Oct 8, 2021, 00:40 =D0=95=D0=B3=D0=BE=D1=80 =D0=93=D0=B0=D0=B2=
=D1=80=D0=B8=D0=BB=D0=BE=D0=B2 <[email protected]>
>>> wrote:
>>>
>>> I have problem with launch Debian Woody in my ARM32 device and Termux
>>>
>>> enviroment (I am also test in Debian, launched by Proot, and have same
>>>
>>> problem). In launch them in my device I get error "Bus error". How to s=
olve?
>>>
>>>
>>>
>>> Screenshot:
>>>
>>> https://user-images.githubusercontent.com/91898998/135873626-74bd504d-c=
b5a-45bd-9c43-91171d6b6dfa.jpg
>>>
>>>
>>>
>>> Bochsrc: my attach.
>>>
>>> GDB log:
>>>
>>> 00000004635i[BIOS ] $Revision: 13073 $ $Date: 2017-02-16 22:43:52 +0100=
 (Do, 16. Feb 2017) $
>>>
>>> 00000318039i[KBD ] reset-disable command received
>>>
>>> Program received signal SIGBUS, Bus error. 0xaab78640 in BX_CPU_C::syst=
em_read_qword ( laddr=3D<optimized out>) at access.cc:385 385 Bit64u *hostA=
ddr =3D (Bit64u*) (hostPageAddr | pageOffset);
>>>
>>> _______________________________________________
>>> bochs-developers mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/bochs-developers
>>>
>>> _______________________________________________
>> bochs-developers mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/bochs-developers
>>
>

--000000000000651a4205cdec68e0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Ok, thanks.=C2=A0</div><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr" class=3D"gmail_attr">=D1=81=D0=B1, 9 =D0=BE=D0=BA=D1=82. 2021=
 =D0=B3., 16:13 Stanislav Shwartsman &lt;<a href=3D"mailto:[email protected]=
om">[email protected]</a>&gt;:<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><di=
v dir=3D"ltr">&gt;Postscriptum: How to setting compiler to working with AND=
ROID directive?<br><div><br></div><div>Define it manually in config.h :)</d=
iv><div>We don&#39;t officially support it.</div></div><br><div class=3D"gm=
ail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Oct 8, 2021 at 7:5=
6 PM =D0=95=D0=B3=D0=BE=D1=80 =D0=93=D0=B0=D0=B2=D1=80=D0=B8=D0=BB=D0=BE=D0=
=B2 &lt;<a href=3D"mailto:[email protected]" target=3D"_blank" rel=
=3D"noreferrer">[email protected]</a>&gt; wrote:<br></div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex"><div dir=3D"auto"></div><br><div c=
lass=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">---------- Forwa=
rded message ---------<br>=D0=9E=D1=82: <strong class=3D"gmail_sendername" =
dir=3D"auto">=D0=95=D0=B3=D0=BE=D1=80 =D0=93=D0=B0=D0=B2=D1=80=D0=B8=D0=BB=
=D0=BE=D0=B2</strong> <span dir=3D"auto">&lt;<a href=3D"mailto:gavrilovegor=
[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]=
om</a>&gt;</span><br>Date: =D0=BF=D1=82, 8 =D0=BE=D0=BA=D1=82. 2021 =D0=B3.=
, 17:38<br>Subject: Re: [Bochs-developers] Bochs&#39; &quot;Bus error&quot;=
 in ARM32.<br>To: Stanislav Shwartsman &lt;<a href=3D"mailto:stlintel@gmail=
.com" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>&gt;<br></=
div><br><br><div>&gt;But be prepared that Bochs will be really terribly slo=
w (about 2x slower than cheapest Intel Atom based Celeron) with this settin=
g.<br></div><div><br></div>This problem have on Termux for Android. I have =
ARM64 budget phone and ARM32 budget phone, but Bochs working only on ARM64 =
phone with Termux. Perfomance is equaly Pentium MMX/II (on ARM64 phone), an=
d 486/Pentium on ARM32 phone with Bochs native app.<div><br></div><div>Post=
scriptum: How to setting compiler to working with ANDROID directive?<br><br=
>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 8 =D0=BE=D0=BA=D1=82=D1=8F=D0=
=B1=D1=80=D1=8F 2021 =D0=B3. =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=
=B0=D1=82=D0=B5=D0=BB=D1=8C Stanislav Shwartsman &lt;<a href=3D"mailto:stli=
[email protected]" rel=3D"noreferrer noreferrer" target=3D"_blank">stlintel@gm=
ail.com</a>&gt; =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<br><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex"><div lang=3D"EN-US"><div><p class=3D"=
MsoNormal">Seems like your host Arm system has problem top execute unaligne=
d memory access (happened on some old ARM based devices) of certain size.<u=
></u><u></u></p><p class=3D"MsoNormal">There is workaround for that.<u></u>=
<u></u></p><p class=3D"MsoNormal">In misc/bswap.h you may see how ReadHostQ=
WordFromLittleEndian is implemented:<u></u><u></u></p><p class=3D"MsoNormal=
"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">BX_CPP_INLINE Bit64u ReadH=
ostQWordFromLittleEndian(Bit64u *hostPtr)<u></u><u></u></p><p class=3D"MsoN=
ormal">{<u></u><u></u></p><p class=3D"MsoNormal">#ifdef ANDROID<u></u><u></=
u></p><p class=3D"MsoNormal">// Resolve problems with unaligned access<u></=
u><u></u></p><p class=3D"MsoNormal">=C2=A0 Bit64u nativeVar64 =3D ((Bit64u)=
 ((Bit8u *)(hostPtr))[0]) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(h=
ostPtr))[1])&lt;&lt;8) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(host=
Ptr))[2])&lt;&lt;16) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(hostPtr=
))[3])&lt;&lt;24) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(hostPtr))[=
4])&lt;&lt;32) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(hostPtr))[5])=
&lt;&lt;40) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(hostPtr))[6])&lt=
;&lt;48) |<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (((Bit64u) ((Bit8u *)(hostPtr))[7])&lt;&l=
t;56);<u></u><u></u></p><p class=3D"MsoNormal">=C2=A0 return nativeVar64;<u=
></u><u></u></p><p class=3D"MsoNormal">#else<u></u><u></u></p><p class=3D"M=
soNormal">=C2=A0 return *(hostPtr);<u></u><u></u></p><p class=3D"MsoNormal"=
>#endif<u></u><u></u></p><p class=3D"MsoNormal">}<u></u><u></u></p><p class=
=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNormal">With #ifdef A=
NDROID you get slower version of the same memory access which doesn=E2=80=
=99t do unaligned access.<u></u><u></u></p><p class=3D"MsoNormal">If your h=
ost has problem with any unaligned accesses =E2=80=93 you should enable sim=
ilar handling for all methods of reading memory in that file.<u></u><u></u>=
</p><p class=3D"MsoNormal">If it has problem only with QWord access -&gt; s=
o only ReadHostQWordFromLittleEndian and WriteHostQWordToLittleEndian.<u></=
u><u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"Mso=
Normal">But be prepared that Bochs will be really terribly slow (about 2x s=
lower than cheapest Intel Atom based Celeron) with this setting.<u></u><u><=
/u></p><p class=3D"MsoNormal">Better to have capable host hardrware.<u></u>=
<u></u></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><p class=3D"MsoNo=
rmal">Thanks<u></u><u></u></p><p class=3D"MsoNormal">Stanislav<u></u><u></u=
></p><p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p><div><div><p class=3D"M=
soNormal">On Fri, Oct 8, 2021, 00:40 =D0=95=D0=B3=D0=BE=D1=80 =D0=93=D0=B0=
=D0=B2=D1=80=D0=B8=D0=BB=D0=BE=D0=B2 &lt;<a href=3D"mailto:gavrilovegor519@=
gmail.com" rel=3D"noreferrer noreferrer" target=3D"_blank">gavrilovegor519@=
gmail.com</a>&gt; wrote:<u></u><u></u></p></div><blockquote style=3D"border=
-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(20=
4,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div=
><div style=3D"border-top:none;border-right:none;border-bottom:none;border-=
left:1pt solid rgb(229,229,229);padding:0cm 0cm 0cm 11pt"><pre style=3D"ver=
tical-align:baseline;border:none;padding:0cm;outline:0px;background-image:i=
nitial;background-repeat:initial">I have problem with launch Debian Woody i=
n my ARM32 device and Termux<u></u><u></u></pre><pre style=3D"vertical-alig=
n:baseline;border:none;padding:0cm">enviroment (I am also test in Debian, l=
aunched by Proot, and have same<u></u><u></u></pre><pre style=3D"vertical-a=
lign:baseline;border:none;padding:0cm">problem). In launch them in my devic=
e I get error &quot;Bus error&quot;. How to solve?<u></u><u></u></pre><pre =
style=3D"vertical-align:baseline;border:none;padding:0cm"><u></u>=C2=A0<u><=
/u></pre><pre style=3D"vertical-align:baseline;border:none;padding:0cm">Scr=
eenshot:<u></u><u></u></pre><pre style=3D"vertical-align:baseline;border:no=
ne;padding:0cm"><a href=3D"https://user-images.githubusercontent.com/918989=
98/135873626-74bd504d-cb5a-45bd-9c43-91171d6b6dfa.jpg" rel=3D"noreferrer no=
referrer" target=3D"_blank">https://user-images.githubusercontent.com/91898=
998/135873626-74bd504d-cb5a-45bd-9c43-91171d6b6dfa.jpg</a><u></u><u></u></p=
re><pre style=3D"vertical-align:baseline;border:none;padding:0cm"><u></u>=
=C2=A0<u></u></pre><pre style=3D"vertical-align:baseline;border:none;paddin=
g:0cm">Bochsrc: my attach.<u></u><u></u></pre><pre style=3D"vertical-align:=
baseline;border:none;padding:0cm;outline:0px;background-image:initial;backg=
round-repeat:initial">GDB log: <u></u><u></u></pre><pre style=3D"vertical-a=
lign:baseline;border:none;padding:0cm;outline:0px;background-image:initial;=
background-repeat:initial">00000004635i[BIOS ] $Revision: 13073 $ $Date: 20=
17-02-16 22:43:52 +0100 (Do, 16. Feb 2017) $ <u></u><u></u></pre><pre style=
=3D"vertical-align:baseline;border:none;padding:0cm;outline:0px;background-=
image:initial;background-repeat:initial">00000318039i[KBD ] reset-disable c=
ommand received <u></u><u></u></pre><pre style=3D"vertical-align:baseline;b=
order:none;padding:0cm;outline:0px;background-image:initial;background-repe=
at:initial">Program received signal SIGBUS, Bus error. 0xaab78640 in BX_CPU=
_C::system_read_qword ( laddr=3D&lt;optimized out&gt;) at access.cc:385 385=
 Bit64u *hostAddr =3D (Bit64u*) (hostPageAddr | pageOffset); <u></u><u></u>=
</pre></div></div><p class=3D"MsoNormal">__________________________________=
_____________<br>bochs-developers mailing list<br><a href=3D"mailto:bochs-d=
[email protected]" rel=3D"noreferrer noreferrer" target=3D"_b=
lank">[email protected]</a><br><a href=3D"https://list=
s.sourceforge.net/lists/listinfo/bochs-developers" rel=3D"noreferrer norefe=
rrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/bochs-=
developers</a><u></u><u></u></p></blockquote></div></div></div></blockquote=
></div>
</div>
_______________________________________________<br>
bochs-developers mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank"=
 rel=3D"noreferrer">[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/bochs-developers" r=
el=3D"noreferrer noreferrer" target=3D"_blank">https://lists.sourceforge.ne=
t/lists/listinfo/bochs-developers</a><br>
</blockquote></div>
</blockquote></div>

--000000000000651a4205cdec68e0--


--===============7370196686271784261==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============7370196686271784261==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
bochs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers

--===============7370196686271784261==--