[PATCH v3 3/3] hvf: handle singlestepping over instructions which trigger a VM exit

francesco.cagnin@gmail.com posted 3 patches 2 years, 6 months ago
There is a newer version of this series
[PATCH v3 3/3] hvf: handle singlestepping over instructions which trigger a VM exit
Posted by francesco.cagnin@gmail.com 2 years, 6 months ago
From: Francesco Cagnin <fcagnin@quarkslab.com>

Signed-off-by: Francesco Cagnin <fcagnin@quarkslab.com>
---
 target/arm/hvf/hvf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index c63e8da6a5..87c531508e 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -1807,6 +1807,10 @@ int hvf_vcpu_exec(CPUState *cpu)
         pc += 4;
         r = hv_vcpu_set_reg(cpu->hvf->fd, HV_REG_PC, pc);
         assert_hvf_ok(r);
+
+        if (cpu->singlestep_enabled) {
+            ret = EXCP_DEBUG;
+        }
     }
 
     return ret;
-- 
2.39.0
Re: [PATCH v3 3/3] hvf: handle singlestepping over instructions which trigger a VM exit
Posted by Peter Maydell 2 years, 5 months ago
On Sat, 14 Jan 2023 at 16:13, <francesco.cagnin@gmail.com> wrote:
>
> From: Francesco Cagnin <fcagnin@quarkslab.com>
>
> Signed-off-by: Francesco Cagnin <fcagnin@quarkslab.com>
> ---
>  target/arm/hvf/hvf.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index c63e8da6a5..87c531508e 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -1807,6 +1807,10 @@ int hvf_vcpu_exec(CPUState *cpu)
>          pc += 4;
>          r = hv_vcpu_set_reg(cpu->hvf->fd, HV_REG_PC, pc);
>          assert_hvf_ok(r);
> +
> +        if (cpu->singlestep_enabled) {
> +            ret = EXCP_DEBUG;
> +        }
>      }
>
>      return ret;

I think this is probably best folded into patch 2 rather than
being a separate patch.

thanks
-- PMM