qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] how to get registers value in event of systemcall
@ 2008-05-26 17:48 Antonio Ricci
  2008-05-27  3:17 ` Mulyadi Santosa
  0 siblings, 1 reply; 12+ messages in thread
From: Antonio Ricci @ 2008-05-26 17:48 UTC (permalink / raw)
  To: qemu-devel

Hi all,
i'd want to understand how to get registers value (eax, ebx, etc.) in 
the guest operating system at the moment of a system call. In my opinion 
i've to work on file target-i386/translate.c in the case of 0x80 in the 
function  disas_insn(DisasContext *s, target_ulong pc_start). I can't 
understand how to get registers value. I've just read documentation 
about translation but I'm not able to get these informations.

Can you help me?

Thanks in advance
-- 
Antonio
My Mobile Phone: +393286739562
My Public Key: http://tonyr.altervista.org/chiave_pubblica
MSN: ricciantonio@hotmail.it
Skype: tonyr81fg
Linux Member #374272
*********************************************************************
What is the difference between Jurassic Park and Microsoft?
One is an over-rated high tech theme park based on prehistoric 
information and populated mostly by dinosaurs, the other is a Steven 
Spielberg movie.
*********************************************************************
There are only 10 types of people in this world:
those who understand binary, and those who don't.
*********************************************************************

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-26 17:48 [Qemu-devel] how to get registers value in event of systemcall Antonio Ricci
@ 2008-05-27  3:17 ` Mulyadi Santosa
  2008-05-27 13:35   ` Paul Brook
  0 siblings, 1 reply; 12+ messages in thread
From: Mulyadi Santosa @ 2008-05-27  3:17 UTC (permalink / raw)
  To: qemu-devel

Answering simply from my simple understanding of qemu...


On Tue, May 27, 2008 at 12:48 AM, Antonio Ricci <ricciantonio@slacky.it> wrote:
> Hi all,
> i'd want to understand how to get registers value (eax, ebx, etc.) in the
> guest operating system at the moment of a system call. In my opinion i've to
> work on file target-i386/translate.c in the case of 0x80 in the function
>  disas_insn(DisasContext *s, target_ulong pc_start). I can't understand how
> to get registers value. I've just read documentation about translation but
> I'm not able to get these informations.

I think you should go to target-i386/translate.c:
gen_intermediate_code_internal(CPUState *env,
                                                 TranslationBlock *tb,
                                                 int search_pc)

specifically, in "env" there is "regs" which hold the CPU registers.

target-i386/cpu.h contains the constants that show you the array
structure of that "regs".

Good luck..

regards,


Mulyadi.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
@ 2008-05-27  7:44 ricciantonio
  2008-05-27  9:10 ` Mulyadi Santosa
  0 siblings, 1 reply; 12+ messages in thread
From: ricciantonio @ 2008-05-27  7:44 UTC (permalink / raw)
  To: qemu-devel

Mulyadi,
thanks for your answer. I'll let you know how it works.

Regards

Antonio
----- Original Message -----
Da : "Mulyadi Santosa" <mulyadi.santosa@gmail.com>
A : qemu-devel@nongnu.org
Oggetto : Re: [Qemu-devel] how to get registers value in
event of systemcall
Data : Tue, 27 May 2008 10:17:00 +0700

> Answering simply from my simple understanding of qemu...
> 
> 
> On Tue, May 27, 2008 at 12:48 AM, Antonio Ricci
> > <ricciantonio@slacky.it> wrote: Hi all,
> > i'd want to understand how to get registers value (eax,
> > ebx, etc.) in the guest operating system at the moment
> > of a system call. In my opinion i've to work on file
> target-i386/translate.c in the case of 0x80 in the
> >  function disas_insn(DisasContext *s, target_ulong
> > pc_start). I can't understand how to get registers
> > value. I've just read documentation about translation
> but I'm not able to get these informations.
> 
> I think you should go to target-i386/translate.c:
> gen_intermediate_code_internal(CPUState *env,
>                                                 
> TranslationBlock *tb,
>                                                  int
> search_pc)
> 
> specifically, in "env" there is "regs" which hold the CPU
> registers.
> 
> target-i386/cpu.h contains the constants that show you the
> array structure of that "regs".
> 
> Good luck..
> 
> regards,
> 
> 
> Mulyadi.
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-27  7:44 ricciantonio
@ 2008-05-27  9:10 ` Mulyadi Santosa
  0 siblings, 0 replies; 12+ messages in thread
From: Mulyadi Santosa @ 2008-05-27  9:10 UTC (permalink / raw)
  To: qemu-devel

hi

On Tue, May 27, 2008 at 2:44 PM, ricciantonio@slacky.it
<ricciantonio@slacky.it> wrote:
> Mulyadi,
> thanks for your answer. I'll let you know how it works.

i think I'll learn something from this discussion too. To me, it shows
that more and more people are interested to understand Qemu internals.
Good for Qemu development.

regards,

Mulyadi.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-27  3:17 ` Mulyadi Santosa
@ 2008-05-27 13:35   ` Paul Brook
  2008-05-27 18:33     ` Antonio Ricci
                       ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Paul Brook @ 2008-05-27 13:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mulyadi Santosa

