first steps towards a QEMU target backend

- This commit only enables linking against QEMU.  The abstraction layer is
  completely dysfunctional at this time.
- QEMU's build system needs to be patched in order to create a static
  library.  This patch is currently not included in the Fail* repository.
- QEMU's JIT compilation may complicate or even preclude the implementation
  of some of Fail*'s backend abstractions.  Only a minimal subset (serial
  I/O, memory, memory writes, save/restore) is planned for the first phase.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1615 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-09-12 14:07:03 +00:00
parent f9c96ddf2d
commit e715149033
16 changed files with 395 additions and 22 deletions

64
cmake/FindLibUUID.cmake Normal file
View File

@ -0,0 +1,64 @@
# - Try to find UUID (Universally Unique Identifier)
# Once done this will define
#
# UUID_FOUND - system has UUID
# UUID_INCLUDE_DIRS - the UUID include directory
# UUID_LIBRARIES - Link these to use UUID
# UUID_DEFINITIONS - Compiler switches required for using UUID
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
# in cache already
set(UUID_FOUND TRUE)
else (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
find_path(UUID_INCLUDE_DIR
NAMES
uuid/uuid.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(UUID_LIBRARY
NAMES
uuid
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(UUID_INCLUDE_DIRS
${UUID_INCLUDE_DIR}
)
set(UUID_LIBRARIES
${UUID_LIBRARY}
)
if (UUID_INCLUDE_DIRS AND UUID_LIBRARIES)
set(UUID_FOUND TRUE)
endif (UUID_INCLUDE_DIRS AND UUID_LIBRARIES)
if (UUID_FOUND)
if (NOT UUID_FIND_QUIETLY)
message(STATUS "Found UUID (Universally Unique Identifier): ${UUID_LIBRARIES}")
endif (NOT UUID_FIND_QUIETLY)
else (UUID_FOUND)
if (UUID_FIND_REQUIRED)
message(FATAL_ERROR "Could not find UUID (Universally Unique Identifier)")
endif (UUID_FIND_REQUIRED)
endif (UUID_FOUND)
# show the UUID_INCLUDE_DIRS and UUID_LIBRARIES variables only in the advanced view
mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)
endif (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)

62
cmake/qemu.cmake Normal file
View File

@ -0,0 +1,62 @@
#### Add some custom targets for qemu-system-x86_64
if(BUILD_QEMU)
message(STATUS "[${PROJECT_NAME}] Building QEMU variant ...")
SET(VARIANT qemu)
# ./configure --prefix=$(echo ~/localroot/usr) --enable-sdl --disable-vnc --disable-curses --disable-curl --enable-system --target-list=x86_64-softmmu
# LIBS = -lrt -pthread -lgthread-2.0 -lglib-2.0 -lutil -luuid -lSDL -lX11 -lm -lz
# -L/usr/lib -lSDL -lasound -latk-1.0 -lcairo -lfontconfig -lfreetype -lgdk_pixbuf-2.0 -lgdk-x11-2.0 -lgio-2.0 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -lgtk-x11-2.0 -lICE -lm -lncurses -lpango-1.0 -lpangocairo-1.0 -lpangoft2-1.0 -lrt -lSM -lvga -lvgagl -lwx_baseu-2.8 -lwx_gtk2u_core-2.8 -lX11 -lXpm -lXrandr -pthread)
find_package(SDL) # -lSDL
if(SDL_FOUND)
set(qemu_library_dependencies ${qemu_library_dependencies} ${SDL_LIBRARY})
endif(SDL_FOUND)
unset(FindSDL_DIR CACHE)
unset(SDLMAIN_LIBRARY CACHE)
unset(SDL_INCLUDE_DIR CACHE)
unset(SDL_LIBRARY CACHE)
find_package(GTK2 COMPONENTS gtk)
if(GTK2_FOUND)
set(qemu_library_dependencies ${qemu_library_dependencies} ${GTK2_GLIB_LIBRARY} -lgthread-2.0)
endif(GTK2_FOUND)
unset(FindGTK2_DIR CACHE)
unset(GTK2_GIOCONFIG_INCLUDE_DIR CACHE)
unset(GTK2_GIO_INCLUDE_DIR CACHE)
find_package(X11) # -lX11
if(X11_FOUND)
set(qemu_library_dependencies ${qemu_library_dependencies} ${X11_X11_LIB})
endif(X11_FOUND)
find_package(ZLIB) # -lz
if(ZLIB_FOUND)
set(qemu_library_dependencies ${qemu_library_dependencies} ${ZLIB_LIBRARIES})
endif(ZLIB_FOUND)
find_package(LibUUID) # -luuid
if(UUID_FOUND)
set(qemu_library_dependencies ${qemu_library_dependencies} ${UUID_LIBRARIES})
endif(UUID_FOUND)
# FIXME: some libraries still need to be located the "cmake way"
set(qemu_library_dependencies ${qemu_library_dependencies} -lrt -pthread -lutil -lm)
set(qemu_src_dir ${PROJECT_SOURCE_DIR}/simulators/qemu)
set(qemu_lib "${qemu_src_dir}/x86_64-softmmu/qemu-system-x86_64.a")
add_custom_command(OUTPUT "${qemu_lib}"
COMMAND +make -C ${qemu_src_dir} CFLAGS=\"-I${PROJECT_SOURCE_DIR}/src/core -I${CMAKE_BINARY_DIR}/src/core\"
COMMENT "[${PROJECT_NAME}] Building qemu-system-x86_64.a"
)
# make sure aspects don't fail to match in entry.cc
include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
add_executable(fail-client "${qemu_lib}")
target_link_libraries(fail-client "${qemu_lib}" fail ${qemu_library_dependencies})
install(TARGETS fail-client RUNTIME DESTINATION bin)
# a few QEMU-specific passthrough targets:
add_custom_target(qemuclean
COMMAND +make -C ${qemu_src_dir} clean
COMMENT "[${PROJECT_NAME}] Cleaning all up (clean in qemu)"
)
endif(BUILD_QEMU)