VirtualBox

Changeset 48990 in vbox


Ignore:
Timestamp:
Oct 9, 2013 9:37:16 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
89710
Message:

Runtime: ASMGetSegAttr.

Location:
trunk
Files:
1 added
2 edited

Legend:

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

    r48572 r48990  
    379379
    380380/**
     381 * Get the access rights for the segment selector.
     382 *
     383 * @returns The access rights on success or ~0U on failure.
     384 * @param   uSel        The selector value.
     385 *
     386 * @remarks Using ~0U for failure is chosen because valid access rights always
     387 *          have bits 0:7 as 0 (on both Intel & AMD).
     388 */
     389#if RT_INLINE_ASM_EXTERNAL
     390DECLASM(uint32_t) ASMGetSegAttr(RTSEL uSel);
     391#else
     392DECLINLINE(uint32_t) ASMGetSegAttr(RTSEL uSel)
     393{
     394    uint32_t uAttr;
     395    /* LAR only accesses 16-bit of the source operand, but eax for the
     396       destination operand is required for getting the full 32-bit access rights. */
     397# if RT_INLINE_ASM_GNU_STYLE
     398    __asm__ __volatile__("mov %1, %%ax\n\t"
     399                         "larl %%eax, %0\n\t"
     400                         "jz done%=\n\t"
     401                         "movl $0xffffffff, %0\n\t"
     402                         "done%=:\n\t"
     403                         : "=r" (uAttr)
     404                         : "r" (uSel)
     405                         : "cc", "%eax");
     406# else
     407    __asm
     408    {
     409        mov     ax, [uSel]
     410        larl    [uAttr], eax
     411        jz      done
     412        mov     [uAttr], ~0h
     413        done:
     414    }
     415# endif
     416    return uAttr;
     417}
     418#endif
     419
     420
     421/**
    381422 * Get the [RE]FLAGS register.
    382423 * @returns [RE]FLAGS.
  • trunk/src/VBox/Runtime/Makefile.kmk

    r48902 r48990  
    198198        common/asm/ASMGetGDTR.asm \
    199199        common/asm/ASMGetLDTR.asm \
     200        common/asm/ASMGetSegAttr.asm \
    200201        common/asm/ASMGetTR.asm
    201202
     
    206207        common/asm/ASMAtomicCmpXchgU8.asm \
    207208        common/asm/ASMMultU64ByU32DivByU32.asm \
    208         common/asm/ASMCpuId_Idx_ECX.asm
     209        common/asm/ASMCpuId_Idx_ECX.asm \
     210        common/asm/ASMGetSegAttr.asm
    209211
    210212#
Note: See TracChangeset for help on using the changeset viewer.

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