usart: document buffer allocation

Change-Id: If4b3543aceb82e75916a8193830321d7cb8818e8
build: Build verbosely with V=1

Add crude verbosity to the build system.  Building with V=1 will print
all commands as they are executed.  It is a bit crude, so you will also
see the echo commands for pretty printing, but it is good to get
specific commands.

Change-Id: Iadc58d3aabe2c7fa2849b1b11d2cc8db6cc928b9
buf_stream: make methods static

Change-Id: I0e4145eed016989ad39bdddc5b02eb796f45f4b2
buf_stream: Take buffer length argument

Add buffer length argument to open_buf_stream().  This resource will not
read or write beyond this buffer length.  Note that this is a change in
API, and will break existing implementations, but adds significant
safety to the device.

Change-Id: Ia92daaa5d7cd81d2ade2723b1a27676aa9df59d9
lib: transform sprintf to scnprintf

Replace sprintf with scnprintf, which uses the updated buffer length API
for buffer streams.  This means that a length argument must be passed
along with the buffer to be written.

This function returns the number of bytes actually written to the
buffer, hence the name scnprintf instead of snprintf.  See
http://lwn.net/Articles/69419/ for more details.

Change-Id: I5072c7ea8a1686324ca6355635e00fdd99d81610
tests: Add buffer stream tests

Change-Id: Iabd92b57179da6953265805fda9886a7ee71e144
tests: Copy error to buffer, do not print

Change-Id: Id65c4b0744ac780fbfebc354d88e379a57039f0a
tests: remove unnecessary header

Change-Id: I27345d032a2e317ddc4be60d604644e71c2816f9
tests: Add regression test for strreverse buffer overflow

Change-Id: I3c15f29d4f8a57152a35a14056a772c16aaa564d
lib: Fix strreverse buffer overflow

strreverse always skipped the first byte of the given buffer when
searching for the end, causing it to miss the end of an empty string,
and start walking through memory looking for another NULL.

Change-Id: I4818d317e050c8718d7cceef8cfd02e85ff1cf4b
buf_stream: Fix bad free

env was allocated using kmalloc(), then freed using free(), causing a
memory leak in the buddy allocator.  Correct this by allocating env with
malloc().

Change-Id: I26a5b56483270ca39122c42cbb17f593a39b5797
shell: zero command history buffers

These buffers are displayed when scrolling through history, they need to
be initialized to prevent garbage from displaying.  This was
particularly evident when tab completing.

Change-Id: Ib4b70217616bb0103accf77993a9a023294d5e2a
mm: bitfield allocator

This adds the "bitfield" allocator, which uses bitfields to track
free memory. It manages memory as a collection of blocks, where a
block is a collection of grains. A grain is the smallest amount of
memory that can be allocated. Blocks have a freemask, a bitfield to track
free grains. It has a configurable grain size, and divides memory
into these blocks, where each block covers 32 grains. The least
significant bit of the freemask corresponds to the first grain.

Change-Id: I00f127ea5cf56dc0e6f1858fb5ff88048dac6612
tests: add test for mallocing UINT_MAX

Change-Id: I8fe819cf1cf44d99d84d4f17e196cca47fabbdd7
mm: add checks for allocating UINT_MAX

Change-Id: I0037dfcd792c9d9dd32ed27229980a0800067d6b
stdint: Provide most of the standard contents

Use values/types from GCC.  Also switch size_t type to be provided by
GCC.

Change-Id: I9910b783ba5073c9bd4970ef8dc8c86ecb709129
limits: Use GCC provided values, when available

Also, fix odd backticks

Change-Id: Ic90992936f2d4b8e622af562fa63cf79fc611c6b
mm: Use UINT16_MAX from stdint.h

Change-Id: I2615a72b11127a6107eacacbc8a08a6f63448598
mm: Use size_t for malloc

That is what the standard says to do

Change-Id: I139691baff87a3688b5597698dcf4c8b201cf4a0
Use uintptr_t for pointer arithmetic

uintptr_t is specifically defined to hold void * pointers in order to do
arthimetic on.  Use it where we do pointer arithmetic in order to
maximize portability and safety.

Change-Id: I77261a7e85cbc8036159d2f6931e458e0780cc48