> > guest operating system at the moment of a system call. In my opinion i've
> > to work on file target-i386/translate.c in the case of 0x80 in the
> > function disas_insn(DisasContext *s, target_ulong pc_start). I can't
> > understand how to get registers value. I've just read documentation about
> > translation but I'm not able to get these informations.
>
> I think you should go to target-i386/translate.c:
> gen_intermediate_code_internal(CPUState *env,
>                                                  TranslationBlock *tb,
>                                                  int search_pc)
>
> specifically, in "env" there is "regs" which hold the CPU registers.

No, that won't work. Only a very limited subset of the CPU state is valid 
during translation. The same block may be executed many times with different 
inputs.  If you want register values you have to do it at execution time, 
e.g. in do_interrupt.

Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-27 13:35   ` Paul Brook
@ 2008-05-27 18:33     ` Antonio Ricci
  2008-05-27 20:15     ` Antonio Ricci
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Antonio Ricci @ 2008-05-27 18:33 UTC (permalink / raw)
  To: qemu-devel

Hi Paul,
thanks for your answer.
I've tried to have registers value from do interrupt and it seems to 
work. I've some questions for you:
1) Where these values are initialized? I can't find it.
2) Have I to work on each type of do_interrupt (that is do_interrupt, 
do_interrupt_user, etc.) to get register's value in all kind of syscalls?
3) If i want to avoid  the execution of some type of syscall based on 
parameters is it possible in this way?

Thanks for your help

--
Antonio
My Mobile Phone: +393286739562
My Public Key: http://tonyr.altervista.org/chiave_pubblica
MSN: ricciantonio@hotmail.it
Skype: tonyr81fg
Linux Member #374272
*********************************************************************
What is the difference between Jurassic Park and Microsoft?
One is an over-rated high tech theme park based on prehistoric 
information and populated mostly by dinosaurs, the other is a Steven 
Spielberg movie.
*********************************************************************
There are only 10 types of people in this world:
those who understand binary, and those who don't.
*********************************************************************

Paul Brook wrote:
>>> guest operating system at the moment of a system call. In my opinion i've
>>> to work on file target-i386/translate.c in the case of 0x80 in the
>>> function disas_insn(DisasContext *s, target_ulong pc_start). I can't
>>> understand how to get registers value. I've just read documentation about
>>> translation but I'm not able to get these informations.
>> I think you should go to target-i386/translate.c:
>> gen_intermediate_code_internal(CPUState *env,
>>                                                  TranslationBlock *tb,
>>                                                  int search_pc)
>>
>> specifically, in "env" there is "regs" which hold the CPU registers.
> 
> No, that won't work. Only a very limited subset of the CPU state is valid 
> during translation. The same block may be executed many times with different 
> inputs.  If you want register values you have to do it at execution time, 
> e.g. in do_interrupt.
> 
> Paul
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-27 13:35   ` Paul Brook
  2008-05-27 18:33     ` Antonio Ricci
@ 2008-05-27 20:15     ` Antonio Ricci
  2008-06-03 17:20     ` Antonio Ricci
  2008-06-03 17:50     ` Antonio Ricci
  3 siblings, 0 replies; 12+ messages in thread
From: Antonio Ricci @ 2008-05-27 20:15 UTC (permalink / raw)
  To: qemu-devel

