L4Re + ARM

Alexis Fajardo Moya afmoya at uclv.cu
Wed Apr 2 18:24:25 CEST 2014


El 01/04/14 18:07, Adam Lackorzynski escribió:
> I tried a bit to reproduce this but could not manage it, it always
> worked for me. In the same file, startup.cc, there's a function
> move_modules() which is doing the two outputs we're seeing. Inbetween,
> there's a 'for' loop. There's an 'if' inside (i < 3), could you add some
> printfs in there and around, especially printing the used addresses, to
> see why those modules are skipped? Overall the numbers are quite
> identical to my numbers here, so the different behavior is interesting.
Hello Adam,

                     this is the result of your recommendations. In red 
the results of my printfs.

L4 Bootstrapper

   Build: #2 mié abr  2 11:03:29 CDT 2014, 4.6.3

   Scanning up to 256 MB RAM

   Memory size is 256MB (70000000 - 7fffffff)

   RAM: 0000000070000000 - 000000007fffffff: 262144kB

   Total RAM: 256MB

   mod04: 710cc000-710e5580: hello

   mod03: 710b2000-710cb460: l4re

   mod02: 71078000-710b162c: moe

   mod01: 7106e000-71077378: sigma0

   mod00: 71017000-7106d6dc: fiasco

   Moving up to 5 modules behind 71100000

AFMOYA DEBUGING, printf BEFORE "if (i < 3)" statement, for (unsigned i = 0; i < mbi->mods_count; ++i) statement iteration 0

=> firstmodulestart  71017000    lastmoduleend 711cf000

=> mbi_mod_                start 71017000    end 7106d6dc        size 566dc

=> Region from            start 71017000    end 7106d6db    size 566dc

=> Region *this_module    start 71017000    end 7106d6db    size 566dc

AFMOYA DEBUGING, printf INSIDE "if (i < 3)" statement

=> printf INSIDE "if (start < lastmoduleend)" statement

=>=> Region to    start 711cf000    end 712256db

=>=> printf INSIDE "if (module_area.contains(to))" statement

   moving module 00 { 71017000, 7106d6db } (?ELF) -> { 711cf000 - 712256db } [354012]

464c457f 00010101 00000000 00000000 00280002 00000001 00001244 00000034

000564d4 05000002 00200034 00280006 000c000d 70000001 00052ef0 f0052ef0

00052ef0 00000028 00000028 00000004 00000004 00000001 000000f4 00001000

00001000 000003c0 00000bc0 00000007 00000004 00000001 00002000 f0002000

00002000 00050f18 0005e000 00000007 00004000 00000001 00052f20 ffff0000

00060000 00000500 00000500 00000005 00000010 00000001 00053420 f0061000

00061000 00003000 00003000 00000007 00000004 6474e551 00000000 00000000

00000000 00000000 00000000 00000007 00000004 e3030c09 e92d4ff0 e3410000

=>=>=> lastmoduleend 0 received from rounded  this_module->end() 0

AFMOYA DEBUGING, continue statement INSIDE if (i < 3) statement in the iteration 0


AFMOYA DEBUGING, printf BEFORE "if (i < 3)" statement, for (unsigned i = 0; i < mbi->mods_count; ++i) statement iteration 1

=> firstmodulestart  71017000    lastmoduleend 0

=> mbi_mod_                start 7106e000    end 71077378        size 9378

=> Region from            start 7106e000    end 71077377    size 9378

=> Region *this_module    start 7106e000    end 71077377    size 9378

AFMOYA DEBUGING, printf INSIDE "if (i < 3)" statement

AFMOYA DEBUGING, continue statement INSIDE if (i < 3) statement in the iteration 1


AFMOYA DEBUGING, printf BEFORE "if (i < 3)" statement, for (unsigned i = 0; i < mbi->mods_count; ++i) statement iteration 2

=> firstmodulestart  71017000    lastmoduleend 0

=> mbi_mod_                start 71078000    end 710b162c        size 3962c

=> Region from            start 71078000    end 710b162b    size 3962c

