From owner-freebsd-virtualization@freebsd.org Wed Feb 22 02:45:57 2017 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22716CE9D44 for ; Wed, 22 Feb 2017 02:45:57 +0000 (UTC) (envelope-from daemon-user@freebsd.org) Received: from reviews.nyi.freebsd.org (reviews.nyi.freebsd.org [IPv6:2610:1c1:1:607c::16:b]) by mx1.freebsd.org (Postfix) with ESMTP id ED6E11B07 for ; Wed, 22 Feb 2017 02:45:56 +0000 (UTC) (envelope-from daemon-user@freebsd.org) Received: by reviews.nyi.freebsd.org (Postfix, from userid 1346) id 6D0AD37F24; Wed, 22 Feb 2017 02:45:56 +0000 (UTC) Date: Wed, 22 Feb 2017 02:45:56 +0000 To: freebsd-virtualization@freebsd.org From: "decui_microsoft.com (Dexuan Cui)" Reply-to: D9686+333+3f03d4c13f72873c@reviews.freebsd.org Subject: [Differential] D9686: fix UEFI VM's bootup on Hyper-V (i.e. Hyper-V Generation-2 VM) Message-ID: X-Priority: 3 X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: , , , Thread-Topic: D9686: fix UEFI VM's bootup on Hyper-V (i.e. Hyper-V Generation-2 VM) X-Herald-Rules: none X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: Precedence: bulk In-Reply-To: References: Thread-Index: NjgyYjYxYmU2NWJjODJiNGYzYjhkNjI0YmZkIFis+2Q= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_cabdd634ef87b067fddd3b4dc253d86c" X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.23 List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2017 02:45:57 -0000 --b1_cabdd634ef87b067fddd3b4dc253d86c Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: base64 ZGVjdWlfbWljcm9zb2Z0LmNvbSB1cGRhdGVkIHRoZSBzdW1tYXJ5IGZvciB0aGlzIHJldmlzaW9u LgpkZWN1aV9taWNyb3NvZnQuY29tIHVwZGF0ZWQgdGhpcyByZXZpc2lvbiB0byBEaWZmIDI1NTA1 LgpkZWN1aV9taWNyb3NvZnQuY29tIGFkZGVkIGEgY29tbWVudC4KCgogIEZpeGVkIHRoZSB0eXBv OiBhdmlhYmxlIC0+IGF2YWlsYWJsZS4KCkNIQU5HRVMgU0lOQ0UgTEFTVCBVUERBVEUKICBodHRw czovL3Jldmlld3MuZnJlZWJzZC5vcmcvRDk2ODY/dnM9MjU0MTQmaWQ9MjU1MDUKClJFVklTSU9O IERFVEFJTAogIGh0dHBzOi8vcmV2aWV3cy5mcmVlYnNkLm9yZy9EOTY4NgoKQUZGRUNURUQgRklM RVMKICBzeXMvYm9vdC9lZmkvbG9hZGVyL2NvcHkuYwoKRU1BSUwgUFJFRkVSRU5DRVMKICBodHRw czovL3Jldmlld3MuZnJlZWJzZC5vcmcvc2V0dGluZ3MvcGFuZWwvZW1haWxwcmVmZXJlbmNlcy8K ClRvOiBkZWN1aV9taWNyb3NvZnQuY29tLCBpbXAsIGpoYiwgd2lsbCwga2liLCBkZWxwaGlqLCBl bWFzdGUsIHNlcGhlcm9zYV9nbWFpbC5jb20sIGhvbnpoYW5fbWljcm9zb2Z0LmNvbSwgaG93YXJk MHN1X2dtYWlsLmNvbSwgbWFyY2VsCkNjOiBmcmVlYnNkLXZpcnR1YWxpemF0aW9uLWxpc3QK --b1_cabdd634ef87b067fddd3b4dc253d86c Content-Type: text/x-patch; charset=utf-8; name="D9686.25505.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D9686.25505.patch" ZGlmZiAtLWdpdCBhL3N5cy9ib290L2VmaS9sb2FkZXIvY29weS5jIGIvc3lzL2Jvb3QvZWZpL2xv YWRlci9jb3B5LmMKLS0tIGEvc3lzL2Jvb3QvZWZpL2xvYWRlci9jb3B5LmMKKysrIGIvc3lzL2Jv b3QvZWZpL2xvYWRlci9jb3B5LmMKQEAgLTM5LDEyICszOSw3MSBAQAogCiAjaW5jbHVkZSAibG9h ZGVyX2VmaS5oIgogCisjaWYgZGVmaW5lZChfX2kzODZfXykgfHwgZGVmaW5lZChfX2FtZDY0X18p CisKKyNkZWZpbmUgS0VSTkVMX1BIWVNJQ0FMX0JBU0UgKDIqMTAyNCoxMDI0KQorCitzdGF0aWMg dm9pZAorZWZpX3ZlcmlmeV9zdGFnaW5nX3NpemUodW5zaWduZWQgbG9uZyAqbnJfcGFnZXMpCit7 CisJVUlOVE4gc3o7CisJRUZJX01FTU9SWV9ERVNDUklQVE9SICptYXAsICpwOworCUVGSV9QSFlT SUNBTF9BRERSRVNTIHN0YXJ0LCBlbmQ7CisJVUlOVE4ga2V5LCBkc3o7CisJVUlOVDMyIGR2ZXI7 CisJRUZJX1NUQVRVUyBzdGF0dXM7CisJaW50IGksIG5kZXNjOworCXVuc2lnbmVkIGxvbmcgYXZh aWxhYmxlX3BhZ2VzOworCisJc3ogPSAwOworCXN0YXR1cyA9IEJTLT5HZXRNZW1vcnlNYXAoJnN6 LCAwLCAma2V5LCAmZHN6LCAmZHZlcik7CisJaWYgKHN0YXR1cyAhPSBFRklfQlVGRkVSX1RPT19T TUFMTCkgeworCQlwcmludGYoIkNhbid0IGRldGVybWluZSBtZW1vcnkgbWFwIHNpemVcbiIpOwor CQlyZXR1cm47CisJfQorCisJbWFwID0gbWFsbG9jKHN6KTsKKwlzdGF0dXMgPSBCUy0+R2V0TWVt b3J5TWFwKCZzeiwgbWFwLCAma2V5LCAmZHN6LCAmZHZlcik7CisJaWYgKEVGSV9FUlJPU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