Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LIBS+=-lz $(LIBS_TOOLS)
HELPERS-$(CONFIG_LINUX) = qemu-bridge-helper$(EXESUF)

ifdef BUILD_DOCS
DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
DOCS=tlmu-doc.html qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
ifdef CONFIG_VIRTFS
DOCS+=fsdev/virtfs-proxy-helper.1
endif
Expand Down
4 changes: 2 additions & 2 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ obj-$(CONFIG_TCG_INTERPRETER) += tci.o
obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
obj-y += fpu/softfloat.o
obj-y += disas.o
obj-y += tlm.o stubs/arch-query-cpu-def.o
obj-y += tlm.o
obj-$(CONFIG_TCI_DIS) += tci-dis.o
obj-y += target-$(TARGET_BASE_ARCH)/
obj-y += disas.o
Expand Down Expand Up @@ -166,7 +166,7 @@ endif
tobj-y = $(obj-y)
tobj-y += $(obj-$(TARGET_BASE_ARCH)-y)

$(LIB_TLMU): $(all-obj-y) ../libqemuutil.a
$(LIB_TLMU): $(all-obj-y) ../stubs/arch-query-cpu-def.o ../libqemuutil.a
$(CC) -shared -Wl,-soname,$(LIB_TLMU) \
-Wl,--version-script=$(SRC_PATH)/lib-tlmu.version \
-Wl,--whole-archive -o $@ $^ -Wl,--no-whole-archive -pthread $(LIBS)
Expand Down
2 changes: 1 addition & 1 deletion tests/tlmu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ run:
LD_LIBRARY_PATH=./lib ./c_example

run-sc-all: run
LD_LIBRARY_PATH=./lib ./sc_example/sc_example
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):./lib ./sc_example/sc_example

clean:
$(MAKE) -C sc_example clean
Expand Down
2 changes: 2 additions & 0 deletions tests/tlmu/c_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ int main(int argc, char **argv)
tlmu_append_arg(&sys[i].t.q, "-kernel");
tlmu_append_arg(&sys[i].t.q, sys[i].elfimage);

tlmu_append_arg(&sys[i].t.q, "-nographic");

