mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 22:53:04 +00:00
hv_exc: Add a hacky STEP feature to interrupt guest after a while
This should eventually be a proper single step feature or something, but for now... Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
bcdafe8d00
commit
ed32cf6328
3 changed files with 7 additions and 0 deletions
|
@ -91,6 +91,7 @@ class EXC_RET(IntEnum):
|
||||||
UNHANDLED = 1
|
UNHANDLED = 1
|
||||||
HANDLED = 2
|
HANDLED = 2
|
||||||
EXIT_GUEST = 3
|
EXIT_GUEST = 3
|
||||||
|
STEP = 4
|
||||||
|
|
||||||
ExcInfo = Struct(
|
ExcInfo = Struct(
|
||||||
"spsr" / RegAdapter(SPSR),
|
"spsr" / RegAdapter(SPSR),
|
||||||
|
|
|
@ -35,12 +35,17 @@ static void hv_exc_proxy(u64 *regs, uartproxy_exc_code_t type)
|
||||||
int ret = uartproxy_run(&start);
|
int ret = uartproxy_run(&start);
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
|
case EXC_RET_STEP:
|
||||||
case EXC_RET_HANDLED:
|
case EXC_RET_HANDLED:
|
||||||
memcpy(regs, exc_info.regs, sizeof(exc_info.regs));
|
memcpy(regs, exc_info.regs, sizeof(exc_info.regs));
|
||||||
msr(SPSR_EL2, exc_info.spsr);
|
msr(SPSR_EL2, exc_info.spsr);
|
||||||
msr(ELR_EL2, exc_info.elr);
|
msr(ELR_EL2, exc_info.elr);
|
||||||
msr(SP_EL0, exc_info.sp[0]);
|
msr(SP_EL0, exc_info.sp[0]);
|
||||||
msr(SP_EL1, exc_info.sp[1]);
|
msr(SP_EL1, exc_info.sp[1]);
|
||||||
|
if (ret == EXC_RET_STEP) {
|
||||||
|
msr(CNTV_TVAL_EL0, 256);
|
||||||
|
msr(CNTV_CTL_EL0, 1);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case EXC_EXIT_GUEST:
|
case EXC_EXIT_GUEST:
|
||||||
hv_exit_guest();
|
hv_exit_guest();
|
||||||
|
|
|
@ -24,6 +24,7 @@ typedef enum _uartproxy_exc_ret_t {
|
||||||
EXC_RET_UNHANDLED = 1,
|
EXC_RET_UNHANDLED = 1,
|
||||||
EXC_RET_HANDLED = 2,
|
EXC_RET_HANDLED = 2,
|
||||||
EXC_EXIT_GUEST = 3,
|
EXC_EXIT_GUEST = 3,
|
||||||
|
EXC_RET_STEP = 4,
|
||||||
} uartproxy_exc_ret_t;
|
} uartproxy_exc_ret_t;
|
||||||
|
|
||||||
struct uartproxy_exc_info {
|
struct uartproxy_exc_info {
|
||||||
|
|
Loading…
Reference in a new issue