[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/17] target/ppc: Add a tracepoint for System Calls
From: |
Fabiano Rosas |
Subject: |
[PATCH 01/17] target/ppc: Add a tracepoint for System Calls |
Date: |
Tue, 1 Mar 2022 10:56:04 -0300 |
This replaces the old dump_syscall qemu_log print with a
tracepoint. One immediate effect of this is that we can now avoid
flooding the console with syscall prints when debugging.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
target/ppc/excp_helper.c | 53 ++++++----------------------------------
target/ppc/trace-events | 2 ++
target/ppc/trace.h | 18 ++++++++++++++
3 files changed, 27 insertions(+), 46 deletions(-)
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index d3e2cfcd71..dd1e9c20b9 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -105,33 +105,6 @@ static const char *powerpc_excp_name(int excp)
}
}
-static void dump_syscall(CPUPPCState *env)
-{
- qemu_log_mask(CPU_LOG_INT, "syscall r0=%016" PRIx64
- " r3=%016" PRIx64 " r4=%016" PRIx64 " r5=%016" PRIx64
- " r6=%016" PRIx64 " r7=%016" PRIx64 " r8=%016" PRIx64
- " nip=" TARGET_FMT_lx "\n",
- ppc_dump_gpr(env, 0), ppc_dump_gpr(env, 3),
- ppc_dump_gpr(env, 4), ppc_dump_gpr(env, 5),
- ppc_dump_gpr(env, 6), ppc_dump_gpr(env, 7),
- ppc_dump_gpr(env, 8), env->nip);
-}
-
-static void dump_hcall(CPUPPCState *env)
-{
- qemu_log_mask(CPU_LOG_INT, "hypercall r3=%016" PRIx64
- " r4=%016" PRIx64 " r5=%016" PRIx64 " r6=%016" PRIx64
- " r7=%016" PRIx64 " r8=%016" PRIx64 " r9=%016" PRIx64
- " r10=%016" PRIx64 " r11=%016" PRIx64 " r12=%016" PRIx64
- " nip=" TARGET_FMT_lx "\n",
- ppc_dump_gpr(env, 3), ppc_dump_gpr(env, 4),
- ppc_dump_gpr(env, 5), ppc_dump_gpr(env, 6),
- ppc_dump_gpr(env, 7), ppc_dump_gpr(env, 8),
- ppc_dump_gpr(env, 9), ppc_dump_gpr(env, 10),
- ppc_dump_gpr(env, 11), ppc_dump_gpr(env, 12),
- env->nip);
-}
-
static void ppc_excp_debug_sw_tlb(CPUPPCState *env, int excp)
{
const char *es;
@@ -502,7 +475,7 @@ static void powerpc_excp_40x(PowerPCCPU *cpu, int excp)
}
break;
case POWERPC_EXCP_SYSCALL: /* System call exception */
- dump_syscall(env);
+ trace_ppc_syscall(env, 0);
/*
* We need to correct the NIP which in this case is supposed
@@ -646,7 +619,7 @@ static void powerpc_excp_6xx(PowerPCCPU *cpu, int excp)
}
break;
case POWERPC_EXCP_SYSCALL: /* System call exception */
- dump_syscall(env);
+ trace_ppc_syscall(env, 0);
/*
* We need to correct the NIP which in this case is supposed
@@ -822,11 +795,7 @@ static void powerpc_excp_7xx(PowerPCCPU *cpu, int excp)
{
int lev = env->error_code;
- if (lev == 1 && cpu->vhyp) {
- dump_hcall(env);
- } else {
- dump_syscall(env);
- }
+ trace_ppc_syscall(env, lev);
/*
* We need to correct the NIP which in this case is supposed
@@ -1007,11 +976,7 @@ static void powerpc_excp_74xx(PowerPCCPU *cpu, int excp)
{
int lev = env->error_code;
- if ((lev == 1) && cpu->vhyp) {
- dump_hcall(env);
- } else {
- dump_syscall(env);
- }
+ trace_ppc_syscall(env, lev);
/*
* We need to correct the NIP which in this case is supposed
@@ -1206,7 +1171,7 @@ static void powerpc_excp_booke(PowerPCCPU *cpu, int excp)
}
break;
case POWERPC_EXCP_SYSCALL: /* System call exception */
- dump_syscall(env);
+ trace_ppc_syscall(env, 0);
/*
* We need to correct the NIP which in this case is supposed
@@ -1467,11 +1432,7 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
case POWERPC_EXCP_SYSCALL: /* System call exception */
lev = env->error_code;
- if ((lev == 1) && cpu->vhyp) {
- dump_hcall(env);
- } else {
- dump_syscall(env);
- }
+ trace_ppc_syscall(env, lev);
/*
* We need to correct the NIP which in this case is supposed
@@ -1492,7 +1453,7 @@ static void powerpc_excp_books(PowerPCCPU *cpu, int excp)
break;
case POWERPC_EXCP_SYSCALL_VECTORED: /* scv exception */
lev = env->error_code;
- dump_syscall(env);
+ trace_ppc_syscall(env, 0);
env->nip += 4;
new_msr |= env->msr & ((target_ulong)1 << MSR_EE);
new_msr |= env->msr & ((target_ulong)1 << MSR_RI);
diff --git a/target/ppc/trace-events b/target/ppc/trace-events
index 53b107f56e..0f6af7d73f 100644
--- a/target/ppc/trace-events
+++ b/target/ppc/trace-events
@@ -36,3 +36,5 @@ ppc_excp_isi(uint64_t msr, uint64_t nip) "ISI exception:
msr=0x%016" PRIx64 " ni
ppc_excp_fp_ignore(void) "Ignore floating point exception"
ppc_excp_inval(uint64_t nip) "Invalid instruction at 0x%" PRIx64
ppc_excp_print(const char *excp) "%s exception"
+ppc_excp_syscall(unsigned long r0, unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7, unsigned long r8,
unsigned long nip) "r0=0x%016" PRIx64 " r3=0x%016" PRIx64 " r4=0x%016" PRIx64 "
r5=0x%016" PRIx64 " r6=0x%016" PRIx64 " r7=0x%016" PRIx64 " r8=0x%016" PRIx64 "
nip=0x%" PRIx64
+ppc_excp_hypercall(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7, unsigned long r8, unsigned long r9,
unsigned long r10, unsigned long nip) "r3=0x%016" PRIx64 " r4=0x%016" PRIx64 "
r5=0x%016" PRIx64 " r6=0x%016" PRIx64 " r7=0x%016" PRIx64 " r8=0x%016" PRIx64 "
r9=0x%016" PRIx64 " r10=0x%016" PRIx64 " nip=0x%" PRIx64
diff --git a/target/ppc/trace.h b/target/ppc/trace.h
index a9e8962828..49adcfc1e6 100644
--- a/target/ppc/trace.h
+++ b/target/ppc/trace.h
@@ -1 +1,19 @@
#include "trace/trace-target_ppc.h"
+
+static inline void trace_ppc_syscall(CPUPPCState *env, int lev)
+{
+ PowerPCCPU *cpu = env_archcpu(env);
+
+ if (lev == 1 && cpu->vhyp) {
+ trace_ppc_excp_hypercall(ppc_dump_gpr(env, 3), ppc_dump_gpr(env, 4),
+ ppc_dump_gpr(env, 5), ppc_dump_gpr(env, 6),
+ ppc_dump_gpr(env, 7), ppc_dump_gpr(env, 8),
+ ppc_dump_gpr(env, 9), ppc_dump_gpr(env, 10),
+ env->nip);
+ } else {
+ trace_ppc_excp_syscall(ppc_dump_gpr(env, 0), ppc_dump_gpr(env, 3),
+ ppc_dump_gpr(env, 4), ppc_dump_gpr(env, 5),
+ ppc_dump_gpr(env, 6), ppc_dump_gpr(env, 7),
+ ppc_dump_gpr(env, 8), env->nip);
+ }
+}
--
2.34.1
- [PATCH 00/17] target/ppc: CPU families split, Fabiano Rosas, 2022/03/01
- [PATCH 01/17] target/ppc: Add a tracepoint for System Calls,
Fabiano Rosas <=
- [PATCH 03/17] target/ppc: Move 40x CPUs code to their own file, Fabiano Rosas, 2022/03/01
- [PATCH 06/17] target/ppc: Move 74xx CPUs code to their own file, Fabiano Rosas, 2022/03/01
- [PATCH 04/17] target/ppc: Move 6xx CPUs code to their own file, Fabiano Rosas, 2022/03/01
- [PATCH 07/17] target/ppc: Move BookE CPUs code to their own file, Fabiano Rosas, 2022/03/01
- [PATCH 05/17] target/ppc: Move 7xx CPUs code to their own file, Fabiano Rosas, 2022/03/01
- [PATCH 09/17] target/ppc: Remove leftover comments from cpu_init, Fabiano Rosas, 2022/03/01
- [PATCH 10/17] target/ppc: Expose some excp_helper functions, Fabiano Rosas, 2022/03/01
- [PATCH 08/17] target/ppc: Move BookS CPUs to their own file, Fabiano Rosas, 2022/03/01