ASMGetSegAttr.asm revision 13fbdf4315781565f3f3ca1ca811e533faabff4d
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; $Id$
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;; @file
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; IPRT - ASMGetSegAttr().
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c626bd8465f241db74519c3c8dbe59ea620a9e34vboxsync; Copyright (C) 2013 Oracle Corporation
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; available from http://www.virtualbox.org. This file is free software;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; you can redistribute it and/or modify it under the terms of the GNU
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; General Public License (GPL) as published by the Free Software
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; The contents of this file may alternatively be used under the terms
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; of the Common Development and Distribution License Version 1.0
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; VirtualBox OSE distribution, in which case the provisions of the
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; CDDL are applicable instead of those of the GPL.
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; You may elect to license modified versions of this file under the
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; terms and conditions of either the GPL or the CDDL or both.
4ad0e04fb2a93fb4980de2644f7ccca9e8869083vboxsync;
2d97f8baccdd684bc0a8a15eb86bbe9ff2b85374vboxsync
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync;*******************************************************************************
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync;* Header Files *
43747b1f0bc8302a238fb35e55857a5e9aa1933dvboxsync;*******************************************************************************
3942acfaf590eaef4740d7b8a5311bb91e2bed0dvboxsync%include "iprt/asmdefs.mac"
c64777b77514bdc924249d2f9900be25079b0d84vboxsync
0c437bb10c61b229407a7517efde04dfe3b1e4a1vboxsyncBEGINCODE
c64777b77514bdc924249d2f9900be25079b0d84vboxsync
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; Get the segment attributes for a selector.
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; @param uSel x86: [ebp + 08h] msc: ecx gcc: edi The selector value.
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; @returns Segment attributes on success or ~0U on failure.
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; @remarks Using ~0U for failure is chosen because valid access rights always
c64777b77514bdc924249d2f9900be25079b0d84vboxsync; have bits 0:7 as 0 (on both Intel & AMD).
c64777b77514bdc924249d2f9900be25079b0d84vboxsync;
c64777b77514bdc924249d2f9900be25079b0d84vboxsyncBEGINPROC_EXPORTED ASMGetSegAttr
c64777b77514bdc924249d2f9900be25079b0d84vboxsync%ifdef ASM_CALL64_MSC
c64777b77514bdc924249d2f9900be25079b0d84vboxsync and ecx, 0ffffh
c64777b77514bdc924249d2f9900be25079b0d84vboxsync lar eax, ecx
c64777b77514bdc924249d2f9900be25079b0d84vboxsync%elifdef ASM_CALL64_GCC
c64777b77514bdc924249d2f9900be25079b0d84vboxsync and edi, 0ffffh
274fa6f604b8c189c2872bf928f5557680e4a887vboxsync lar eax, edi
c64777b77514bdc924249d2f9900be25079b0d84vboxsync%elifdef RT_ARCH_X86
c64777b77514bdc924249d2f9900be25079b0d84vboxsync movzx edx, word [esp + 4]
c64777b77514bdc924249d2f9900be25079b0d84vboxsync lar eax, edx
c64777b77514bdc924249d2f9900be25079b0d84vboxsync%else
c64777b77514bdc924249d2f9900be25079b0d84vboxsync %error "Which arch is this?"
1b68cc0f95e7b0033b20dfc4fdbc260b7a2cef68vboxsync%endif
c64777b77514bdc924249d2f9900be25079b0d84vboxsync jz .return
3942acfaf590eaef4740d7b8a5311bb91e2bed0dvboxsync mov eax, 0ffffffffh
c64777b77514bdc924249d2f9900be25079b0d84vboxsync.return:
c64777b77514bdc924249d2f9900be25079b0d84vboxsync ret
c64777b77514bdc924249d2f9900be25079b0d84vboxsyncENDPROC ASMGetSegAttr
c64777b77514bdc924249d2f9900be25079b0d84vboxsync
c64777b77514bdc924249d2f9900be25079b0d84vboxsync