build: fix building in directories containing the string 'debug'

An unrestrained grep ate the gcc include directory.

Fix by grepping for the right things.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
trace: fix bad interaction between debug mode, templates, ld, and 'asm goto'

A call to safe_load() when serializing a const char* trace argument
generates a reference to a label from .text.fixup to a template function
(safe_load()).  If this function is out-of-line, then ld can eliminate it,
as duplicate copies of templates are removed (except one).  This causes a
linker error.

Fix by marking the function (and template functions that call it) as always
inline.

Fixes #217.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
pci: Fix header type check

Header Type is 8-bit. The bit 7 is used to identify a multi-function
device. The lower bit 1 and bit 0 are used to identify the header type.

   00b is defined for Normal devices
   01b is defined for PCI-to-PCI bridges
   10b is defined for PC Card Standard

Fix the check by masking the lower 2 bits only.

This patch fixes the device probe on VMware Workstation.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Introduce scsi-common

Split the common scsi code from virtio-scsi.cc to scsi-common.cc. This way, we can share
code with other scsi driver, e.g., vmw-pvscsi.

Tested on local kvm and GCE.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vmw-pvscsi: Initial support

This driver is for VMware's pvscsi disk. It has better performance than
using AHCI device in VMware. This driver uses the common scsi code in
scsi-common.

This driver is written from scratch. QEMU and Linux pvscsi drivers were
used as reference as there's no specification available.

Tested on QEMU's pvscsi implementation and VMware Workstation.

Signed-off-by: Asias He <asias@cloudius-systems.com>
virtio-scsi: Do not assert on response in req_done

req->response can be not zero when in some cases, for instance, when the
REPORT LUNS command send to a target which does not exist. Pass the
handling of req->response to command handling.

This allows us to probe multiple targets.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Introduce config.max_target

Use this to limit max number of target to scan.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Enable multiple target scan

Since we can handle non-exist target correctly now, we can enable
multiple target scan.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vmw-pvscsi: Limit max number of LUNs per target to 1.

VMware supports only 1 lun per target. Limit the max_lun to speed up
probe.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Add scsi_common::handle_bio helper

This eliminates duplicated code in make_request() of scsi driver.

Signed-off-by: Asias He <asias@cloudius-systems.com>
scsi: Specify virtual keyword for the virtual functions

Avi suggested to add the virtual keyword to reduce possible confusion.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Merge branch 'pvscsi' of https://github.com/asias/osv

VMware pvscsi support from Asias He.

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: Python 3 support for run.py

Add Python 3 support in scripts/run.py. Tested with Python 3.3.4 & Python 2.7.6.

Some style issues (mixed tabs spaces, trailing spaces) are also fixed.

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Make assertion failures visible

We didn't notice this, but disabling the debugging messages also disabled
the assertion failure messages! The user only sees "Aborted" and you
can only tell what happened with a debugger.

Instead of using kprintf(), pass the message directly to abort(), which
will print its argument to the console as expected.

Since we using the overloading abort(...), it now needs to be done in a
C++ source file. So move this function from libc/exit/assert.c, to
runtime.cc.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
add malloc-less demangler

Malloc-less implementation of demangler for backtrace on abort, using
libstdc++ demangle API.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
add demangle on build.mk

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Add backtrace on abort()

Print backtrace on abort().

To prevent breaking system before backtrace printouted, these calls are
all malloc-less, disabled context-switch by cli().

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
add atof() to libc

This is required for '--interval' option on iperf.
The code was taken from musl-libc.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
run: add --pass-args option

Useful for playing around with qemu (like starting a monitor on a socket,
for example).

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
apps: move submodule head

701b6d66506b3e659c979547b3f2b1d73c5c5305 tomcat: add missing shebang line to GET
98abb74d71aac04bb818cf9abe7a4efeafa3cce1 Added sqlite module to modules.json
e69951f6a4561fb675b87e918c23b15ffde35474 add SQLite

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>