ASMRdMsrEx.asm revision ae6d6d0be49d981beb888db250c3d9f56a23a6d1
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; $Id$
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync;; @file
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; IPRT - ASMRdMsrEx().
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync;
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync
772269936494ffaddd0750ba9e28e805ba81398cvboxsync;
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; Copyright (C) 2013 Oracle Corporation
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync;
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; available from http://www.virtualbox.org. This file is free software;
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; you can redistribute it and/or modify it under the terms of the GNU
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; General Public License (GPL) as published by the Free Software
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b87790df72dd730ef361a1ce1a8d40ed4d15e10vboxsync;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync; The contents of this file may alternatively be used under the terms
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync; of the Common Development and Distribution License Version 1.0
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; VirtualBox OSE distribution, in which case the provisions of the
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; CDDL are applicable instead of those of the GPL.
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync;
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; You may elect to license modified versions of this file under the
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; terms and conditions of either the GPL or the CDDL or both.
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync;
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync;*******************************************************************************
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync;* Header Files *
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync;*******************************************************************************
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync%include "iprt/asmdefs.mac"
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsyncBEGINCODE
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync;;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync; Special version of ASMRdMsr that allow specifying the rdi value.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync;
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync; @param uMsr msc=rcx, gcc=rdi, x86=[ebp+8] The MSR to read.
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; @param uEdi msc=rdx, gcc=rsi, x86=[ebp+12] The EDI/RDI value.
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync; @returns MSR value in rax on amd64 and edx:eax on x86.
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync;
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsyncBEGINPROC_EXPORTED ASMRdMsrEx
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync%ifdef ASM_CALL64_MSC
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsyncproc_frame ASMRdMsrEx_DupWarningHack
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync push rdi
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync [pushreg rdi]
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync[endprolog]
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync and ecx, ecx ; serious paranoia
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync mov rdi, rdx
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync xor eax, eax
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync xor edx, edx
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync rdmsr
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync pop rdi
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync and eax, eax ; paranoia
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync shl rdx, 32
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync or rax, rdx
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync ret
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsyncendproc_frame
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync%elifdef ASM_CALL64_GCC
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync mov ecx, edi
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync mov rdi, rsi
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync xor eax, eax
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync xor edx, edx
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync rdmsr
52831df2c11f241bf670f904d23a4fbb3ef5e5bbvboxsync and eax, eax ; paranoia
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync shl rdx, 32
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync or rax, rdx
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync ret
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync%elifdef RT_ARCH_X86
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync push ebp
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync mov ebp, esp
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync push edi
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync xor eax, eax
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync xor edx, edx
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync mov ecx, [ebp + 8]
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync mov edi, [esp + 12]
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync rdmsr
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync pop edi
20fc4a350a4a8e56ffaac6cf57dcd677a7ac36c5vboxsync leave
38ce01f0174eaa361f03608d5576e517a615a9dbvboxsync ret
20fc4a350a4a8e56ffaac6cf57dcd677a7ac36c5vboxsync%else
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync %error "Undefined arch?"
1b23da133a9fa48adc1ea464ef9f17ceeacf6742vboxsync%endif
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsyncENDPROC ASMRdMsrEx
38ce01f0174eaa361f03608d5576e517a615a9dbvboxsync
c550c12592dedfe03ef31ce25305c688073dc72cvboxsync