=> Region *this_module    start 71078000    end 710b162b    size 3962c

AFMOYA DEBUGING, printf INSIDE "if (i < 3)" statement

AFMOYA DEBUGING, continue statement INSIDE if (i < 3) statement in the iteration 2


AFMOYA DEBUGING, printf BEFORE "if (i < 3)" statement, for (unsigned i = 0; i < mbi->mods_count; ++i) statement iteration 3

=> firstmodulestart  71017000    lastmoduleend 0

=> mbi_mod_                start 710b2000    end 710cb460        size 19460

=> Region from            start 710b2000    end 710cb45f    size 19460

=> Region *this_module    start 710b2000    end 710cb45f    size 19460

AFMOYA DEBUGING, execution continues after "if (i < 3)" statement

AFMOYA DEBUGING, execution continues after "if (start >= modaddr)" statement

AFMOYA DEBUGING,  long long to = regions.find_free(module_area, size, L4_PAGESHIFT) 71100000

AFMOYA DEBUGING,  Region m_to    start 71100000    end 7111945f    size 19460

   moving module 03 { 710b2000, 710cb45f } (?ELF) -> { 71100000 - 7111945f } [103520]

464c457f 00010101 00000000 00000000 00280002 00000001 b00001a4 00000034

000191e0 05000002 00200034 00280006 000f0010 70000001 00014874 b0014874

b0014874 00000808 00000808 00000004 00000004 00000006 00000034 b0000034

b0000034 000000c0 000000c0 00000004 00000004 00000001 00000000 b0000000

b0000000 00015080 00015080 00000005 00008000 00000001 00018000 b0018000

b0018000 000010c4 0000236c 00000006 00008000 00000007 00000000 00000000

00000000 00000000 00000000 00000000 00000004 60000014 00012a40 b0012a40

b0012a40 00000018 00000018 00000004 00000004 00000000 00000000 00000000

AFMOYA DEBUGING, end of the iteration 3


AFMOYA DEBUGING, printf BEFORE "if (i < 3)" statement, for (unsigned i = 0; i < mbi->mods_count; ++i) statement iteration 4

=> firstmodulestart  71017000    lastmoduleend 0

=> mbi_mod_                start 710cc000    end 710e5580        size 19580

=> Region from            start 710cc000    end 710e557f    size 19580

=> Region *this_module    start 710cc000    end 710e557f    size 19580

AFMOYA DEBUGING, execution continues after "if (i < 3)" statement

AFMOYA DEBUGING, execution continues after "if (start >= modaddr)" statement

AFMOYA DEBUGING,  long long to = regions.find_free(module_area, size, L4_PAGESHIFT) 71100000

AFMOYA DEBUGING,  Region m_to    start 71100000    end 7111957f    size 19580

   moving module 04 { 710cc000, 710e557f } (?ELF) -> { 71100000 - 7111957f } [103808]

464c457f 00010101 00000000 00000000 00280002 00000001 010001a4 00000034

000192d8 05000002 00200034 00280006 00100011 70000001 00015504 01015504

01015504 00000ae0 00000ae0 00000004 00000004 00000006 00000034 01000034

01000034 000000c0 000000c0 00000004 00000004 00000001 00000000 01000000

01000000 00015fe8 00015fe8 00000005 00008000 00000001 00018000 01018000

01018000 000011b4 0000734c 00000006 00008000 00000007 00018000 01018000

01018000 00000000 00000014 00000006 00000004 60000014 00013640 01013640

01013640 0000000c 0000000c 00000004 00000004 00000000 00000000 00000000

AFMOYA DEBUGING, end of the iteration 4

   Compactifying


Here my adds to the*move_modules* function

move_modules(l4util_mb_info_t *mbi, unsigned long modaddr)

