Changeset 49845 in vbox for trunk/include
- Timestamp:
- Dec 9, 2013 3:18:59 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 91190
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm-amd64-x86.h
r49182 r49845 1767 1767 1768 1768 /** 1769 * Reads a machine specific register, extended version (for AMD). 1770 * 1771 * @returns Register content. 1772 * @param uRegister Register to read. 1773 * @param uXDI RDI/EDI value. 1774 */ 1775 #if RT_INLINE_ASM_EXTERNAL 1776 DECLASM(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTREG uXDI); 1777 #else 1778 DECLINLINE(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTREG uXDI) 1779 { 1780 RTUINT64U u; 1781 # if RT_INLINE_ASM_GNU_STYLE 1782 __asm__ __volatile__("rdmsr\n\t" 1783 : "=a" (u.s.Lo), 1784 "=d" (u.s.Hi) 1785 : "c" (uRegister), 1786 "D" (uXDI)); 1787 1788 # else 1789 __asm 1790 { 1791 mov ecx, [uRegister] 1792 xchg edi, [uXDI] 1793 rdmsr 1794 mov [u.s.Lo], eax 1795 mov [u.s.Hi], edx 1796 xchg edi, [uXDI] 1797 } 1798 # endif 1799 1800 return u.u; 1801 } 1802 #endif 1803 1804 1805 /** 1806 * Writes a machine specific register, extended version (for AMD). 1807 * 1808 * @returns Register content. 1809 * @param uRegister Register to write to. 1810 * @param uXDI RDI/EDI value. 1811 * @param u64Val Value to write. 1812 */ 1813 #if RT_INLINE_ASM_EXTERNAL 1814 DECLASM(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTREG uXDI, uint64_t u64Val); 1815 #else 1816 DECLINLINE(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTREG uXDI, uint64_t u64Val) 1817 { 1818 RTUINT64U u; 1819 1820 u.u = u64Val; 1821 # if RT_INLINE_ASM_GNU_STYLE 1822 __asm__ __volatile__("wrmsr\n\t" 1823 ::"a" (u.s.Lo), 1824 "d" (u.s.Hi), 1825 "c" (uRegister), 1826 "D" (uXDI)); 1827 1828 # else 1829 __asm 1830 { 1831 mov ecx, [uRegister] 1832 xchg edi, [uXDI] 1833 mov edx, [u.s.Hi] 1834 mov eax, [u.s.Lo] 1835 wrmsr 1836 xchg edi, [uXDI] 1837 } 1838 # endif 1839 } 1840 #endif 1841 1842 1843 1844 /** 1769 1845 * Reads low part of a machine specific register. 1770 1846 *
Note:
See TracChangeset
for help on using the changeset viewer.