tcg/optimize: fix setcond2 optimization

When setcond2 is rewritten into setcond, the state of the destination
temp should be reset, so that a copy of the previous value is not
used instead of the result.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
osdep.h: include sys/types.h for ssize_t definition

This fixes build for mingw32

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
sd.c: introduce AIO related members in SD state

New state members will be used for async IO implementation later.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
sd.c: introduce variable for trekking valid data

Initialize it appropriately when various commands are processed.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
sd.c: introduce "start bit" and "busy deasserted" callbacks

Start bit callback models arrival of first bit of data on card's DAT line.

Busy deasserted callback models releasing of DAT0 line by card when it
transitions from a programming state to a writing data state.

Both of them will be used for async IO later.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
sd.c: use callbacks as a flag to use async IO

This is temporary to distinguish between sync and async users.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
sd.c: introduce async read operation

It will only be used if start bit and databusy callbacks were initialized
by user of SD card model.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
sd.c: introduce async write interface

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
pl181.c: convert to async IO SD card interface

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>