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