mmu: fix an unsigned/signed comparison error

-Werror=sign-compare complains about when comparing (unsigned)level with
page_mapper.nr_page_sizes().
Since nr_page_sizes() is meaningful only when it's non-negative and the
mmu::nr_page_sizes is unsigned, changing the return types of all
nr_page_sizes functions to unsigned is reasonable.

Signed-off-by: Boqun Feng <boqun.feng@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: add unused attribute to unused function

-Werror=unused-function complains symbol_binding is unused, add an
attribute of unused to mark this function unused.

Signed-off-by: Boqun Feng <boqun.feng@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: fix an unused-value error in LOCK/UNLOCK

According to http://gcc.gnu.org/gcc-4.9/porting_to.html, gcc now warns
about unused right-hand side of a comma expression that contains no side
effects.
Rewrite LOCK/UNCLOCK using inline funciton instead of comma expression.

Signed-off-by: Boqun Feng <boqun.feng@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: include inlined-by functions in the backtrace

Fixes #255.

The default OSv build has plenty of inlined functions. The tracing
tool is using 'addr2line -Cfp' to resolve symbols. That mode of
operation of addr2line yields one line per symbol and that line will
only show the inlined function, even though the information about
"logical" callers is also available.

Example:

  $ addr2line -Cfp -e build/release/loader.elf
  0x32963d
  lock_guard at (...)

There is the '-i' switch we could use to also see code locations into
which this function was inlined:

  $ addr2line -Cfpi -e build/release/loader.elf
  0x32963d
  lock_guard at (...)
   (inlined by) lock_guard_for_with_lock at (...)
   (inlined by) mmu::vm_fault(unsigned long, exception_frame*) at (...)

In this case, 'mmu::vm_fault' is much more interesting than
lock_guard and thus we would like to show it in the backtrace. This change
allows symbol resolvers to return multiple source addresses per raw
address and changes the default implementation to return inlined-by
functions by default.

The new behavior can be suppressed with --no-inlined-by.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: suppress displaying of _M_invoke in the backtrace

It's just cluttering the backtrace.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
elf: use symbol_binding() where appropriate

There is already defined (but unused before this patch) function that
extracts binding type from Elf_Sym::st_info.

Signed-off-by: Pawel Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>