[U-Boot] MPC8xx malloc failing

saugat mitra saugat.mitra at gmail.com
Wed Feb 2 14:04:47 CET 2011


Hi Wolfgang

The project was started more than a year back and that time 2009.11
was the latest version, so we are still continuing with the same.
On running the back trace I found that functions to be called were from -
malloc
env_relocate
board_init_r
trap_init

To be more precise the code was dying while in the following loop from
the function malloc() in dlmalloc.c. It executes the loop twice before
crashing.

 for (victim = last(bin); victim != bin; victim = victim->bk)
    {
      victim_size = chunksize(victim);
      remainder_size = victim_size - nb;
      if (remainder_size >= (long)MINSIZE) /* too big */
      {

  --idx; /* adjust to rescan below after checking last remainder */
  break;
      }

      else if (remainder_size >= 0) /* exact fit */
      {
  unlink(victim, bck, fwd);
  set_inuse_bit_at_offset(victim, victim_size);
  check_malloced_chunk(victim, nb);
  return chunk2mem(victim);
      }

    }


Also when I removed a few print(debug) statements the backtrace gave
the first function to be puts instead of malloc, other functions
were the same as earlier.

cpu is mpc8xx.

Thanks & Regards
Saugat.

On Tue, Feb 1, 2011 at 6:59 PM, Wolfgang Denk <wd at denx.de> wrote:
> Dear saugat mitra,
>
> In message <AANLkTi=SOo3RaVp8asHBRUYnOq4TTC_F07Miz3WrKRKT at mail.gmail.com> you wrote:
>>
>> I have moved onto 2009.11, though more new versions are available but still ..
>
> Stefano wrote:
>
> | > make yourself a favour and upgrade to last U-Boot version...
>
> Can you please explain why you stick again with code that is > 1 year
> old?
>
>
>> I am using a MPC8XX based board( as earlier), but now the code is crashing
>> in env_relocate() function. On applying debug prints I found that the
>> code was failing
>> in malloc with a Bus Fault with the following dump -
>
> It would have been easier if you had just decoded the backtrace:
>
>> Call backtrace:
>> 00FC9988 00FDCD34 00FCCD60 00FC93B8
>> machine check
>
> Which routines are these addresses from?
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> In C we had to code our own bugs, in C++ we can inherit them.
>


More information about the U-Boot mailing list