Skip to content

Commit

Permalink
add stage 3 blog
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ptune committed Dec 1, 2024
1 parent d678ab9 commit 94052bc
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: 2024秋冬季开源操作系统训练营三阶段学习总结报告-王海旺
date: 2024-12-01 16:19:35
tags:
---


## 主要看了下hypervisor部分
tour/h_1_0部分的vmexit_handler只处理了Shutdown vm
exercise/simplehv处理了IllegalInstruction, LoadGuestPageFault,VirtualSupervisorEnvCall

IllegalInstruction处理部分
```
Trap::Exception(Exception::IllegalInstruction) => {
ax_println!("Bad instruction: {:#x} sepc: {:#x}",
stval::read(),
ctx.guest_regs.sepc
);
ctx.guest_regs.sepc += 4;
ctx.guest_regs.gprs.set_reg(A0, 0x6688);
ctx.guest_regs.gprs.set_reg(A1, 0x1234);
},
```
guest_regs.sepc代表返回guest模式后的pc值
guest_regs.gprs.set_reg设置guest模式的reg值设置guest模式的reg值
hyper模式可以接管guest模式的寄存器并在相应事件发生时设置回调函

0 comments on commit 94052bc

Please sign in to comment.