<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>


    posts - 1,  comments - 20,  trackbacks - 0

    What is a Hypercall?

    Hypercall is an explicit call from Virtual Machine (VM) into the underlying VM Moniter (VMM). That is, a hypercall issued from the guest will cause a VM exit from the guest into the VMM. In this sense, it is kinda like syscall, which will result in a trap from userspace into  kernel space.  Thus, hypercall can serve as a communication approach between the guest and the underlying VMM. The guest can issue hypercalls via VMMCALL instruction on AMD SVM machine or VMCALL on Intel VMX machine.


    Adding a Hypercall in Palacios

    Palacios maintains a global hypercall map, which maintains the mapping between the unique hypercall number and the hypercall handler. (Each hypercall is associated with a unique hypercall number.). Therefore, to add a hypercal in Palacios, you need to:

    • Implement a handler for the hypercall.
    • Assign a unique hypercall number for the hypercall.
    • Register the hypercall handler and the hypercall number with Palacios.

    Sample Example:

    static int handle_hcall(struct guest_info * info, uint_t hcall_id, void * priv_data){
        unsigned 
    long param1 = *(unsigned long *&info->vm_regs.rbx;
        unsigned 
    long param2 = *(unsigned long *&info->vm_regs.rcx;
        unsigned 
    long param3 = *(unsigned long *&info->vm_regs.rdx;
        V3_Print(
    "param1=%lu param2=%lu param3=%lu\n", param1, parma2, param3);
        info
    ->vm_regs.rax = 0//return value of the hypercall
    }

    v3_register_hypercall(vm, HCALL_EXAMPLE_ID, handle_hcall, NULL);

    Note: The hypercall management APIs in Palacios are contained in palacios/include/palacios/vmm_hypercall.h and palacios/src/palacios/vmm_hypercall.c.


    Issuing Hypercalls from Palacios Guest

    “Up to four arguments may be passed in rbx, rcx, rdx, and rsi respectively. The hypercall number should be placed in rax and the return value will be placed in rax.  No other registers will be clobbered unless explicitly stated by the particular hypercall.” (quoted from [1])

    For exmaple, on a AMD SVM machine, a hypercall with 3 parameters can be issued via the following code:

    #define VMMCALL ".byte 0x0F,0x01,0xD9\r\n" //VMMCALL instruction binary code

    int hcall3(unsigned long hcall_id, unsigned long param1, unsigned long param2, unsigned long param3){
         
    int ret;
         __asm__ 
    volatile(
             VMMCALL
                 : “
    =a”(ret)
                 : “a”(hcall_id), “b”(param1), “c”(param2), “d”(param3)
        );
        
    return ret;
    }


    References:

    [1] Linux KVM Hypercall

    posted on 2014-11-04 07:59 csgeek? 閱讀(734) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導航:
     

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    留言簿(1)

    文章檔案(5)

    Personal Website

    搜索

    •  

    最新評論

    主站蜘蛛池模板: 立即播放免费毛片一级| 亚洲国产欧洲综合997久久| 中文字幕乱码免费看电影| 亚洲va中文字幕无码| 美景之屋4在线未删减免费| 免费永久国产在线视频| 国产精品亚洲一区二区无码| 免费一级毛片不卡在线播放| 精品在线免费视频| 4338×亚洲全国最大色成网站| 亚洲免费在线观看| 久久精品亚洲视频| 最近免费中文字幕大全免费| 亚洲香蕉久久一区二区三区四区| 性感美女视频在线观看免费精品 | 日韩毛片在线免费观看| 亚洲黄片毛片在线观看| 国产性生大片免费观看性| 日韩亚洲欧洲在线com91tv| 99国产精品视频免费观看| 亚洲影视自拍揄拍愉拍| 国产成人在线观看免费网站| 中国极品美軳免费观看| 亚洲欧洲精品在线| 国产精品二区三区免费播放心 | 亚洲综合精品香蕉久久网| 男女作爱在线播放免费网站| 亚洲成av人片不卡无码| 日产乱码一卡二卡三免费| 久久一区二区三区免费| 97se亚洲综合在线| 好吊妞视频免费视频| 久久久精品视频免费观看 | 国产精品亚洲mnbav网站| 3344免费播放观看视频| 久久人午夜亚洲精品无码区| 亚洲情XO亚洲色XO无码| 无码人妻久久一区二区三区免费丨| 特级av毛片免费观看| 久久久无码精品亚洲日韩按摩 | 亚洲av午夜福利精品一区人妖|