-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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模式的寄存器并在相应事件发生时设置回调函 |