ec2-utils: introduce optional timeout for wait for instance start helper

This is useful to avoid inifinite wait in case of
instance startup failure.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
console: Fix echo on VGA console

This fixes #360, which is about input echo not being visible on the VGA
console until a newline is pressed - while it is immediately visible on
the serial console.

As part of the multi-console work (see commit c0a1e555), a "console_driver"
interface layer was added whose write side includes not just the write()
function we always had, but now also a flush(). In the serial console
implementation, the flush() does nothing, but in the VGA console
implementation, nothing is displayed until either a flush() or a newline
is written. So in line-discipline.cc, it is no longer enough to call
write() to echo the imput characters - we now need to also add a call
to flush() after every write(). Adding it solves this bug.

This does not solve the backspace not working on the VGA console. This is a
separate issue that will be handled in a separate patch.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
kbd: change mapping of backspace from ^H to ^?

This patch makes backspace work correctly on the VGA console (this is
part of issue #360).

Our "multiplexed console" has one termios(3) setting, but two distinct
keyboards - the serial console input and the PS/2 keyboard. We defaulted
the VERASE character to ^? (\177, ASCII "DEL"), expecting that this is what
we will get on the serial console when a user presses the backspace key,
but our PS/2 keyboard driver generated a ^H (\10, ASCII "BS") and therefore
was not recognizing backspaces.

So this patch changes the PS/2 keyboard driver to generate a ^? on
backspace press, instead of ^H. This is what the Linux console, and most
Linux terminal emulators, also generate for this key.

I have to admit that I am really saddened by sending this patch. For
years I've been warning against the slow but sure attempts to displace
the ASCII BS character - which backspaces used to generate, and
use the DEL character instead. For years I've insisted on keeping
backspace==BS on my systems, and this is also how my home desktop is
set up. But I've obviously lost, and all modern Linux distributions
return ^?, not ^H, when a backspace is pressed, and set VERASE to ^?.

Some of my old posts about this backspace/delete issue:
http://copilotco.com/mail-archives/linux-kernel.2001/msg47697.html
https://www.mail-archive.com/linux-il@cs.huji.ac.il/msg52834.html

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libosv: use .balign instead of .align

Directive .align has different behavior depending on the target
architecture. For some archs (e.g. x64) it makes sure that the location
counter is a multiple of its parameter. For other archs (e.g. aarch64)
the argument is a number of low order bits that have to be zero (i.e.
.align 4 makes location counter a multiple of 2^4). Directive .balign
has consistent behavior, regardless of the target architecture.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libosv: add padding after the content of the note

Both name and desc fields should include a padding so that their size
is a multiple of 4 (fields namesz and descsz contain size of the respective
fields without that padding, though).

With this patch readelf -n no longer complains about corrupted notes.

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