Re: [Qemu-devel] TCG flow vs dyngen

2011-01-25 Thread Stefano Bonifazi
That said, QEMU's currently working fairly well on this front too, so studying either should work pretty well... Mr Richard Henderson's patch on elfload.c says I was right.. at least the version I am working on (qemu-0.13.0) had some bugs and weaknesses though it worked smoothly for most

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-25 Thread Stefano Bonifazi
Again wow!! Is that really possible? Some sort of callback triggered at every instruction execution? Yes, this mechanism works. I have written a code to count different kinds of instructions. Great! that opens a lot of possibilities!. It exists in file qemu/target-i386/translate.c Ops right!

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-25 Thread Stefano Bonifazi
On 01/25/2011 10:05 AM, Edgar E. Iglesias wrote: On Tue, Jan 25, 2011 at 10:04:39AM +0100, Stefano Bonifazi wrote: Again wow!! Is that really possible? Some sort of callback triggered at every instruction execution? Yes, this mechanism works. I have written a code to count different kinds of

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-25 Thread Edgar E. Iglesias
On Tue, Jan 25, 2011 at 10:04:39AM +0100, Stefano Bonifazi wrote: Again wow!! Is that really possible? Some sort of callback triggered at every instruction execution? Yes, this mechanism works. I have written a code to count different kinds of instructions. Great! that opens a lot of

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Stefano Bonifazi
On 01/24/2011 12:40 AM, Rob Landley wrote: On 01/23/2011 04:25 PM, Stefano Bonifazi wrote: I am trying to shift in memory the target executable .. now the code is supposed to be loaded by the elfloader at the exact start address set at link time .. Ah, elf loading. That's a whole 'nother bag

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Peter Maydell
2011/1/23 Rob Landley r...@landley.net: Keep in mind I'm a bit rusty and not an expert, but I'll give a stab at answering: ...here's a couple of clarifications: 2. how can I check the number of target cpu cycles or target instructions executed inside qemu-user (i.e. qemu-ppc)? You can't,

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Stefano Bonifazi
On 01/24/2011 03:32 PM, Peter Maydell wrote: Being a JIT doesn't prohibit counting target instructions executed. It just means that counting them generally requires generating code to do the counting at runtime, so it's a more complicated change to make than it would be in a non-JIT emulator.

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Lluís
Stefano Bonifazi writes: On 01/24/2011 03:32 PM, Peter Maydell wrote: Being a JIT doesn't prohibit counting target instructions executed. It just means that counting them generally requires generating code to do the counting at runtime, so it's a more complicated change to make than it

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Dushyant Bansal
On Monday 24 January 2011 08:26 PM, Stefano Bonifazi wrote: On 01/24/2011 03:32 PM, Peter Maydell wrote: Being a JIT doesn't prohibit counting target instructions executed. It just means that counting them generally requires generating code to do the counting at runtime, so it's a more

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Rob Landley
On 01/24/2011 04:17 AM, Stefano Bonifazi wrote: I read your post, and yup you also noticed the weird of load_bias.. and wondered how it can work on x86.. But I think your work was on qemu-system.. I am working on qemu-user.. My post wasn't on qemu-anything, it was while I was trying to debug

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Stefano Bonifazi
On 01/24/2011 07:02 PM, Dushyant Bansal wrote: On Monday 24 January 2011 08:26 PM, Stefano Bonifazi wrote: On 01/24/2011 03:32 PM, Peter Maydell wrote: Being a JIT doesn't prohibit counting target instructions executed. It just means that counting them generally requires generating code to do

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Stefano Bonifazi
Hi! Thanks for replying me! The thing is, the kernel currently _does_ work, so studying the relevant kernel code (and possibly the dynamic loader code) is one way to learn how it currently works. Sorry what kernel? Qemu's? Linux's?

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Rob Landley
On 01/24/2011 03:16 PM, Stefano Bonifazi wrote: Hi! Thanks for replying me! The thing is, the kernel currently _does_ work, so studying the relevant kernel code (and possibly the dynamic loader code) is one way to learn how it currently works. Sorry what kernel? Qemu's? Linux's? QEMU isn't a

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-24 Thread Dushyant Bansal
You should see this pdf (www.ecs.syr.edu/faculty/yin/Teaching/TC2010/Proj4.pdf). It talks about tracing the instructions. -- Dushyant Wow thank you! It sounds incredibly interesting!! What we really need is to insert a function call into the translated code, so when each instruction is

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-23 Thread Rob Landley
On 01/16/2011 10:01 AM, Raphaël Lefèvre wrote: On Sun, Jan 16, 2011 at 11:21 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: 2. how can I check the number of target cpu cycles or target instructions executed inside qemu-user (i.e. qemu-ppc)? Is there any variable I can inspect for such

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-23 Thread Stefano Bonifazi
On 01/23/2011 10:50 PM, Rob Landley wrote: On 01/16/2011 10:01 AM, Raphaël Lefèvre wrote: On Sun, Jan 16, 2011 at 11:21 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: 2. how can I check the number of target cpu cycles or target instructions executed inside qemu-user (i.e. qemu-ppc)? Is

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-23 Thread Rob Landley
On 01/23/2011 04:25 PM, Stefano Bonifazi wrote: I am trying to shift in memory the target executable .. now the code is supposed to be loaded by the elfloader at the exact start address set at link time .. Ah, elf loading. That's a whole 'nother bag of worms. Oddly enough, I was deling with

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-17 Thread Lluís
Stefano Bonifazi writes: Hi! In case you are interested in helping me, I'll give you a big piece of news I've just got (even my teacher is not informed yet! :) ) I still don't understand what is your high-level objective... Lluis -- And it's much the same thing with knowledge, for

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Raphael Lefevre
On Wed, Dec 15, 2010 at 4:17 AM, Stefano Bonifazi stefboombas...@gmail.com wrote: On 12/11/2010 03:44 PM, Blue Swirl wrote: Hi! Thank you very much! Knowing exactly where I should check, in a so big project helped me very much!! Anyway after having spent more than 2 days on that code

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Stefano Bonifazi
On 01/16/2011 03:46 PM, Raphael Lefevre wrote: On Wed, Dec 15, 2010 at 4:17 AM, Stefano Bonifazi stefboombas...@gmail.com wrote: On 12/11/2010 03:44 PM, Blue Swirl wrote: Hi! Thank you very much! Knowing exactly where I should check, in a so big project helped me very much!!

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Raphaël Lefèvre
On Sun, Jan 16, 2011 at 11:21 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: Thank you very much! I've already solved this problem.. Right now I am fighting with the possibility of changing qemu-user code for making it run several binaries in succession .. But it seems to remember the

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Stefano Bonifazi
Sorry for my belated on this discussion, after I searched for the topics you posted, it seems two main problems are unsolved? (Am I right?? I'm not sure...) 1. I edited QEMU user, more exactly qemu-ppc launching the main function (inside main.c) from another c function I created, passing it

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Peter Maydell
2011/1/16 Stefano Bonifazi stefboombas...@gmail.com: My workaround to this problem was compiling qemu-ppc as a dynamic library and load it at runtime.. I also managed to load multiple copies of it (with dlmopen each at a different address space) ..in fact I need to run more than one qemu-ppc

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Stefano Bonifazi
Thank you very much for Your fast reply! On 01/16/2011 07:29 PM, Peter Maydell wrote: Linux doesn't seem to have dlmopen http://www.unix.com/man-page/All/3c/dlmopen/ #define __USE_GNU #include dlfcn.h lib_handle1 = dlmopen(LM_ID_NEWLM,./libqemu-ppc.so, RTLD_NOW); I am developing that on a

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Raphaël Lefèvre
2011/1/17 Stefano Bonifazi stefboombas...@gmail.com: Hi! Thank you very much for Your concern! Honestly I had lost hope in any help, I even contacted directly some developers in this mailing list without luck! I guess many good developers in mailing list are still try their best to solve

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Peter Maydell
2011/1/16 Stefano Bonifazi stefboombas...@gmail.com: I need to make the different instances of qemu-user exchange data .. obviously keeping all of them in the same address space would be the easiest way (unless I have to change all qemu code ;) ) The problem is that you're trying to break a

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Stefano Bonifazi
Hi! In case you are interested in helping me, I'll give you a big piece of news I've just got (even my teacher is not informed yet! :) ) I've just managed to make more than one instance of qemu-user run at the same time linking the target code with a specified address for the code section

