Skip to content

Commit

Permalink
Merge pull request #64 from pranith/master
Browse files Browse the repository at this point in the history
Fix various bugs
  • Loading branch information
pranith authored Jan 11, 2017
2 parents e73c639 + c2081bd commit 22e9095
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 525 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CXXFLAGS ?= -g -Wall -Idistorm/ -std=c++0x -march=native
QSIM_PREFIX ?= /usr/local
LDFLAGS = -L./
LDLIBS = -lqsim -ldl -lrt
LDLIBS = -lqsim -ldl -lrt -pthread

QEMU_BUILD_DIR=build

Expand Down
4 changes: 2 additions & 2 deletions build-qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ mkdir -p $QSIM_PREFIX/lib/
if [ ! -d "$build_dir" ]; then
mkdir -p $build_dir
cd $build_dir
QEMU_CFLAGS="-I${QSIM_PREFIX} -g -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wtype-limits -fstack-protector-all -Wno-uninitialized" ../qemu/configure --extra-ldflags=-shared --target-list=aarch64-softmmu,x86_64-softmmu --disable-pie --disable-brlapi --disable-rdma --disable-rbd --disable-tcmalloc --disable-xen --disable-gtk --disable-uuid --disable-glusterfs $debug_flags
QEMU_CFLAGS="-I${QSIM_PREFIX} -g -fPIC -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wtype-limits -fstack-protector-all -Wno-uninitialized" ../qemu/configure --extra-ldflags=-shared --target-list=aarch64-softmmu,x86_64-softmmu --disable-pie --disable-brlapi --disable-rdma --disable-rbd --disable-tcmalloc --disable-xen --disable-gtk --disable-uuid --disable-glusterfs --disable-xfsctl $debug_flags
else
cd $build_dir
fi

make -j64
make -j4
cd ..
rm -f build
ln -s $build_dir build
3 changes: 2 additions & 1 deletion doc/user_guide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ \section{Installation and Setup}

Ensure that you have atleast 12 GB free disk space before you download the
userland imagegs. Change directory to the cloned qsim directory and run
$setup.sh$. This will setup the qsim project.
$setup.sh$. This will setup the qsim project. Once you are done setting up,
explore the $examples$ directory for sample applications.

\chapter{QSim Software Architecture} \label{chap:arch}
QSim is an effort in combining several large and complex open source software
Expand Down
14 changes: 10 additions & 4 deletions examples/arm64/cachesim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <string>

#include <qsim.h>
#include <qsim-load.h>

using Qsim::OSDomain;

Expand Down Expand Up @@ -234,17 +235,19 @@ int main(int argc, char** argv) {
istringstream s(argv[1]);
s >> n_cpus;
} else {
fprintf(stderr, "Usage: %s <num_cpus> -state <state_file>\n", argv[0]);
fprintf(stderr, "Usage:\n INTERACTIVE: %s <num_cpus>\n"
" HEADLESS: %s <num_cpus> -state <state_file> -bench <benchmark.tar>\n",
argv[0], argv[0]);
exit(0);
}

OSDomain *osd_p(NULL);

