xtensa: ISS: fix specific simcalls

Simcalls that take memory buffer definitely need wmb or rmb to make sure
gcc doesn't optimize away code that fills the buffer.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: ISS: fix rs_put_char

ISS serial console prints garbage instead of symbols printed via
rs_put_char. gcc optimizes away putting prined symbol into memory buffer
because there's no evidence that the buffer is used afterwards.

Make rs_put_char and rs_write use simc_write that has explicit wmb.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa WIP: fix memmove(), bcopy(), and memcpy().

1. Atheros modules use memmove() with overlapping
   src and dst. This fix to memmove makes it handle
   overlaping src and src using a C library from the
   uClibc library. Performance loss over asm code is
   5% for aligned data and 75% for unaligned data
   for test moving data both forward and backward
   with random overlapping from 1 to 64 bytes.

2. Fixed memcpy() to use unsigned arithmetic for
   addresses comparisons.

3. Modified bcopy() to call memmove(). It's suppose to
   handle overlapping src and data like memmove(). It's
   hardly used, just IPV6 interface macro possibly.

memmove.c is using a local memcopy.h file from uClibc.
It likely belongs in ../include/asm/ but I'll try come
up with an assembler version of memmove() in the not to
distant future and we will then drop memmove.c and it's
associated memcopy.h from uClibc.

Signed-off-by: Pete Delaney <piet@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Ported-from: a02e66a43f842d6042eab5561e967d0a4aa438ea
xtensa WIP: copy_thread with CLONE_VM must not copy live parent AR windows

When doing a fork (new VM), the new task has a mirror image of the
parent's stack, so keeps the same live register windows etc.
However when doing a clone with CLONE_VM, keeping the same VM
(eg. when creating a new thread), the child starts afresh on a new
stack -- it cannot share any part of the parent stack.  It
especially cannot have the same live AR windows as the parent,
otherwise it will overwrite the parent stack on overflow, likely
causing corruption.  (and so it did...)

Effectively, the register windows need to be spilled.
Turns out it's much easier to simply not copy parent register
windows when CLONE_VM is set.

Signed-off-by: Marc Gauthier <marc@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Ported-from: b313742ce67fc3420475e8f9496538b58bd8c43e
xtensa: fix missing return in do_page_fault for SIGBUS case

Signed-off-by: Marc Gauthier <marc@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Ported-from: 6a6e757d0eb01c37d14a6b795b1b01b2eb05b121
xtensa: Add config files for Diamond 233L - Rev C processor variant

The Diamond 233L processor is a pre-configured Xtensa processor tailored
for Linux application.

Signed-off-by: Pete Delaney <piet@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa WIP: add Three Core HiFi-2 MX Variant.

Signed-off-by: Pete Delaney <piet@tensilica.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa WIP: add support for the LX60 board

The Avnet LX60 board is an FPGA board that can be configured with
an Xtensa processor and an OpenCores Ethernet device.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
xtensa: add U-Boot image support (uImage).

Signed-off-by: Ross Morley <ross@linux-xtensa.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Ported-from: 47e4a5dfe8f33339cb6aec3efd198c0f8aebf96b