Re: [Qemu-devel] TCG flow vs dyngen

2011-01-16 Thread Raphaël Lefèvre
2011/1/17 Stefano Bonifazi stefboombas...@gmail.com: Hi!  In case you are interested in helping me, I'll give you a big piece of news I've just got (even my teacher is not informed yet! :) ) I've just managed to make more than one instance of qemu-user run at the same time linking the target

Re: [Qemu-devel] TCG flow vs dyngen

2010-12-14 Thread Stefano Bonifazi
On 12/11/2010 03:44 PM, Blue Swirl wrote: On Sat, Dec 11, 2010 at 2:32 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: Where does the execution of host binary take place in the previous list of events? Between point 5) and 6) ? After 6) ? In what QEMU source code file/function does the

Re: [Qemu-devel] TCG flow vs dyngen

2010-12-11 Thread Blue Swirl
On Fri, Dec 10, 2010 at 9:26 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: Hi all!  From the technical documentation (http://www.usenix.org/publications/library/proceedings/usenix05/tech/freenix/bellard.html) I read: The first step is to split each target CPU instruction into fewer

Re: [Qemu-devel] TCG flow vs dyngen

2010-12-11 Thread Stefano Bonifazi
Thank you very very much! I'd take months for understanding everything myself from the source code! :) On 12/11/2010 12:02 PM, Blue Swirl wrote: On Fri, Dec 10, 2010 at 9:26 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: [..] - So, I think that the technical documentation is now

Re: [Qemu-devel] TCG flow vs dyngen

2010-12-11 Thread Blue Swirl
On Sat, Dec 11, 2010 at 12:29 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: Thank you very very much! I'd take months for understanding everything myself from the source code! :) On 12/11/2010 12:02 PM, Blue Swirl wrote: On Fri, Dec 10, 2010 at 9:26 PM, Stefano Bonifazi

RE: [Qemu-devel] TCG flow vs dyngen

2010-12-11 Thread Stefano Bonifazi
-Original Message- From: Blue Swirl [mailto:blauwir...@gmail.com] Sent: sabato 11 dicembre 2010 14:12 To: Stefano Bonifazi Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] TCG flow vs dyngen There's a large buffer for generated code, allocated in exec.c. This is filled with host

Re: [Qemu-devel] TCG flow vs dyngen

2010-12-11 Thread Blue Swirl
On Sat, Dec 11, 2010 at 2:32 PM, Stefano Bonifazi stefboombas...@gmail.com wrote: -Original Message- From: Blue Swirl [mailto:blauwir...@gmail.com] Sent: sabato 11 dicembre 2010 14:12 To: Stefano Bonifazi Cc: qemu-devel@nongnu.org Subject: Re: [Qemu-devel] TCG flow vs dyngen

[Qemu-devel] TCG flow vs dyngen

2010-12-10 Thread Stefano Bonifazi
Hi all! From the technical documentation (http://www.usenix.org/publications/library/proceedings/usenix05/tech/freenix/bellard.html) I read: The first step is to split each target CPU instruction into fewer simpler instructions called /micro operations/. Each micro operation is implemented