From 5fc3b86a220c0a7ba1a08b30456d0546cdbc3463 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Fri, 26 Apr 2013 17:11:46 +0800 Subject: [PATCH 1/8] fix vnc-tls compilation with newer versions of GNU-TLS --- ui/vnc-tls.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/vnc-tls.c b/ui/vnc-tls.c index 56292636d7..8d4cc8e47c 100644 --- a/ui/vnc-tls.c +++ b/ui/vnc-tls.c @@ -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) { @@ -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; From b25b6279c537032b4e36b26ee6c3238acc4c4117 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Fri, 26 Apr 2013 17:13:01 +0800 Subject: [PATCH 2/8] tlmu:fixed makefile for tlmu-doc.html generation --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index feca260fbb..e2a2454a5d 100644 --- a/Makefile +++ b/Makefile @@ -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 From ac040c519221fd918e65220ae044740980d76c10 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Fri, 26 Apr 2013 17:15:13 +0800 Subject: [PATCH 3/8] tlmu:modern SystemC includes TLM, so removed duplicate includings --- tests/tlmu/sc_example/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/tlmu/sc_example/Makefile b/tests/tlmu/sc_example/Makefile index bc8e977bae..769e340879 100644 --- a/tests/tlmu/sc_example/Makefile +++ b/tests/tlmu/sc_example/Makefile @@ -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 From 62f2600a9ce7388e7ca4db44380fa56a744a06f6 Mon Sep 17 00:00:00 2001 From: Li Yi Date: Fri, 26 Apr 2013 17:20:51 +0800 Subject: [PATCH 4/8] tlmu:fix SDL multithreading bug by temporary add '-nographic' issue description: [xcb] Unknown request in queue while dequeuing [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called [xcb] Aborting, sorry about that. ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed. Aborted --- tests/tlmu/c_example.c | 2 ++ tests/tlmu/sc_example/tlmu_sc.cc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tests/tlmu/c_example.c b/tests/tlmu/c_example.c index 8ebdf6ea0b..69ea3bcf25 100644 --- a/tests/tlmu/c_example.c +++ b/tests/tlmu/c_example.c @@ -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. diff --git a/tests/tlmu/sc_example/tlmu_sc.cc b/tests/tlmu/sc_example/tlmu_sc.cc index 248e9a2695..b12af813e2 100644 --- a/tests/tlmu/sc_example/tlmu_sc.cc +++ b/tests/tlmu/sc_example/tlmu_sc.cc @@ -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); From 683d0a60eb178c7e16e566de97e9819d5c45551f Mon Sep 17 00:00:00 2001 From: LI Yi Date: Mon, 29 Apr 2013 17:00:16 +0800 Subject: [PATCH 5/8] tlmu:add destructors for tlmu test (sc_example) new & delete appear in pairs to avoiding the memory leaks --- tests/tlmu/sc_example/iconnect.h | 12 ++++++++++++ tests/tlmu/sc_example/memory.cc | 5 +++++ tests/tlmu/sc_example/memory.h | 2 ++ tests/tlmu/sc_example/sc_example.cc | 17 +++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/tests/tlmu/sc_example/iconnect.h b/tests/tlmu/sc_example/iconnect.h index ba54e621b7..a51ea1ed3c 100644 --- a/tests/tlmu/sc_example/iconnect.h +++ b/tests/tlmu/sc_example/iconnect.h @@ -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); @@ -104,6 +106,16 @@ iconnect::iconnect (sc_module_name name) map[i].size = 0; } } +template +iconnect::~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 int iconnect::memmap( diff --git a/tests/tlmu/sc_example/memory.cc b/tests/tlmu/sc_example/memory.cc index 905a785b40..cefcf04274 100644 --- a/tests/tlmu/sc_example/memory.cc +++ b/tests/tlmu/sc_example/memory.cc @@ -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(); diff --git a/tests/tlmu/sc_example/memory.h b/tests/tlmu/sc_example/memory.h index 7640c0d66d..4876d499a6 100644 --- a/tests/tlmu/sc_example/memory.h +++ b/tests/tlmu/sc_example/memory.h @@ -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, diff --git a/tests/tlmu/sc_example/sc_example.cc b/tests/tlmu/sc_example/sc_example.cc index b87a9ea85e..a1d0693a65 100644 --- a/tests/tlmu/sc_example/sc_example.cc +++ b/tests/tlmu/sc_example/sc_example.cc @@ -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; }; From 1af3d2f0a71917d6f7db8816215f5a84e5c8affe Mon Sep 17 00:00:00 2001 From: LI Yi Date: Mon, 29 Apr 2013 17:09:03 +0800 Subject: [PATCH 6/8] tlmu:do not exit so quick here, allow sc_stop() call exiting --- tests/tlmu/sc_example/magicdev.cc | 2 +- tests/tlmu/sc_example/sc_example.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/tlmu/sc_example/magicdev.cc b/tests/tlmu/sc_example/magicdev.cc index 4f1ec37444..ea0710272c 100644 --- a/tests/tlmu/sc_example/magicdev.cc +++ b/tests/tlmu/sc_example/magicdev.cc @@ -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; } } diff --git a/tests/tlmu/sc_example/sc_example.cc b/tests/tlmu/sc_example/sc_example.cc index a1d0693a65..48d48118df 100644 --- a/tests/tlmu/sc_example/sc_example.cc +++ b/tests/tlmu/sc_example/sc_example.cc @@ -178,5 +178,7 @@ int sc_main(int argc, char* argv[]) top = new Top("top"); sc_start(); + + delete top; return 0; } From cb89de8bb60604ce78154f08e9aefc447018d69a Mon Sep 17 00:00:00 2001 From: LI Yi Date: Mon, 29 Apr 2013 17:04:28 +0800 Subject: [PATCH 7/8] tlmu:update makefile to avoid compile stub/arch-query-cpu-def.o twice fix test/tlmu makefile to allow external LD_LIBRARY_PATH setting --- Makefile.target | 4 ++-- tests/tlmu/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.target b/Makefile.target index c3a99e4a3d..57c05d4434 100644 --- a/Makefile.target +++ b/Makefile.target @@ -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 @@ -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) diff --git a/tests/tlmu/Makefile b/tests/tlmu/Makefile index 001fa61663..8d0344453e 100644 --- a/tests/tlmu/Makefile +++ b/tests/tlmu/Makefile @@ -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 From 50c02d0a1e479a826bee04fd8533a4bb6c864816 Mon Sep 17 00:00:00 2001 From: LI Yi Date: Mon, 29 Apr 2013 17:09:40 +0800 Subject: [PATCH 8/8] tlmu:update tlmu doc --- tlmu-doc.texi | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tlmu-doc.texi b/tlmu-doc.texi index 6c9bfeaeb5..0865898e71 100644 --- a/tlmu-doc.texi +++ b/tlmu-doc.texi @@ -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 @@ -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