Paul Brook wrote:
 > No, that won't work. Only a very limited subset of the CPU state is 
valid
 > during translation.

Paul,
I don't understand what you mean. Why can't I get registers value at 
translation time?


 >The same block may be executed many times with different
 > inputs.  If you want register values you have to do it at execution 
time,
 > e.g. in do_interrupt.

Do you mean that If the same block is executed many times with different 
inputs it is translated just once?


Thanks for help
--
Antonio
My Mobile Phone: +393286739562
My Public Key: http://tonyr.altervista.org/chiave_pubblica
MSN: ricciantonio@hotmail.it
Skype: tonyr81fg
Linux Member #374272
*********************************************************************
What is the difference between Jurassic Park and Microsoft?
One is an over-rated high tech theme park based on prehistoric 
information and populated mostly by dinosaurs, the other is a Steven 
Spielberg movie.
*********************************************************************
There are only 10 types of people in this world:
those who understand binary, and those who don't.
*********************************************************************

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-27 13:35   ` Paul Brook
  2008-05-27 18:33     ` Antonio Ricci
  2008-05-27 20:15     ` Antonio Ricci
@ 2008-06-03 17:20     ` Antonio Ricci
  2008-06-03 17:48       ` Paul Brook
  2008-06-03 17:50     ` Antonio Ricci
  3 siblings, 1 reply; 12+ messages in thread
From: Antonio Ricci @ 2008-06-03 17:20 UTC (permalink / raw)
  To: qemu-devel

Paul Brook wrote:
> No, that won't work. Only a very limited subset of the CPU state is 
valid
> during translation.

Paul,
I don't understand what you mean. Why can't I get registers value at
translation time?


>The same block may be executed many times with different
> inputs.  If you want register values you have to do it at execution 
time,
> e.g. in do_interrupt.

Do you mean that If the same block is executed many times with different
inputs it is translated just once?


Thanks for help
--
Antonio
My Mobile Phone: +393286739562
My Public Key: http://tonyr.altervista.org/chiave_pubblica
MSN: ricciantonio@hotmail.it
Skype: tonyr81fg
Linux Member #374272
*********************************************************************
What is the difference between Jurassic Park and Microsoft?
One is an over-rated high tech theme park based on prehistoric
information and populated mostly by dinosaurs, the other is a Steven
Spielberg movie.
*********************************************************************
There are only 10 types of people in this world:
those who understand binary, and those who don't.
*********************************************************************

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-06-03 17:20     ` Antonio Ricci
@ 2008-06-03 17:48       ` Paul Brook
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Brook @ 2008-06-03 17:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Antonio Ricci

On Tuesday 03 June 2008, Antonio Ricci wrote:
> Paul Brook wrote:
> > No, that won't work. Only a very limited subset of the CPU state is
> > valid during translation.
>
> I don't understand what you mean. Why can't I get registers value at
> translation time?

For the reason below.

> >The same block may be executed many times with different
> > inputs.  If you want register values you have to do it at execution
> > time,  e.g. in do_interrupt.
>
> Do you mean that If the same block is executed many times with different
> inputs it is translated just once?