{

   printf("  Moving up to %d modules behind %lx\n", mbi->mods_count, modaddr);

   Region *ramr = ram.find(Region(modaddr, modaddr));

   Region module_area(modaddr, ramr->end(), "ram for modules");

   unsigned long firstmodulestart = ~0UL, lastmoduleend = 0;

   for (unsigned i = 0; i < mbi->mods_count; ++i)

     {

       if (lastmoduleend < mbi_mod_end(mbi, i))

         lastmoduleend = mbi_mod_end(mbi, i);

       if (firstmodulestart > mbi_mod_start(mbi, i))

         firstmodulestart = mbi_mod_start(mbi, i);

     }

   lastmoduleend = l4_round_page(lastmoduleend);

   if (firstmodulestart < modaddr)

     {

       Region s(lastmoduleend, ramr->end());

       unsigned long sz = modaddr - firstmodulestart;

       lastmoduleend = regions.find_free(s, sz, L4_PAGESHIFT) + sz;

     }

   for (unsigned i = 0; i < mbi->mods_count; ++i)

     {

       unsigned long start = mbi_mod_start(mbi, i);

       unsigned long end = mbi_mod_end(mbi, i);

       unsigned long size = mbi_mod_size(mbi, i);

       if (start == end)

         continue;

       Region from(start, end - 1);

       Region *this_module = regions.find(from);

       assert(this_module->begin() == from.begin()

              && this_module->end() == from.end());


         printf("AFMOYA DEBUGING, printf BEFORE \"if (i < 3)\" statement, for (unsigned i = 0; i < mbi->mods_count; ++i) statement iteration %d \n", i);

         printf("=> firstmodulestart  %lx    lastmoduleend %lx \n", firstmodulestart, lastmoduleend);

         printf("=> mbi_mod_                start %lx    end %lx        size %lx \n", start, end, size);

         printf("=> Region from            start %llx    end %llx    size %llx \n", from.begin(), from.end(), from.size());

         printf("=> Region *this_module    start %llx    end %llx    size %llx \n", this_module->begin(), this_module->end(), this_module->size());

       if (i < 3)

         {

             printf("AFMOYA DEBUGING, printf INSIDE \"if (i < 3)\" statement \n");

             

           if (start < lastmoduleend)

             {

                 printf("=> printf INSIDE \"if (start < lastmoduleend)\" statement \n");

                 

               Region to(lastmoduleend, lastmoduleend + (end - start) - 1);

               

                 printf("=>=> Region to    start %llx    end %llx \n", to.begin(), to.end());

                 

               if (module_area.contains(to))

                 {

                     printf("=>=> printf INSIDE \"if (module_area.contains(to))\" statement \n");

                     

                   move_module(mbi, i, this_module, &to, true);

                   lastmoduleend = l4_round_page(this_module->end());

                   

                     printf("=>=>=> lastmoduleend %lx received from rounded  this_module->end() %llx \n", lastmoduleend, this_module->end());

                 }

             }

             printf("AFMOYA DEBUGING, continue statement INSIDE if (i < 3) statement in the iteration %d \n\n", i);

           continue;

         }

         

         printf("AFMOYA DEBUGING, execution continues after \"if (i < 3)\" statement \n");

         

       if (start >= modaddr) {

           printf("AFMOYA DEBUGING, continue statement INSIDE if (start >= modaddr) statement in the iteration %d \n\n", i);

         continue;

         }

         

         printf("AFMOYA DEBUGING, execution continues after \"if (start >= modaddr)\" statement \n");

         

       unsigned long long to = regions.find_free(module_area, size, L4_PAGESHIFT);

       assert(to);

         

         printf("AFMOYA DEBUGING,  long long to = regions.find_free(module_area, size, L4_PAGESHIFT) %llx \n", to);

         

       Region m_to = Region(to, to + size - 1);

       

         printf("AFMOYA DEBUGING,  Region m_to    start %llx    end %llx    size %llx \n", m_to.begin(), m_to.end(), m_to.size());

         

       move_module(mbi, i, this_module, &m_to, true);

         

         printf("AFMOYA DEBUGING, end of the iteration %d \n\n", i);

     }

I hope those results help us.
Best regards,
                         Alexis.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20140402/d110dc42/attachment.html>


More information about the l4-hackers mailing list