From ad2d855302286b708302f90bf07eba4351f94dd9 Mon Sep 17 00:00:00 2001 From: zhouji3x Date: Wed, 30 May 2018 09:41:39 +0800 Subject: [PATCH] hv: save registers on exception This patch is for crashmode/ramdump. when exception occur: 1) save registers; 2) flush cache Signed-off-by: zhouji3x Reviewed-by: Yin Fengwei Acked-by: Eddie Dong --- hypervisor/debug/dump.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hypervisor/debug/dump.c b/hypervisor/debug/dump.c index da9a489a1..9ca9ee85e 100644 --- a/hypervisor/debug/dump.c +++ b/hypervisor/debug/dump.c @@ -44,6 +44,9 @@ static const char *const excp_names[] = { [31] = "Intel Reserved" }; +/* Global variable for save registers on exception */ +struct intr_excp_ctx *crash_ctx; + static void dump_guest_reg(struct vcpu *vcpu) { struct run_context *cur_context = @@ -283,4 +286,8 @@ void dump_exception(struct intr_excp_ctx *ctx, uint32_t cpu_id) show_host_call_trace(ctx->rsp, ctx->rbp, cpu_id); /* Dump guest context */ dump_guest_context(cpu_id); + + /* Save registers*/ + crash_ctx = ctx; + CACHE_FLUSH_INVALIDATE_ALL(); }