Yes.

Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-05-27 13:35   ` Paul Brook
                       ` (2 preceding siblings ...)
  2008-06-03 17:20     ` Antonio Ricci
@ 2008-06-03 17:50     ` Antonio Ricci
  2008-06-03 19:42       ` Laurent Desnogues
  3 siblings, 1 reply; 12+ messages in thread
From: Antonio Ricci @ 2008-06-03 17:50 UTC (permalink / raw)
  To: qemu-devel

Hi Paul,
thanks for your answer.
I've tried to have registers value from do interrupt and it seems to
work. I've some questions for you:
1) Where these values are initialized? I can't find it.
2) Have I to work on each type of do_interrupt (that is do_interrupt,
do_interrupt_user, etc.) to get register's value in all kind of syscalls?
3) If i want to avoid  the execution of some type of syscall based on
parameters is it possible in this way?

Thanks for your help

--
Antonio
My Mobile Phone: +393286739562
My Public Key: http://tonyr.altervista.org/chiave_pubblica
MSN: ricciantonio@hotmail.it
Skype: tonyr81fg
Linux Member #374272
*********************************************************************
What is the difference between Jurassic Park and Microsoft?
One is an over-rated high tech theme park based on prehistoric
information and populated mostly by dinosaurs, the other is a Steven
Spielberg movie.
*********************************************************************
There are only 10 types of people in this world:
those who understand binary, and those who don't.
*********************************************************************

Paul Brook wrote:
>>> guest operating system at the moment of a system call. In my opinion i've
>>> to work on file target-i386/translate.c in the case of 0x80 in the
>>> function disas_insn(DisasContext *s, target_ulong pc_start). I can't
>>> understand how to get registers value. I've just read documentation about
>>> translation but I'm not able to get these informations.
>> I think you should go to target-i386/translate.c:
>> gen_intermediate_code_internal(CPUState *env,
>>                                                  TranslationBlock *tb,
>>                                                  int search_pc)
>>
>> specifically, in "env" there is "regs" which hold the CPU registers.
> 
> No, that won't work. Only a very limited subset of the CPU state is valid 
> during translation. The same block may be executed many times with different 
> inputs.  If you want register values you have to do it at execution time, 
> e.g. in do_interrupt.
> 
> Paul
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-06-03 17:50     ` Antonio Ricci
@ 2008-06-03 19:42       ` Laurent Desnogues
  2008-06-03 20:12         ` Antonio Ricci
  0 siblings, 1 reply; 12+ messages in thread
From: Laurent Desnogues @ 2008-06-03 19:42 UTC (permalink / raw)
  To: qemu-devel

On Tue, Jun 3, 2008 at 7:50 PM, Antonio Ricci <ricciantonio@slacky.it> wrote:
> Hi Paul,
> thanks for your answer.
> I've tried to have registers value from do interrupt and it seems to
> work. I've some questions for you:
> 1) Where these values are initialized? I can't find it.

If you look in cpu_exec.c/cpu_exec() you will see a call to env_to_regs
before the loop that contains the do_interrupt call.  Does that answer
your question?


Laurent

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] how to get registers value in event of systemcall
  2008-06-03 19:42       ` Laurent Desnogues
@ 2008-06-03 20:12         ` Antonio Ricci
  0 siblings, 0 replies; 12+ messages in thread
From: Antonio Ricci @ 2008-06-03 20:12 UTC (permalink / raw)
  To: qemu-devel

Thanks Laurent, it is the answer I need.

Regards

--
Antonio
My Mobile Phone: +393286739562
My Public Key: http://tonyr.altervista.org/chiave_pubblica
MSN: ricciantonio@hotmail.it
Skype: tonyr81fg
Linux Member #374272
*********************************************************************
What is the difference between Jurassic Park and Microsoft?
One is an over-rated high tech theme park based on prehistoric 
information and populated mostly by dinosaurs, the other is a Steven 
Spielberg movie.
*********************************************************************
There are only 10 types of people in this world:
those who understand binary, and those who don't.
*********************************************************************

Laurent Desnogues wrote:
> On Tue, Jun 3, 2008 at 7:50 PM, Antonio Ricci <ricciantonio@slacky.it> wrote:
>> Hi Paul,
>> thanks for your answer.
>> I've tried to have registers value from do interrupt and it seems to
>> work. I've some questions for you:
>> 1) Where these values are initialized? I can't find it.
> 
> If you look in cpu_exec.c/cpu_exec() you will see a call to env_to_regs
> before the loop that contains the do_interrupt call.  Does that answer
> your question?
> 
> 
> Laurent
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-06-03 20:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-26 17:48 [Qemu-devel] how to get registers value in event of systemcall Antonio Ricci
2008-05-27  3:17 ` Mulyadi Santosa
2008-05-27 13:35   ` Paul Brook
2008-05-27 18:33     ` Antonio Ricci
2008-05-27 20:15     ` Antonio Ricci
2008-06-03 17:20     ` Antonio Ricci
2008-06-03 17:48       ` Paul Brook
2008-06-03 17:50     ` Antonio Ricci
2008-06-03 19:42       ` Laurent Desnogues
2008-06-03 20:12         ` Antonio Ricci
  -- strict thread matches above, loose matches on Subject: below --
2008-05-27  7:44 ricciantonio
2008-05-27  9:10 ` Mulyadi Santosa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).