You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+ So, basically when the guestOS calls the hypervisor, some args are placed in the general purpose registers. (x0-x7)
8
+
9
+
+ But when the context switches, these registers are put into VM structure's pt_regs.
10
+
11
+
+ So now, we need to access those args from pt_regs.
12
+
13
+
+ Also, the pointers passed from guest are in its IPA. Hence we need to find the page in physical memory as well.
14
+
15
+
+ Return value from the hypervisor is placed in 'x0' in pt_regs, so when context switch happens back to guest, it can view the return value as though nothing happened.
16
+
17
+
*/
18
+
19
+
externstructvm*current;
20
+
21
+
voidsse_hvc_main_handler(uint16_thvc_number){
22
+
23
+
structpt_regs*vm_regs= (structpt_regs*) get_vm_pt_regs(current); // This is VM's state before context switch occured.
24
+
25
+
uint64_tx0=vm_regs->regs[0];
26
+
uint64_tx1=vm_regs->regs[1];
27
+
uint64_tx2=vm_regs->regs[2];
28
+
uint64_tx3=vm_regs->regs[3];
29
+
30
+
31
+
// temporary variables used inside switch statement.
0 commit comments