VirtualBox

Changeset 58705 in vbox


Ignore:
Timestamp:
Nov 16, 2015 4:26:56 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104132
Message:

iprt/asm-amd64-x86.h: 16-bit and 32-bit Watcom C/C++ adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm-amd64-x86.h

    r57926 r58705  
    9393    uint16_t    cbIdt;
    9494    /** Address of the IDT. */
    95     uintptr_t   pIdt;
     95#if ARCH_BITS != 64
     96    uint32_t    pIdt;
     97#else
     98    uint64_t    pIdt;
     99#endif
    96100} RTIDTR, *PRTIDTR;
    97101#pragma pack()
     
    102106{
    103107    /** Alignment padding.   */
    104     uint8_t     au16Padding[ARCH_BITS == 64 ? 3 : 1];
     108    uint16_t    au16Padding[ARCH_BITS == 64 ? 3 : 1];
    105109    /** The IDTR structure.  */
    106110    RTIDTR      Idtr;
     
    116120    RTIDTRALIGNEDINT    s;
    117121} RTIDTRALIGNED;
    118 AssertCompileSize(RTIDTRALIGNED, ARCH_BITS * 2 / 8);
     122AssertCompileSize(RTIDTRALIGNED, ((ARCH_BITS == 64) + 1) * 8);
    119123/** Pointer to a an RTIDTR alignment wrapper. */
    120124typedef RTIDTRALIGNED *PRIDTRALIGNED;
     
    128132    uint16_t    cbGdt;
    129133    /** Address of the GDT. */
    130     uintptr_t   pGdt;
     134#if ARCH_BITS != 64
     135    uint32_t    pGdt;
     136#else
     137    uint64_t    pGdt;
     138#endif
    131139} RTGDTR, *PRTGDTR;
    132140#pragma pack()
     
    137145{
    138146    /** Alignment padding.   */
    139     uint8_t     au16Padding[ARCH_BITS == 64 ? 3 : 1];
     147    uint16_t    au16Padding[ARCH_BITS == 64 ? 3 : 1];
    140148    /** The GDTR structure.  */
    141149    RTGDTR      Gdtr;
     
    151159    RTGDTRALIGNEDINT    s;
    152160} RTGDTRALIGNED;
    153 AssertCompileSize(RTGDTRALIGNED, ARCH_BITS * 2 / 8);
     161AssertCompileSize(RTIDTRALIGNED, ((ARCH_BITS == 64) + 1) * 8);
    154162/** Pointer to a an RTGDTR alignment wrapper. */
    155163typedef RTGDTRALIGNED *PRGDTRALIGNED;
     
    15531561 */
    15541562#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1555 DECLASM(RTCCUINTREG) ASMGetCR0(void);
    1556 #else
    1557 DECLINLINE(RTCCUINTREG) ASMGetCR0(void)
    1558 {
    1559     RTCCUINTREG uCR0;
     1563DECLASM(RTCCUINTXREG) ASMGetCR0(void);
     1564#else
     1565DECLINLINE(RTCCUINTXREG) ASMGetCR0(void)
     1566{
     1567    RTCCUINTXREG uCR0;
    15601568# if RT_INLINE_ASM_USES_INTRIN
    15611569    uCR0 = __readcr0();
     
    15891597 */
    15901598#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1591 DECLASM(void) ASMSetCR0(RTCCUINTREG uCR0);
    1592 #else
    1593 DECLINLINE(void) ASMSetCR0(RTCCUINTREG uCR0)
     1599DECLASM(void) ASMSetCR0(RTCCUINTXREG uCR0);
     1600#else
     1601DECLINLINE(void) ASMSetCR0(RTCCUINTXREG uCR0)
    15941602{
    15951603# if RT_INLINE_ASM_USES_INTRIN
     
    16231631 */
    16241632#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1625 DECLASM(RTCCUINTREG) ASMGetCR2(void);
    1626 #else
    1627 DECLINLINE(RTCCUINTREG) ASMGetCR2(void)
    1628 {
    1629     RTCCUINTREG uCR2;
     1633DECLASM(RTCCUINTXREG) ASMGetCR2(void);
     1634#else
     1635DECLINLINE(RTCCUINTXREG) ASMGetCR2(void)
     1636{
     1637    RTCCUINTXREG uCR2;
    16301638# if RT_INLINE_ASM_USES_INTRIN
    16311639    uCR2 = __readcr2();
     
    16591667 */
    16601668#if RT_INLINE_ASM_EXTERNAL
    1661 DECLASM(void) ASMSetCR2(RTCCUINTREG uCR2);
    1662 #else
    1663 DECLINLINE(void) ASMSetCR2(RTCCUINTREG uCR2)
     1669DECLASM(void) ASMSetCR2(RTCCUINTXREG uCR2);
     1670#else
     1671DECLINLINE(void) ASMSetCR2(RTCCUINTXREG uCR2)
    16641672{
    16651673# if RT_INLINE_ASM_GNU_STYLE
     
    16901698 */
    16911699#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1692 DECLASM(RTCCUINTREG) ASMGetCR3(void);
    1693 #else
    1694 DECLINLINE(RTCCUINTREG) ASMGetCR3(void)
    1695 {
    1696     RTCCUINTREG uCR3;
     1700DECLASM(RTCCUINTXREG) ASMGetCR3(void);
     1701#else
     1702DECLINLINE(RTCCUINTXREG) ASMGetCR3(void)
     1703{
     1704    RTCCUINTXREG uCR3;
    16971705# if RT_INLINE_ASM_USES_INTRIN
    16981706    uCR3 = __readcr3();
     
    17271735 */
    17281736#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1729 DECLASM(void) ASMSetCR3(RTCCUINTREG uCR3);
    1730 #else
    1731 DECLINLINE(void) ASMSetCR3(RTCCUINTREG uCR3)
     1737DECLASM(void) ASMSetCR3(RTCCUINTXREG uCR3);
     1738#else
     1739DECLINLINE(void) ASMSetCR3(RTCCUINTXREG uCR3)
    17321740{
    17331741# if RT_INLINE_ASM_USES_INTRIN
     
    17681776
    17691777# elif RT_INLINE_ASM_GNU_STYLE
    1770     RTCCUINTREG u;
     1778    RTCCUINTXREG u;
    17711779#  ifdef RT_ARCH_AMD64
    17721780    __asm__ __volatile__("movq %%cr3, %0\n\t"
     
    17991807 */
    18001808#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1801 DECLASM(RTCCUINTREG) ASMGetCR4(void);
    1802 #else
    1803 DECLINLINE(RTCCUINTREG) ASMGetCR4(void)
    1804 {
    1805     RTCCUINTREG uCR4;
     1809DECLASM(RTCCUINTXREG) ASMGetCR4(void);
     1810#else
     1811DECLINLINE(RTCCUINTXREG) ASMGetCR4(void)
     1812{
     1813    RTCCUINTXREG uCR4;
    18061814# if RT_INLINE_ASM_USES_INTRIN
    18071815    uCR4 = __readcr4();
     
    18411849 */
    18421850#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1843 DECLASM(void) ASMSetCR4(RTCCUINTREG uCR4);
    1844 #else
    1845 DECLINLINE(void) ASMSetCR4(RTCCUINTREG uCR4)
     1851DECLASM(void) ASMSetCR4(RTCCUINTXREG uCR4);
     1852#else
     1853DECLINLINE(void) ASMSetCR4(RTCCUINTXREG uCR4)
    18461854{
    18471855# if RT_INLINE_ASM_USES_INTRIN
     
    18781886 */
    18791887#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    1880 DECLASM(RTCCUINTREG) ASMGetCR8(void);
    1881 #else
    1882 DECLINLINE(RTCCUINTREG) ASMGetCR8(void)
     1888DECLASM(RTCCUINTXREG) ASMGetCR8(void);
     1889#else
     1890DECLINLINE(RTCCUINTXREG) ASMGetCR8(void)
    18831891{
    18841892# ifdef RT_ARCH_AMD64
    1885     RTCCUINTREG uCR8;
     1893    RTCCUINTXREG uCR8;
    18861894#  if RT_INLINE_ASM_USES_INTRIN
    18871895    uCR8 = __readcr8();
     
    21182126 */
    21192127#if RT_INLINE_ASM_EXTERNAL
    2120 DECLASM(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTREG uXDI);
    2121 #else
    2122 DECLINLINE(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTREG uXDI)
     2128DECLASM(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI);
     2129#else
     2130DECLINLINE(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI)
    21232131{
    21242132    RTUINT64U u;
     
    21562164 */
    21572165#if RT_INLINE_ASM_EXTERNAL
    2158 DECLASM(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTREG uXDI, uint64_t u64Val);
    2159 #else
    2160 DECLINLINE(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTREG uXDI, uint64_t u64Val)
     2166DECLASM(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI, uint64_t u64Val);
     2167#else
     2168DECLINLINE(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI, uint64_t u64Val)
    21612169{
    21622170    RTUINT64U u;
     
    22622270 */
    22632271#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2264 DECLASM(RTCCUINTREG) ASMGetDR0(void);
    2265 #else
    2266 DECLINLINE(RTCCUINTREG) ASMGetDR0(void)
    2267 {
    2268     RTCCUINTREG uDR0;
     2272DECLASM(RTCCUINTXREG) ASMGetDR0(void);
     2273#else
     2274DECLINLINE(RTCCUINTXREG) ASMGetDR0(void)
     2275{
     2276    RTCCUINTXREG uDR0;
    22692277# if RT_INLINE_ASM_USES_INTRIN
    22702278    uDR0 = __readdr(0);
     
    22982306 */
    22992307#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2300 DECLASM(RTCCUINTREG) ASMGetDR1(void);
    2301 #else
    2302 DECLINLINE(RTCCUINTREG) ASMGetDR1(void)
    2303 {
    2304     RTCCUINTREG uDR1;
     2308DECLASM(RTCCUINTXREG) ASMGetDR1(void);
     2309#else
     2310DECLINLINE(RTCCUINTXREG) ASMGetDR1(void)
     2311{
     2312    RTCCUINTXREG uDR1;
    23052313# if RT_INLINE_ASM_USES_INTRIN
    23062314    uDR1 = __readdr(1);
     
    23342342 */
    23352343#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2336 DECLASM(RTCCUINTREG) ASMGetDR2(void);
    2337 #else
    2338 DECLINLINE(RTCCUINTREG) ASMGetDR2(void)
    2339 {
    2340     RTCCUINTREG uDR2;
     2344DECLASM(RTCCUINTXREG) ASMGetDR2(void);
     2345#else
     2346DECLINLINE(RTCCUINTXREG) ASMGetDR2(void)
     2347{
     2348    RTCCUINTXREG uDR2;
    23412349# if RT_INLINE_ASM_USES_INTRIN
    23422350    uDR2 = __readdr(2);
     
    23702378 */
    23712379#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2372 DECLASM(RTCCUINTREG) ASMGetDR3(void);
    2373 #else
    2374 DECLINLINE(RTCCUINTREG) ASMGetDR3(void)
    2375 {
    2376     RTCCUINTREG uDR3;
     2380DECLASM(RTCCUINTXREG) ASMGetDR3(void);
     2381#else
     2382DECLINLINE(RTCCUINTXREG) ASMGetDR3(void)
     2383{
     2384    RTCCUINTXREG uDR3;
    23772385# if RT_INLINE_ASM_USES_INTRIN
    23782386    uDR3 = __readdr(3);
     
    24062414 */
    24072415#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2408 DECLASM(RTCCUINTREG) ASMGetDR6(void);
    2409 #else
    2410 DECLINLINE(RTCCUINTREG) ASMGetDR6(void)
    2411 {
    2412     RTCCUINTREG uDR6;
     2416DECLASM(RTCCUINTXREG) ASMGetDR6(void);
     2417#else
     2418DECLINLINE(RTCCUINTXREG) ASMGetDR6(void)
     2419{
     2420    RTCCUINTXREG uDR6;
    24132421# if RT_INLINE_ASM_USES_INTRIN
    24142422    uDR6 = __readdr(6);
     
    24422450 */
    24432451#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2444 DECLASM(RTCCUINTREG) ASMGetAndClearDR6(void);
    2445 #else
    2446 DECLINLINE(RTCCUINTREG) ASMGetAndClearDR6(void)
    2447 {
    2448     RTCCUINTREG uDR6;
     2452DECLASM(RTCCUINTXREG) ASMGetAndClearDR6(void);
     2453#else
     2454DECLINLINE(RTCCUINTXREG) ASMGetAndClearDR6(void)
     2455{
     2456    RTCCUINTXREG uDR6;
    24492457# if RT_INLINE_ASM_USES_INTRIN
    24502458    uDR6 = __readdr(6);
    24512459    __writedr(6, 0xffff0ff0U);          /* 31-16 and 4-11 are 1's, 12 and 63-31 are zero. */
    24522460# elif RT_INLINE_ASM_GNU_STYLE
    2453     RTCCUINTREG uNewValue = 0xffff0ff0U;/* 31-16 and 4-11 are 1's, 12 and 63-31 are zero. */
     2461    RTCCUINTXREG uNewValue = 0xffff0ff0U;/* 31-16 and 4-11 are 1's, 12 and 63-31 are zero. */
    24542462#  ifdef RT_ARCH_AMD64
    24552463    __asm__ __volatile__("movq   %%dr6, %0\n\t"
     
    24912499 */
    24922500#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2493 DECLASM(RTCCUINTREG) ASMGetDR7(void);
    2494 #else
    2495 DECLINLINE(RTCCUINTREG) ASMGetDR7(void)
    2496 {
    2497     RTCCUINTREG uDR7;
     2501DECLASM(RTCCUINTXREG) ASMGetDR7(void);
     2502#else
     2503DECLINLINE(RTCCUINTXREG) ASMGetDR7(void)
     2504{
     2505    RTCCUINTXREG uDR7;
    24982506# if RT_INLINE_ASM_USES_INTRIN
    24992507    uDR7 = __readdr(7);
     
    25272535 */
    25282536#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2529 DECLASM(void) ASMSetDR0(RTCCUINTREG uDRVal);
    2530 #else
    2531 DECLINLINE(void) ASMSetDR0(RTCCUINTREG uDRVal)
     2537DECLASM(void) ASMSetDR0(RTCCUINTXREG uDRVal);
     2538#else
     2539DECLINLINE(void) ASMSetDR0(RTCCUINTXREG uDRVal)
    25322540{
    25332541# if RT_INLINE_ASM_USES_INTRIN
     
    25612569 */
    25622570#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2563 DECLASM(void) ASMSetDR1(RTCCUINTREG uDRVal);
    2564 #else
    2565 DECLINLINE(void) ASMSetDR1(RTCCUINTREG uDRVal)
     2571DECLASM(void) ASMSetDR1(RTCCUINTXREG uDRVal);
     2572#else
     2573DECLINLINE(void) ASMSetDR1(RTCCUINTXREG uDRVal)
    25662574{
    25672575# if RT_INLINE_ASM_USES_INTRIN
     
    25952603 */
    25962604#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2597 DECLASM(void) ASMSetDR2(RTCCUINTREG uDRVal);
    2598 #else
    2599 DECLINLINE(void) ASMSetDR2(RTCCUINTREG uDRVal)
     2605DECLASM(void) ASMSetDR2(RTCCUINTXREG uDRVal);
     2606#else
     2607DECLINLINE(void) ASMSetDR2(RTCCUINTXREG uDRVal)
    26002608{
    26012609# if RT_INLINE_ASM_USES_INTRIN
     
    26292637 */
    26302638#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2631 DECLASM(void) ASMSetDR3(RTCCUINTREG uDRVal);
    2632 #else
    2633 DECLINLINE(void) ASMSetDR3(RTCCUINTREG uDRVal)
     2639DECLASM(void) ASMSetDR3(RTCCUINTXREG uDRVal);
     2640#else
     2641DECLINLINE(void) ASMSetDR3(RTCCUINTXREG uDRVal)
    26342642{
    26352643# if RT_INLINE_ASM_USES_INTRIN
     
    26632671 */
    26642672#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2665 DECLASM(void) ASMSetDR6(RTCCUINTREG uDRVal);
    2666 #else
    2667 DECLINLINE(void) ASMSetDR6(RTCCUINTREG uDRVal)
     2673DECLASM(void) ASMSetDR6(RTCCUINTXREG uDRVal);
     2674#else
     2675DECLINLINE(void) ASMSetDR6(RTCCUINTXREG uDRVal)
    26682676{
    26692677# if RT_INLINE_ASM_USES_INTRIN
     
    26972705 */
    26982706#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
    2699 DECLASM(void) ASMSetDR7(RTCCUINTREG uDRVal);
    2700 #else
    2701 DECLINLINE(void) ASMSetDR7(RTCCUINTREG uDRVal)
     2707DECLASM(void) ASMSetDR7(RTCCUINTXREG uDRVal);
     2708#else
     2709DECLINLINE(void) ASMSetDR7(RTCCUINTXREG uDRVal)
    27022710{
    27032711# if RT_INLINE_ASM_USES_INTRIN
     
    33143322#endif /* !_MSC_VER) || !RT_ARCH_AMD64 */
    33153323
     3324#if defined(__WATCOMC__) && ARCH_BITS == 16
     3325# include "asm-amd64-x86-watcom-16.h"
     3326#elif defined(__WATCOMC__) && ARCH_BITS == 32
     3327# include "asm-amd64-x86-watcom-32.h"
     3328#endif
     3329
    33163330/** @} */
    33173331#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette