From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?7KGw7ZiE6raM?= Subject: Question about next_module() function Date: Sat, 24 Sep 2016 09:36:35 +0900 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3323434062131371738==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============3323434062131371738== Content-Type: multipart/alternative; boundary=001a114216fe593a4a053d36167f --001a114216fe593a4a053d36167f Content-Type: text/plain; charset=UTF-8 Hi I am experimenting Xen with my embedded system environment and got a question in next_module() function. *static paddr_t __init next_module(paddr_t s, paddr_t *end)* *{* * struct bootmodules *mi = &bootinfo.modules;* * paddr_t lowest = ~(paddr_t)0;* * int i;* * for ( i = 0; i < mi->nr_mods; i++ )* * {* * paddr_t mod_s = mi->module[i].start;* * paddr_t mod_e = mod_s + mi->module[i].size;* * if ( !mi->module[i].size )* * continue;* * if ( mod_s < s )* * continue;* * if ( mod_s > lowest )* * continue;* * if ( mod_s > *end )* * continue;* * lowest = mod_s;* * *end = min(*end, mod_e);* * }* * return lowest;* *}* The job of next_module() function is excluding module exist RAM range between s and *end and finding empty space which can be heap space. But Its function does not work if module range is bigger than s and *end range. (Case when module range is mod_s <= s and mod_e >= *end) * if ( mod_s < s )* * continue;* Above condition passes the case and xen consider range s and *end is free space. Is it expected result or mistake? Thank you. --001a114216fe593a4a053d36167f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi

I am experimenting Xen with my embed= ded system environment and got a question in next_module() function.
<= div>
static paddr_t __init next_module(paddr_t= s, paddr_t *end)
{
=C2=A0 =C2=A0 struct = bootmodules *mi =3D &bootinfo.modules;
=C2=A0 =C2=A0 p= addr_t lowest =3D ~(paddr_t)0;
=C2=A0 =C2=A0 int i;

=C2=A0 =C2=A0 for ( i =3D 0; i < mi->= ;nr_mods; i++ )
=C2=A0 =C2=A0 {
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 paddr_t mod_s =3D mi->module[i].start;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 paddr_t mod_e =3D mod_s + mi->module[i]= .size;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 i= f ( !mi->module[i].size )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 continue;

=C2=A0 =C2= =A0 =C2=A0 =C2=A0 if ( mod_s < s )
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 continue;
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 if ( mod_s > lowest )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 continue;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( m= od_s > *end )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= continue;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 lowest =3D mod_s;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 *end =3D min(*end, mod_e);<= /div>
=C2=A0 =C2=A0 }
=C2=A0 =C2=A0 return lowest;<= /i>
}

The job of next_modul= e() function is excluding module exist RAM range between s and *end and fin= ding empty space which can be heap space.

But Its = function does not work if module range is bigger than s and *end range.=C2= =A0
(Case when module range is mod_s <=3D s and mod_e >=3D = *end)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ( mod= _s < s )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cont= inue;

Above condition passes the = case and xen consider range s and *end is free space.

<= div>Is it expected result or mistake?

Thank you.
--001a114216fe593a4a053d36167f-- --===============3323434062131371738== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============3323434062131371738==--