if (argc >= 4) {
if (argc >= 6) {
// Create new OSDomain from saved state.
osd_p = new OSDomain(n_cpus, argv[3]);
} else {
osd_p = new OSDomain(n_cpus, qsim_prefix + "/../arm64_images/vmlinuz", "a64", QSIM_INTERACTIVE);
osd_p = new OSDomain(n_cpus, qsim_prefix + "/images/arm64_images/vmlinuz", "a64", QSIM_INTERACTIVE);
}
OSDomain &osd(*osd_p);

Expand All @@ -253,7 +256,10 @@ int main(int argc, char** argv) {

// If this OSDomain was created from a saved state, the app start callback was
// received prior to the state being saved.
//if (argc >= 4) tw.app_start_cb(0);
if (argc >= 6) {
Qsim::load_file(osd, argv[5]);
tw.app_start_cb(0);
}

osd.connect_console(std::cout);

Expand Down
13 changes: 11 additions & 2 deletions examples/arm64/simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <thread>

#include <qsim.h>
#include <qsim-load.h>
#include <capstone.h>

#include "cs_disas.h"
Expand Down Expand Up @@ -123,6 +124,11 @@ int main(int argc, char** argv) {
if (argc >= 2) {
istringstream s(argv[1]);
s >> n_cpus;
} else {
fprintf(stderr, "Usage:\n INTERACTIVE: %s <num_cpus>\n"
" HEADLESS: %s <num_cpus> -state <state_file> -bench <benchmark.tar>\n",
argv[0], argv[0]);
exit(0);
}

// Read trace file as a parameter.
Expand All @@ -137,7 +143,7 @@ int main(int argc, char** argv) {
// Create new OSDomain from saved state.
osd_p = new OSDomain(n_cpus, argv[3]);
} else {
osd_p = new OSDomain(n_cpus, qsim_prefix + "/../arm64_images/vmlinuz", "a64", QSIM_INTERACTIVE);
osd_p = new OSDomain(n_cpus, qsim_prefix + "/images/arm64_images/vmlinuz", "a64", QSIM_INTERACTIVE);
}
OSDomain &osd(*osd_p);

Expand All @@ -146,7 +152,10 @@ int main(int argc, char** argv) {

// If this OSDomain was created from a saved state, the app start callback was
// received prior to the state being saved.
//if (argc >= 4) tw.app_start_cb(0);
if (argc >= 6) {
Qsim::load_file(osd, argv[5]);
tw.app_start_cb(0);
}

osd.connect_console(std::cout);

Expand Down
2 changes: 1 addition & 1 deletion examples/x86/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ QSIM_PREFIX ?= /usr/local
CXXFLAGS ?= -g -O2 -std=c++0x -Wall -I$(QSIM_PREFIX)/distorm/ -I$(QSIM_PREFIX)/include -L$(QSIM_PREFIX)/lib
LDLIBS ?= -lqsim -pthread -ldl

EXAMPLES = qtm simple io-test cachesim headless cachesim_headless virt_rw
EXAMPLES = qtm simple io-test cachesim virt_rw

all: $(EXAMPLES)

Expand Down
13 changes: 11 additions & 2 deletions examples/x86/cachesim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <string>

#include <qsim.h>
#include <qsim-load.h>

using Qsim::OSDomain;

Expand Down Expand Up @@ -233,6 +234,11 @@ int main(int argc, char** argv) {
if (argc >= 2) {
istringstream s(argv[1]);
s >> n_cpus;
} else {
fprintf(stderr, "Usage:\n INTERACTIVE: %s <num_cpus>\n"
" HEADLESS: %s <num_cpus> -state <state_file> -bench <benchmark.tar>\n",
argv[0], argv[0]);
exit(0);
}

OSDomain *osd_p(NULL);
Expand All @@ -241,7 +247,7 @@ int main(int argc, char** argv) {
// Create new OSDomain from saved state.
osd_p = new OSDomain(n_cpus, argv[3]);
} else {
osd_p = new OSDomain(n_cpus, qsim_prefix + "/../x86_64_images/vmlinuz", "x86", QSIM_INTERACTIVE);
osd_p = new OSDomain(n_cpus, qsim_prefix + "/images/x86_64_images/vmlinuz", "x86", QSIM_INTERACTIVE);
}
OSDomain &osd(*osd_p);

Expand All @@ -250,7 +256,10 @@ int main(int argc, char** argv) {

// If this OSDomain was created from a saved state, the app start callback was
// received prior to the state being saved.
//if (argc >= 4) tw.app_start_cb(0);
if (argc >= 6) {
Qsim::load_file(osd, argv[5]);
tw.app_start_cb(0);
}

osd.connect_console(std::cout);

Expand Down
Loading

0 comments on commit 22e9095

Please sign in to comment.