core: Makefile don't worry about how deep the files are

In preparation for importing lwip modify the makefile
to not care how deeply nested the source files are in the
tree.
lwip: Import lwip version 1.3.2

Peter's comment on the import of 1.3.1 was:
> Import the lwip TCP/IP stack, with the intent to use it instead of
> raw PXE calls in PXELINUX.  Lots of work to be done here, though.

I am taking Peters original mostly working port updating it to
the newest syslinux and the most recent stable version of lwip
and seeing if I can get a usable mergable version

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
lwip: Delete the ipv6 support and the tests.

The ipv6 suppport has duplicate symbol names and will
cause conflicts if built.

Similarly the tests are unneeded and require an unknown about
of extra configuration to get the working to no apparent purpose.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
lwip: Minimal configuration to get lwip building in syslinux

- Disable all of lwip advanced features
- Redeclare kaboom because including core.h causes the
  artificial namespace conflict on lfree.
t
  lfree is a global sylinux function and lwip static variable.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
stddef.h: add container_of()

Add the container_of() macro.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: declare jiffies_t and mstime_t and use them.

Create specific types for jiffies and for the output of the
millisecond timer and use them where appropriate in the code
base.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
core: simple thread library

Simple thread library with the intent of making lwIP easier to port.
-- Modified to use milliseconds instead of jiffies,
   as lwIP expresses everything in milliseconds. EWB

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
core: thread: have start_thread() allocate memory dynamically

Have start_thread() allocate memory dynamically, using malloc().
XXX: should probably free that memory in __exit_thread()... could be
"interesting".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: thread: add option to not wait on a semaphore at all

Implement a "trywait" option... if timeout is set to -1, then timeout
immediately if the semaphore isn't available.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: add simple mailbox library

A very simple mailbox library, designed for lwIP porting.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: thread: merge mbox_post() and mbox_trypost()

Merge mbox_post() and mbox_trypost() into a single function with a
timeout parameter.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: thread:  Add a global errno variable to support lwip

I don't have a clue why Peter's earlier port did not run into
problems but I can't get thread_asm.S to link without this.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
core: thread: move most thread state to stack; task switch errno

Move most our thread state to the stack.  Task switch the errno
variable.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: thread: add a "timeouts" pointer to the thread structure

Add a "timeouts" pointer to the thread structure; this is a private
per-thread pointer for the benefit of lwIP.  This is ad hoc, but a lot
easier than implementing TLS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core thread: Rename timeouts pvt to better reflect it's use.

lwip needs to find a per thread list of timeouts when it calls
sys_arch_thread_timeouts().  Since we support threads we
can easily support this extra bit of private data.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
thread: add support for locking the scheduler

Add support for locking the scheduler; this is needed for the pm
return hook to operate properly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core: thread: add static declaration of semaphores

Add the ability to statically declare initialized semaphores.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
core: thread: add a name field

Add a name field to struct thread, for debugging's sake.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
core: Move kaboom into it's own header.

This allows kaboom to be used by lwip without having to inclued all of core.h

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
lwip: Use kaboom.h

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>