@@ -235,7 +235,7 @@ static void show_host_call_trace(uint64_t rsp, uint64_t rbp, uint32_t cpu_id)
235
235
int cb_hierarchy = 0 ;
236
236
uint64_t * sp = (uint64_t * )rsp ;
237
237
238
- printf ("\r\nHost Stack: \r\n" );
238
+ printf ("\r\nHost Stack: CPU_ID = %d \r\n" , cpu_id );
239
239
for (i = 0 ; i < DUMP_STACK_SIZE /32 ; i ++ ) {
240
240
printf ("addr(0x%llx) 0x%016llx 0x%016llx 0x%016llx "
241
241
"0x%016llx\r\n" , (rsp + i * 32 ), sp [i * 4 ], sp [i * 4 + 1 ],
@@ -293,17 +293,16 @@ void __assert(uint32_t line, const char *file, char *txt)
293
293
} while (1 );
294
294
}
295
295
296
- void dump_exception (struct intr_excp_ctx * ctx , uint32_t cpu_id )
296
+ void dump_intr_excp_frame (struct intr_excp_ctx * ctx )
297
297
{
298
298
const char * name = "Not defined" ;
299
299
300
- if (ctx -> vector < 0x20 )
301
- name = excp_names [ctx -> vector ];
302
-
303
300
printf ("\n\n================================================" );
304
301
printf ("================================\n=\n" );
305
- printf ("= Unhandled exception: %d (%s)\n" , ctx -> vector , name );
306
- printf ("= CPU ID = %d" , cpu_id );
302
+ if (ctx -> vector < 0x20 ) {
303
+ name = excp_names [ctx -> vector ];
304
+ printf ("= Unhandled exception: %d (%s)\n" , ctx -> vector , name );
305
+ }
307
306
308
307
/* Dump host register*/
309
308
printf ("\r\nHost Registers:\r\n" );
@@ -325,39 +324,17 @@ void dump_exception(struct intr_excp_ctx *ctx, uint32_t cpu_id)
325
324
ctx -> error_code , ctx -> cs , ctx -> ss );
326
325
printf ("\r\n" );
327
326
328
- /* Dump host stack */
329
- show_host_call_trace (ctx -> rsp , ctx -> rbp , cpu_id );
330
-
331
- /* Dump guest context */
332
- dump_guest_context (cpu_id );
333
- printf ("= System halted\n" );
334
327
printf ("=====================================================" );
335
328
printf ("===========================\n" );
336
329
}
337
330
338
- void dump_interrupt (struct intr_excp_ctx * ctx )
331
+ void dump_exception (struct intr_excp_ctx * ctx , uint32_t cpu_id )
339
332
{
340
- printf ("\n\n==========================================" );
341
- printf ("======================================\n=\n" );
342
- printf ("\n=\n" );
343
- printf ("= Vector=0x%016llX RIP=0x%016llX\n" ,
344
- ctx -> vector , ctx -> rip );
345
- printf ("= RAX=0x%016llX RBX=0x%016llX RCX=0x%016llX\n" ,
346
- ctx -> rax , ctx -> rbx , ctx -> rcx );
347
- printf ("= RDX=0x%016llX RDI=0x%016llX RSI=0x%016llX\n" ,
348
- ctx -> rdx , ctx -> rdi , ctx -> rsi );
349
- printf ("= RSP=0x%016llX RBP=0x%016llX RBX=0x%016llX\n" ,
350
- ctx -> rsp , ctx -> rbp , ctx -> rbx );
351
- printf ("= R8=0x%016llX R9=0x%016llX R10=0x%016llX\n" ,
352
- ctx -> r8 , ctx -> r9 , ctx -> r10 );
353
- printf ("= R11=0x%016llX R12=0x%016llX R13=0x%016llX\n" ,
354
- ctx -> r11 , ctx -> r12 , ctx -> r13 );
355
- printf ("= RFLAGS=0x%016llX R14=0x%016llX R15=0x%016llX\n" ,
356
- ctx -> rflags , ctx -> r14 , ctx -> r15 );
357
- printf ("= ERRCODE=0x%016llX CS=0x%016llX SS=0x%016llX\n" ,
358
- ctx -> error_code , ctx -> cs , ctx -> ss );
359
- printf ("=\n" );
360
- printf ("= system halted\n" );
361
- printf ("===============================================" );
362
- printf ("=================================\n" );
333
+ /* Dump host context */
334
+ dump_intr_excp_frame (ctx );
335
+ /* Show host stack */
336
+ show_host_call_trace (ctx -> rsp , ctx -> rbp , cpu_id );
337
+ /* Dump guest context */
338
+ dump_guest_context (cpu_id );
339
+
363
340
}
0 commit comments