|
khypervisor
v1
|
#include <hvmm_trace.h>#include <armv7_p15.h>#include "trap.h"#include "context.h"#include "gic.h"#include "sched_policy.h"#include "trap_dabort.h"#include <log/print.h>
Go to the source code of this file.
Functions | |
| hvmm_status_t | _hyp_trap_dabort (struct arch_regs *regs) |
| hvmm_status_t | _hyp_trap_irq (struct arch_regs *regs) |
| hvmm_status_t | _hyp_trap_unhandled (struct arch_regs *regs) |
| static void | _trap_dump_bregs (void) |
| hyp_hvc_result_t | _hyp_hvc_service (struct arch_regs *regs) |
| struct arch_regs * | trap_saved_regs (void) |
Variables | |
| static struct arch_regs * | _trap_hyp_saved_regs = 0 |
| hyp_hvc_result_t _hyp_hvc_service | ( | struct arch_regs * | regs | ) |
Definition at line 80 of file trap.c.
{
unsigned int hsr = read_hsr();
unsigned int iss = hsr & 0x1FFFFFF;
unsigned int ec = (hsr >> 26);
_trap_hyp_saved_regs = regs;
printh("[hvc] _hyp_hvc_service: enter\n\r");
if ( ec == 0x12 && ((iss & 0xFFFF) == 0xFFFF) ) {
/* Internal request to stay in hyp mode */
printh("[hvc] enter hyp\n\r");
context_dump_regs( regs );
return HYP_RESULT_STAY;
}
if ( ec == 0x24) {
/* Handle data abort at the priority */
printh("[hyp] data abort handler: hsr.iss=%x\n", iss);
_trap_dump_bregs();
if ( trap_hvc_dabort(iss, regs) != HVMM_STATUS_SUCCESS ) {
printh( "[hyp] === Unhandled dabort ===\n" );
printh( "[hyp] current guest vmid:%d\n", context_current_vmid() );
context_dump_regs( regs );
_trap_dump_bregs();
hyp_abort_infinite();
}
_trap_dump_bregs();
} else {
/* Handle the other cases */
switch( iss ) {
case 0xFFFE:
/* hyp_ping */
printh("[hyp] _hyp_hvc_service:ping\n\r");
context_dump_regs( regs );
break;
case 0xFFFD:
{
/* hsvc_yield() */
printh("[hyp] _hyp_hvc_service:yield\n\r");
context_dump_regs( regs );
context_switchto(sched_policy_determ_next());
}
break;
default:
if ( ec == 0x20 ) {
// Prefetch Abort routed to Hyp mode
printh( "[hyp]: prefetch abort routed to Hyp mode\n");
}
printh("[hyp] _hyp_hvc_service:unknown hsr.iss= %x\n", iss);
printh("[hyp] hsr.ec= %x\n", ec);
printh("[hyp] hsr= %x\n", hsr);
context_dump_regs( regs );
_trap_dump_bregs();
hyp_abort_infinite();
break;
}
}
printh("[hyp] _hyp_hvc_service: done\n\r");
context_perform_switch();
return HYP_RESULT_ERET;
}

| hvmm_status_t _hyp_trap_dabort | ( | struct arch_regs * | regs | ) |
Definition at line 20 of file trap.c.
{
_trap_hyp_saved_regs = regs;
context_dump_regs( regs );
hyp_abort_infinite();
return HVMM_STATUS_UNKNOWN_ERROR;
}

| hvmm_status_t _hyp_trap_irq | ( | struct arch_regs * | regs | ) |
Definition at line 31 of file trap.c.
{
_trap_hyp_saved_regs = regs;
gic_interrupt(0, regs);
context_perform_switch();
return HVMM_STATUS_SUCCESS;
}

| hvmm_status_t _hyp_trap_unhandled | ( | struct arch_regs * | regs | ) |
Definition at line 42 of file trap.c.
{
_trap_hyp_saved_regs = regs;
context_dump_regs( regs );
hyp_abort_infinite();
return HVMM_STATUS_UNKNOWN_ERROR;
}

| static void _trap_dump_bregs | ( | void | ) | [static] |
Definition at line 52 of file trap.c.
{
uint32_t spsr, lr, sp;
printh( " - banked regs\n" );
asm volatile (" mrs %0, sp_usr\n\t" :"=r" (sp)::"memory", "cc");
asm volatile (" mrs %0, lr_usr\n\t" :"=r" (lr)::"memory", "cc");
printh( " - usr: sp:%x lr:%x\n", sp, lr );
asm volatile (" mrs %0, spsr_svc\n\t" :"=r" (spsr)::"memory", "cc");
asm volatile (" mrs %0, sp_svc\n\t" :"=r" (sp)::"memory", "cc");
asm volatile (" mrs %0, lr_svc\n\t" :"=r" (lr)::"memory", "cc");
printh( " - svc: spsr:%x sp:%x lr:%x\n", spsr, sp, lr );
asm volatile (" mrs %0, spsr_irq\n\t" :"=r" (spsr)::"memory", "cc");
asm volatile (" mrs %0, sp_irq\n\t" :"=r" (sp)::"memory", "cc");
asm volatile (" mrs %0, lr_irq\n\t" :"=r" (lr)::"memory", "cc");
printh( " - irq: spsr:%x sp:%x lr:%x\n", spsr, sp, lr );
}
| struct arch_regs* trap_saved_regs | ( | void | ) | [read] |
Definition at line 151 of file trap.c.
{
return _trap_hyp_saved_regs;
}
struct arch_regs* _trap_hyp_saved_regs = 0 [static] |
1.7.6.1