/*
* Register our per instance pointer carried back in
* callbacks.
Expand Down
4 changes: 1 addition & 3 deletions tests/tlmu/sc_example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ VPATH=$(SRC_PATH)/tests/tlmu/sc_example/

TLMU=$(CURDIR)/..
# Edit these to match your install paths
SYSTEMC = /opt/systemc
TLM2 = /opt/systemc/TLM-2009-07-15
SYSTEMC = /opt/systemc-2.3.0

CXXFLAGS += -O2 -g
CPPFLAGS += -I $(SRC_PATH)/tests/tlmu
CPPFLAGS += -I $(SYSTEMC)/include/
CPPFLAGS += -I $(TLM2)/include/tlm
CPPFLAGS += -I $(TLMU)/include/tlmu

LDFLAGS = -L $(SYSTEMC)/lib-linux64
Expand Down
12 changes: 12 additions & 0 deletions tests/tlmu/sc_example/iconnect.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class iconnect

SC_HAS_PROCESS(iconnect);
iconnect(sc_core::sc_module_name name);
~iconnect();

virtual void b_transport(int id,
tlm::tlm_generic_payload& trans,
sc_time& delay);
Expand Down Expand Up @@ -104,6 +106,16 @@ iconnect<N_INITIATORS, N_TARGETS>::iconnect (sc_module_name name)
map[i].size = 0;
}
}
template<unsigned int N_INITIATORS, unsigned int N_TARGETS>
iconnect<N_INITIATORS, N_TARGETS>::~iconnect ()
{
unsigned int i;

for (i = 0; i < N_INITIATORS; i++) {
if (t_sk[i]) { delete t_sk[i]; t_sk[i] = 0; }
if (i_sk[i]) { delete i_sk[i]; i_sk[i] = 0; }
}
}

template<unsigned int N_INITIATORS, unsigned int N_TARGETS>
int iconnect<N_INITIATORS, N_TARGETS>::memmap(
Expand Down
2 changes: 1 addition & 1 deletion tests/tlmu/sc_example/magicdev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void magicdev::b_transport(tlm::tlm_generic_payload& trans, sc_time& delay)
<< hex << * (uint32_t *) data
<< " " << sc_time_stamp() << "\n";
sc_stop();
exit(1);
// exit(1);
break;
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/tlmu/sc_example/memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ memory::memory(sc_module_name name, sc_time latency, int size_)
memset(&mem[0], 0, size);
}

memory::~memory()
{
if (mem) { delete [] mem; mem = 0; }
}

void memory::b_transport(tlm::tlm_generic_payload& trans, sc_time& delay)
{
tlm::tlm_command cmd = trans.get_command();
Expand Down
2 changes: 2 additions & 0 deletions tests/tlmu/sc_example/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class memory
const sc_time LATENCY;

memory(sc_core::sc_module_name name, sc_time latency, int size_);
~memory();

virtual void b_transport(tlm::tlm_generic_payload& trans,
sc_time& delay);
virtual bool get_direct_mem_ptr(tlm::tlm_generic_payload& trans,
Expand Down
19 changes: 19 additions & 0 deletions tests/tlmu/sc_example/sc_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ SC_MODULE(Top)
m_qk.set_global_quantum(sc_time(1, SC_US));
}

~Top()
{
if (bus) { delete bus; bus = 0; }
if (magic) { delete magic; magic = 0; }

if (mem[0]) { delete mem[0]; mem[0] = 0; }
if (mem[1]) { delete mem[1]; mem[1] = 0; }

if (cpu[0]) { delete cpu[0]; cpu[0] = 0; }
#if NR_CPUS >=2
if (cpu[1]) { delete cpu[1]; cpu[1] = 0; }
#endif
#if NR_CPUS >=3
if (cpu[2]) { delete cpu[2]; cpu[2] = 0; }
#endif
}

private:
tlm_utils::tlm_quantumkeeper m_qk;
};
Expand All @@ -161,5 +178,7 @@ int sc_main(int argc, char* argv[])

top = new Top("top");
sc_start();

delete top;
return 0;
}
3 changes: 3 additions & 0 deletions tests/tlmu/sc_example/tlmu_sc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ void tlmu_sc::process(void)
tlmu_append_arg(&q, "-gdb");
tlmu_append_arg(&q, gdb_conn);
}

tlmu_append_arg(&q, "-nographic");

is_running = true;
start.notify();
tlmu_run(&q);
Expand Down
11 changes: 9 additions & 2 deletions tlmu-doc.texi
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ CRIS
ARM
@item
MIPS
@item
OpenRISC
@end itemize

I'd expect most (if not all) archs to work with little integration, but
Expand Down Expand Up @@ -117,9 +119,14 @@ configure, e.g:
% ../tlmu/configure --extra-cflags=-fPIC --disable-strip
@end example

If you want to save time, and only build for a subset of the archs (e.g CRIS, ARM and MIPS):
If you want to save time, and only build for a subset of the archs (e.g CRIS, ARM, MIPS and OpenRISC):
@example
% ../tlmu/configure --target-list=cris-softmmu,mipsel-softmmu,arm-softmmu,or32-softmmu --extra-cflags=-fPIC
@end example

If you encountered any trouble, it is safe to disable non-necessary features during configure:
@example
% ../tlmu/configure --target-list=cris-softmmu,mipsel-softmmu,arm-softmmu --extra-cflags=-fPIC
% ../tlmu/configure --target-list=cris-softmmu,mipsel-softmmu,arm-softmmu,or32-softmmu --extra-cflags=-fPIC --disable-pie --disable-curses --disable-sdl --disable-vnc --disable-xen --disable-kvm
@end example


Expand Down
6 changes: 3 additions & 3 deletions ui/vnc-tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport,
}


static gnutls_anon_server_credentials vnc_tls_initialize_anon_cred(void)
static gnutls_anon_server_credentials_t vnc_tls_initialize_anon_cred(void)
{
gnutls_anon_server_credentials anon_cred;
gnutls_anon_server_credentials_t anon_cred;
int ret;

if ((ret = gnutls_anon_allocate_server_credentials(&anon_cred)) < 0) {
Expand Down Expand Up @@ -382,7 +382,7 @@ int vnc_tls_client_setup(struct VncState *vs,
}

} else {
gnutls_anon_server_credentials anon_cred = vnc_tls_initialize_anon_cred();
gnutls_anon_server_credentials_t anon_cred = vnc_tls_initialize_anon_cred();
if (!anon_cred) {
gnutls_deinit(vs->tls.session);
vs->tls.session = NULL;
Expand Down